harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leo Li (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-2239) [classlib][luni]ObjectOutputStream fails to call ReplaceObject while the serialized class is int.class
Date Mon, 20 Nov 2006 07:23:02 GMT
[classlib][luni]ObjectOutputStream fails to call ReplaceObject while the serialized class is

                 Key: HARMONY-2239
                 URL: http://issues.apache.org/jira/browse/HARMONY-2239
             Project: Harmony
          Issue Type: Bug
            Reporter: Leo Li

Here is the testcase:
public class SerTest extends TestCase {

    private static class TestSerializable implements Serializable{
        protected Object writeReplace() throws ObjectStreamException {
           return int.class;           
    private static class ObjectOutputStreamWithReplace extends ObjectOutputStream {
        public ObjectOutputStreamWithReplace(OutputStream out)
                throws IOException {

        protected Object replaceObject(Object obj) throws IOException {
        	return new Double(20);
    public void test_replaceObject() throws Exception {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStreamWithReplace oos = new ObjectOutputStreamWithReplace(baos);

        oos.writeObject(new TestSerializable());
        ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream (baos.toByteArray()));
        Object obj = ois.readObject();
        assertTrue("replaceObject has not been called", (obj instanceof Double));

RI passes.
Harmony fails.

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


View raw message