harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tim Ellison (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (HARMONY-2402) [classlib][luni] java.io.ObjectInputStream.registerValidation throws InvalidObjectException while RI throws NotActiveException
Date Fri, 29 Dec 2006 20:29:23 GMT
     [ http://issues.apache.org/jira/browse/HARMONY-2402?page=all ]

Tim Ellison resolved HARMONY-2402.
----------------------------------

    Resolution: Fixed

I agree with Mikhail, that we should follow exception throwing order.  I've applied Mikhail's
patch, and couldn't help myself slightly reordering the code to make it more readable.

Code fixed in LUNI module at repo revision r491091.

Artem, please check that this fully resolves the problem.


> [classlib][luni] 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
>         Assigned To: Tim Ellison
>            Priority: Minor
>         Attachments: H-2402.patch
>
>
> 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