[jboss-cvs] jboss-seam/src/main/org/jboss/seam/contexts ...

Norman Richards norman.richards at jboss.com
Fri Nov 16 01:27:10 EST 2007


  User: nrichards
  Date: 07/11/16 01:27:10

  Modified:    src/main/org/jboss/seam/contexts  EntityBeanList.java
  Log:
  JBSEAM-2214
  
  Revision  Changes    Path
  1.6       +31 -24    jboss-seam/src/main/org/jboss/seam/contexts/EntityBeanList.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: EntityBeanList.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/contexts/EntityBeanList.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -b -r1.5 -r1.6
  --- EntityBeanList.java	21 Jun 2007 21:45:30 -0000	1.5
  +++ EntityBeanList.java	16 Nov 2007 06:27:10 -0000	1.6
  @@ -59,33 +59,40 @@
               list.set( i, passivatedEntity.toEntityReference(true) );
            }
         }
  +      passivatedEntityList=null;
      }
   
      @Override
      protected void passivateAll()
      {
  -      passivatedEntityList = new ArrayList<PassivatedEntity>( list.size() );
  +       List<PassivatedEntity> newPassivatedList = new ArrayList<PassivatedEntity>(list.size());               
  +
         boolean found = false;
  -      for (int i=0; i<list.size(); i++ )
  -      {
  -         Object value = list.get(i);
  +       for (int i=0; i<list.size(); i++) {
            PassivatedEntity passivatedEntity = null;
  -         if (value!=null)
  -         {
  +           Object value = list.get(i);
  +           if (value != null) {
               passivatedEntity = PassivatedEntity.passivateEntity(value);
  -            if (passivatedEntity!=null)
  -            {
  -               if (!found) list = new ArrayList(list);
  +               
  +               if (passivatedEntity!=null) {
  +                   if (!found) {
  +                       list = new ArrayList(list);
                  found=true;
  +                   }
  +
                  //this would be dangerous, except that we 
                  //are doing it to a copy of the original 
                  //list:
                  list.set(i, null); 
               }
            }
  -         passivatedEntityList.add(passivatedEntity);
  +           newPassivatedList.add(passivatedEntity);
  +       }
  +       
  +       // if the original list was nulled out, we don't want to overwrite the passivatedEntity list
  +       if (found) {
  +           passivatedEntityList = newPassivatedList;
         }
  -      if (!found) passivatedEntityList=null;
      }
      
   }
  
  
  



More information about the jboss-cvs-commits mailing list