harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mikhail Markov (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-1429) Stream-based replacement does not work in ObjectOutputStream
Date Mon, 11 Sep 2006 18:12:22 GMT
Stream-based replacement does not work in ObjectOutputStream
------------------------------------------------------------

                 Key: HARMONY-1429
                 URL: http://issues.apache.org/jira/browse/HARMONY-1429
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
         Environment: Win XP
            Reporter: Mikhail Markov
            Priority: Critical


Patch for JIRA HARMONY-851 broke stream-based replacement mechanism in ObjectOutputStream.
This brokes normal RMI work as it uses this mechanism.
For example, the following test fails on Harmony and pass on RI:

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.NotSerializableException;
import java.io.ObjectOutputStream;
import java.io.OutputStream;

============== Test.java ================= 
public class Test {
    public static void main(String[] args) throws Exception {
        try {
            ObjectOutputStream out = new TestObjectOutputStream(new ByteArrayOutputStream());
            out.writeObject(new NotSerializable());
        } catch (NotSerializableException e) {
        }
    }


    private static class TestObjectOutputStream extends ObjectOutputStream {
        public TestObjectOutputStream(OutputStream out) throws IOException {
            super(out);
            enableReplaceObject(true);
        }

        protected Object replaceObject(Object obj) throws IOException {
            if (obj instanceof NotSerializable) {
                System.out.println("replaceObject called: obj = " + obj);
            }
            return obj;
        }
    }


    private static class NotSerializable {
    }
}
====================================== 

Output on RI:
replaceObject called: obj = Test$NotSerializable@1b3d3e

Output on Harmony is empty (replaceObject is not called).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message