remm        2005/09/19 04:35:50

  Modified:    catalina/src/share/org/apache/catalina/session
                        StandardSession.java
               webapps/docs changelog.xml
  Log:
  - 36541: Full syncs using a Hashtable for session attributes, as mandated in
    the next specification.
  
  Revision  Changes    Path
  1.61      +11 -20    
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session/StandardSession.java
  
  Index: StandardSession.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session/StandardSession.java,v
  retrieving revision 1.60
  retrieving revision 1.61
  diff -u -r1.60 -r1.61
  --- StandardSession.java      16 Jun 2005 09:50:12 -0000      1.60
  +++ StandardSession.java      19 Sep 2005 11:35:49 -0000      1.61
  @@ -31,7 +31,9 @@
   import java.util.ArrayList;
   import java.util.Enumeration;
   import java.util.HashMap;
  +import java.util.Hashtable;
   import java.util.Iterator;
  +import java.util.Map;
   
   import javax.servlet.ServletContext;
   import javax.servlet.http.HttpSession;
  @@ -115,7 +117,7 @@
       /**
        * The collection of user data attributes associated with this Session.
        */
  -    protected HashMap attributes = new HashMap();
  +    protected Map attributes = new Hashtable();
   
   
       /**
  @@ -229,7 +231,7 @@
        * and event listeners.  <b>IMPLEMENTATION NOTE:</b> This object is
        * <em>not</em> saved and restored across session serializations!
        */
  -    protected transient HashMap notes = new HashMap();
  +    protected transient Map notes = new Hashtable();
   
   
       /**
  @@ -1266,10 +1268,7 @@
           }
   
           // Replace or add this attribute
  -        Object unbound = null;
  -        synchronized (attributes) {
  -            unbound = attributes.put(name, value);
  -        }
  +        Object unbound = attributes.put(name, value);
   
           // Call the valueUnbound() method if necessary
           if ((unbound != null) && (unbound != value) &&
  @@ -1376,7 +1375,7 @@
   
           // Deserialize the attribute count and attribute values
           if (attributes == null)
  -            attributes = new HashMap();
  +            attributes = new Hashtable();
           int n = ((Integer) stream.readObject()).intValue();
           boolean isValidSave = isValid;
           isValid = true;
  @@ -1388,9 +1387,7 @@
               if (manager.getContainer().getLogger().isDebugEnabled())
                   manager.getContainer().getLogger().debug("  loading 
attribute '" + name +
                       "' with value '" + value + "'");
  -            synchronized (attributes) {
  -                attributes.put(name, value);
  -            }
  +            attributes.put(name, value);
           }
           isValid = isValidSave;
   
  @@ -1399,7 +1396,7 @@
           }
   
           if (notes == null) {
  -            notes = new HashMap();
  +            notes = new Hashtable();
           }
       }
   
  @@ -1442,10 +1439,7 @@
           ArrayList saveNames = new ArrayList();
           ArrayList saveValues = new ArrayList();
           for (int i = 0; i < keys.length; i++) {
  -            Object value = null;
  -            synchronized (attributes) {
  -                value = attributes.get(keys[i]);
  -            }
  +            Object value = attributes.get(keys[i]);
               if (value == null)
                   continue;
               else if ( (value instanceof Serializable) 
  @@ -1599,10 +1593,7 @@
       protected void removeAttributeInternal(String name, boolean notify) {
   
           // Remove this attribute from our collection
  -        Object value = null;
  -        synchronized (attributes) {
  -            value = attributes.remove(name);
  -        }
  +        Object value = attributes.remove(name);
   
           // Do we need to do valueUnbound() and attributeRemoved() 
notification?
           if (!notify || (value == null)) {
  
  
  
  1.374     +3 -0      jakarta-tomcat-catalina/webapps/docs/changelog.xml
  
  Index: changelog.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/docs/changelog.xml,v
  retrieving revision 1.373
  retrieving revision 1.374
  diff -u -r1.373 -r1.374
  --- changelog.xml     14 Sep 2005 15:05:49 -0000      1.373
  +++ changelog.xml     19 Sep 2005 11:35:50 -0000      1.374
  @@ -63,6 +63,9 @@
           <bug>36113</bug>: Session persistence for objects with primitive 
types could fail in
           some rare cases (remm)
         </fix>
  +      <fix>
  +        <bug>36541</bug>: Full synchronization for session objects 
attributes collections (remm)
  +      </fix>
       </changelog>
     </subsection>
     
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to