You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by gd...@apache.org on 2004/05/31 15:18:22 UTC

cvs commit: incubator-geronimo/sandbox/messaging/src/java/org/apache/geronimo/messaging/io StreamOutputStream.java

gdamour     2004/05/31 06:18:22

  Modified:    sandbox/messaging/src/java/org/apache/geronimo/messaging/io
                        StreamOutputStream.java
  Log:
  The SUID of a Class equals to 0L if the class is not assignable to
  Serializable or if it is a proxy class. Hence it can not be used as a key
  of the ObjectStreamClass cache. Use the name of the Class instead.
  
  Revision  Changes    Path
  1.2       +11 -8     incubator-geronimo/sandbox/messaging/src/java/org/apache/geronimo/messaging/io/StreamOutputStream.java
  
  Index: StreamOutputStream.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/sandbox/messaging/src/java/org/apache/geronimo/messaging/io/StreamOutputStream.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- StreamOutputStream.java	11 May 2004 12:06:41 -0000	1.1
  +++ StreamOutputStream.java	31 May 2004 13:18:22 -0000	1.2
  @@ -24,6 +24,7 @@
   import java.io.OutputStream;
   import java.util.HashMap;
   import java.util.Map;
  +import java.util.WeakHashMap;
   
   
   /**
  @@ -58,11 +59,6 @@
        */
       public static final byte CACHED = 0x02;
   
  -    /**
  -     * Used to generate identifiers for cached ObjectStreamClasses.
  -     */
  -    private int seqID;
  -    
       private final StreamManager streamManager;
   
       /**
  @@ -71,7 +67,12 @@
       private final ReplacerResolver resolver;
       
       /**
  -     * ClassDescriptors to Integer map.
  +     * Used to generate identifiers for cached ObjectStreamClasses.
  +     */
  +    private int seqID;
  +    
  +    /**
  +     * Class name to ObjectStreamClass identifier map.
        */
       private final Map classDescCache;
       
  @@ -113,10 +114,12 @@
        * written, this implementation assigns it an identifier.
        * <BR>
        * This latter will be written for all the remaining requests.
  +     * 
  +     * @param desc Class description to be written to the stream.
        */
       protected void writeClassDescriptor(ObjectStreamClass desc)
           throws IOException {
  -        Long descKey = new Long(desc.getSerialVersionUID()); 
  +        String descKey = desc.getName();
           Integer id = (Integer) classDescCache.get(descKey);
           if ( null == id ) {
               id = new Integer(seqID++);