You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2004/05/13 16:56:57 UTC

DO NOT REPLY [Bug 28956] New: - Xalan sample program XSLTProcessorApplet breaks de-serialization across releases

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=28956>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=28956

Xalan sample program XSLTProcessorApplet breaks de-serialization across releases

           Summary: Xalan sample program XSLTProcessorApplet breaks de-
                    serialization across releases
           Product: XalanJ2
           Version: CurrentCVS
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Xalan
        AssignedTo: xalan-dev@xml.apache.org
        ReportedBy: minchau@ca.ibm.com


If you create an org.apache.xalan.client.XSLTProcessorApplet object and 
serialize it with an earlier releases of Xalan, e.g. :
  . . .

        obj = new XSLTProcessorApplet();
        store(obj, "D:/temp/serialized.tmp");
 


    public static void store(Object obj, String filename)    {
        try   {
            FileOutputStream out = new FileOutputStream(filename);
            ObjectOutputStream s = new ObjectOutputStream(out);                
            s.writeObject(obj);
            s.flush();
            s.close();            
        }
        catch (Exception e)  {
            e.printStackTrace();
        }
    }

and later on you read it back in with the latest Xalan

        obj = load("D:/temp/serialized.tmp");
. . .

    public static Object load(String filename)
    {
        Object obj = null;
        FileInputStream in;
        try {
            in = new FileInputStream(filename);
            ObjectInputStream sin = new ObjectInputStream(in);
            obj = sin.readObject();
        }
        catch (Exception e)  {
            e.printStackTrace();
        }
        return obj;
    }

It will fail because of different serialVersionUID values.
This value is a "long" that is a hash of methods (except private) and various 
fields (including private!). Something has changed in XSLTProcessorApplet and 
we can't de-serialize an old object.

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org