[seam-commits] Seam SVN: r14135 - branches/community/Seam_2_3/jboss-seam/src/main/java/org/jboss/seam/contexts.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Mon Jul 25 09:21:41 EDT 2011


Author: manaRH
Date: 2011-07-25 09:21:39 -0400 (Mon, 25 Jul 2011)
New Revision: 14135

Modified:
   branches/community/Seam_2_3/jboss-seam/src/main/java/org/jboss/seam/contexts/ServerConversationContext.java
Log:
JBSEAM-4819 - creating PC only if they needed for additions

Modified: branches/community/Seam_2_3/jboss-seam/src/main/java/org/jboss/seam/contexts/ServerConversationContext.java
===================================================================
--- branches/community/Seam_2_3/jboss-seam/src/main/java/org/jboss/seam/contexts/ServerConversationContext.java	2011-07-25 08:51:53 UTC (rev 14134)
+++ branches/community/Seam_2_3/jboss-seam/src/main/java/org/jboss/seam/contexts/ServerConversationContext.java	2011-07-25 13:21:39 UTC (rev 14135)
@@ -291,18 +291,22 @@
           }
           removals.clear();
 
-          // TODO this is a hack! We should find a more elegant way of handling
-          // new objects being added to additions during the following for-loop
-          PersistenceContexts.instance();
-          
-          //add new objects
-          for (Map.Entry<String, Object> entry: additions.entrySet())  {
-              Object attribute = entry.getValue();
-              
-              passivate(attribute); 
-              session.put(getKey(entry.getKey()), attribute);
+          // Nothing to do if there is no addition
+          if (!additions.isEmpty())
+          {
+             // TODO this is a hack! We should find a more elegant way of handling
+             // new objects being added to additions during the following for-loop
+             PersistenceContexts.instance();
+             
+             //add new objects
+             for (Map.Entry<String, Object> entry: additions.entrySet())  {
+                 Object attribute = entry.getValue();
+                 
+                 passivate(attribute); 
+                 session.put(getKey(entry.getKey()), attribute);
+             }
+             additions.clear();
           }
-          additions.clear();
       }
       else
       {



More information about the seam-commits mailing list