You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Vladimir Ivanov (JIRA)" <ji...@apache.org> on 2006/07/12 08:35:31 UTC

[jira] Commented: (HARMONY-846) [classlib][io] unexpected exceptions for ObjectInputStream().read methods
    [ http://issues.apache.org/jira/browse/HARMONY-846?page=comments#action_12420526 ] 

Vladimir Ivanov commented on HARMONY-846:
-----------------------------------------

Note, NotActiveException is subclass of IOException so case 2) should not be fixed.

> [classlib][io] unexpected exceptions for ObjectInputStream().read<Object> methods
> ---------------------------------------------------------------------------------
>
>          Key: HARMONY-846
>          URL: http://issues.apache.org/jira/browse/HARMONY-846
>      Project: Harmony
>         Type: Bug

>   Components: Classlib
>     Reporter: Vladimir Ivanov
>  Attachments: ObjectInputStreamTest.patch
>
> The Harmony methods of the java.io.ObjectInputStream class have different behavior in compare with RI:
> 1)  For readObject() and readObjectOverride() Harmony throws IOException while RI returns null
> 2)  For readClassDescriptor() Harmony throws NotActiveException while RI throws NPE
> ==================== test.java =======================
> import java.io.*;
> public class test  { 
>     public static void main (String[] args) {   
>        try {
>            System.out.println("readObject = " + new testObjectInputStream().readObject());                                       
>        } catch (Exception e) {
>            e.printStackTrace();
>        } 
>        try {
>            System.out.println("readObjectOverride = " + new testObjectInputStream().readObjectOverride());
>        } catch (Exception e) {
>            e.printStackTrace();
>        }  
>        try {
>            System.out.println("readClassDescriptor = " + new testObjectInputStream().readClassDescriptor());
>        } catch (Exception e) {
>            e.printStackTrace();
>        }       
>     }
> }
> class testObjectInputStream extends ObjectInputStream {
>     public testObjectInputStream() throws IOException{
>         super();
>     }
>     public Object readObjectOverride() throws IOException,  ClassNotFoundException{
>         return super.readObjectOverride();
>     }
>     public ObjectStreamClass readClassDescriptor() throws IOException,  ClassNotFoundException{
>         return super.readClassDescriptor();
>     }
> }
> ==================================================
> Output:
> C:\tmp\tmp17>C:\jrockit-jdk1.5.0-windows-ia32\bin\java.exe -cp . -showversion test
> java version "1.5.0"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
> BEA WebLogic JRockit(R) (build dra-38972-20041208-2001-win-ia32, R25.0.0-75, GC: System optimized over throughput (initial strategy singleparpar))
> readObject = null
> readObjectOverride = null
> java.lang.NullPointerException
>         at java.io.ObjectInputStream.readUTF()Ljava.lang.String;(Unknown Source)
>         at java.io.ObjectStreamClass.readNonProxy(Ljava.io.ObjectInputStream;)V(Unknown Source)
>         at java.io.ObjectInputStream.readClassDescriptor()Ljava.io.ObjectStreamClass;(Unknown Source)
>         at testObjectInputStream.readClassDescriptor(test.java:31)
>         at test.main(test.java:16)
> C:\tmp\tmp17>C:\harmony\trunk_0427\deploy\jdk\jre\bin\java.exe -cp . -showversion test
> java version 1.5 (subset)
> (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> java.io.IOException
>         at java.io.ObjectInputStream.readObjectOverride(ObjectInputStream.java:2072)
>         at testObjectInputStream.readObjectOverride(test.java:28)
>         at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2006)
>         at java.io.ObjectInputStream.readObject(ObjectInputStream.java:1976)
>         at test.main(test.java:6)
> java.io.IOException
>         at java.io.ObjectInputStream.readObjectOverride(ObjectInputStream.java:2072)
>         at testObjectInputStream.readObjectOverride(test.java:28)
>         at test.main(test.java:11)
> java.io.NotActiveException
>         at java.io.ObjectInputStream.readClassDescriptor(ObjectInputStream.java:1667)
>         at testObjectInputStream.readClassDescriptor(test.java:31)
>         at test.main(test.java:16)
>  

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