tmiller     2002/10/15 12:54:36

  Modified:    java/src/org/apache/xalan/xsltc/trax TemplatesImpl.java
                        TransformerFactoryImpl.java
  Log:
  bug fix 12317, serialization of Templates is fixed
  
  Revision  Changes    Path
  1.23      +18 -15    
xml-xalan/java/src/org/apache/xalan/xsltc/trax/TemplatesImpl.java
  
  Index: TemplatesImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/trax/TemplatesImpl.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- TemplatesImpl.java        15 Aug 2002 14:29:18 -0000      1.22
  +++ TemplatesImpl.java        15 Oct 2002 19:54:36 -0000      1.23
  @@ -68,6 +68,7 @@
   import java.io.Serializable;
   import java.io.ObjectInput;
   import java.io.ObjectOutput;
  +import java.io.ObjectInputStream;
   import java.io.IOException;
   import java.util.Properties;
   import java.security.AccessController;
  @@ -132,7 +133,7 @@
        * A reference to the transformer factory that this templates
        * object belongs to.
        */
  -    private TransformerFactoryImpl _tfactory = null;
  +    private transient TransformerFactoryImpl _tfactory = null;
   
       private class TransletClassLoader extends ClassLoader {
   
  @@ -144,6 +145,7 @@
        }
       }
   
  +
      /**
        * The only way to create an XSLTC emplate object
        * The bytecodes for the translet and auxiliary classes, plus the name of
  @@ -160,21 +162,22 @@
        _tfactory = tfactory;
       }
   
  -    public synchronized void writeExternal(ObjectOutput out) 
  -     throws IOException 
  -    {
  -     out.writeObject(_name);
  -     out.writeObject(_bytecodes);
  -     out.flush();
  -    }
  +    /**
  +     * Need for de-serialization, see readObject().
  +     */
  +    public TemplatesImpl() { }
   
  -    public synchronized void readExternal(ObjectInput in)
  -     throws IOException, ClassNotFoundException 
  +    /**
  +     *  Overrides the default readObject implementation since we decided
  +     *  it would be cleaner not to serialize the entire tranformer
  +     *  factory.  [ ref bugzilla 12317 ]
  +     */
  +    private void  readObject(ObjectInputStream is) 
  +      throws IOException, ClassNotFoundException 
       {
  -     _name      = (String)in.readObject();
  -     _bytecodes = (byte[][])in.readObject();
  -     _class     = null; // must be created again...
  -    }
  +     is.defaultReadObject();
  +     _tfactory = new TransformerFactoryImpl();
  +    } 
   
        /**
        * Store URIResolver needed for Transformers.
  
  
  
  1.53      +2 -2      
xml-xalan/java/src/org/apache/xalan/xsltc/trax/TransformerFactoryImpl.java
  
  Index: TransformerFactoryImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/trax/TransformerFactoryImpl.java,v
  retrieving revision 1.52
  retrieving revision 1.53
  diff -u -r1.52 -r1.53
  --- TransformerFactoryImpl.java       1 Oct 2002 18:38:03 -0000       1.52
  +++ TransformerFactoryImpl.java       15 Oct 2002 19:54:36 -0000      1.53
  @@ -162,7 +162,7 @@
       /**
        * The above hashtable stores objects of this class.
        */
  -    private class PIParamWrapper {
  +    private static class PIParamWrapper {
        public String _media = null;
        public String _title = null;
        public String _charset = null;
  
  
  

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

Reply via email to