harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Artem Aliev (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-2402) java.io.ObjectInputStream.registerValidation throws InvalidObjectException while RI throws NotActiveException
Date Mon, 04 Dec 2006 11:27:22 GMT
java.io.ObjectInputStream.registerValidation throws InvalidObjectException while RI throws
NotActiveException
-------------------------------------------------------------------------------------------------------------

                 Key: HARMONY-2402
                 URL: http://issues.apache.org/jira/browse/HARMONY-2402
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: Artem Aliev
            Priority: Minor


java.io.ObjectInputStream.registerValidation throws InvalidObjectException
while RI throws NotActiveException.
Harmony checks first parameter and if ObjectInputValidation obj == null -
throws InvalidObjectException.
RI throws java.io.NotActiveException: stream inactive.
Looks like a bug in RI because according to the specification
method must throw InvalidObjectException if  the validation object is null.

Test for reproducing:
import junit.framework.TestCase;
import java.io.*;

public class test extends TestCase {      

    public void test1 () { 
        ObjectInputStream obj=null; 
        try {           
            ByteArrayOutputStream byteArrayOutputStream = new
ByteArrayOutputStream();
            new ObjectOutputStream(byteArrayOutputStream);
            obj = new ObjectInputStream(new
ByteArrayInputStream(byteArrayOutputStream.toByteArray()));

        } catch (IOException e) {
            fail("unexpected IOException");
        }
        try {           
            obj.registerValidation(null,256);           
            fail("NotActiveException should be thrown");   
        } catch (NotActiveException e) {
            //expected
        } catch (InvalidObjectException e) {
            fail("NotActiveException should be thrown");
        }
    }     
}
Output on Sun 1.5:
==================
.F
Time: 0
There was 1 failure:
1) test1(test)junit.framework.AssertionFailedError: InvalidObjectException
should be thrown
        at test.test1(test.java:20)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)

FAILURES!!!
Tests run: 1,  Failures: 1,  Errors: 0

Output on Harmony:
==================
.
Time: 0.079

OK (1 test)


-- 
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