classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] RFC: ObjectInputStream fix for readResolve invocations


From: Wolfgang Baer
Subject: [cp-patches] RFC: ObjectInputStream fix for readResolve invocations
Date: Tue, 08 Nov 2005 21:55:01 +0100
User-agent: Debian Thunderbird 1.0.7 (X11/20051017)

Hi all,

readResolve can throw ObjectStreamException's. In our implementation
currently all Errors and Exceptions are ignored. As a mauve test posted
to mauve-patches shows SUN passes Error, RuntimeException and ObjectStreamExceptions through to the caller.

The mauve test also shows (test number 1) that readResolve is actually
called by the ObjectInputStream implementation. Therefore I would say
that bug 22854 (readResolve isn't called) can be closed.

2005-11-08  Wolfgang Baer  <address@hidden>

        * java/io/ObjectInputStream.java:
        (processResolution) Pass Error, RuntimeException and
        ObjectStreamException through to the caller.

Regards,
Wolfgang

Index: java/io/ObjectInputStream.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/io/ObjectInputStream.java,v
retrieving revision 1.71
diff -u -r1.71 ObjectInputStream.java
--- java/io/ObjectInputStream.java      1 Nov 2005 23:32:21 -0000       1.71
+++ java/io/ObjectInputStream.java      8 Nov 2005 20:43:56 -0000
@@ -1567,6 +1567,15 @@
          }
        catch (InvocationTargetException ignore)
          {
+           // SUN passes Errors, RuntimeExceptions and
+           // ObjectStreamExceptions through to caller
+           Throwable cause = ignore.getCause();
+           if (cause instanceof ObjectStreamException)
+             throw (ObjectStreamException) cause;
+           else if (cause instanceof RuntimeException)
+             throw (RuntimeException) cause;
+           else if (cause instanceof Error)
+             throw (Error) cause;
          }
       }
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]