[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [cp-patches] RFC: ObjectInputStream fix for readResolve invocations
From: |
Mark Wielaard |
Subject: |
Re: [cp-patches] RFC: ObjectInputStream fix for readResolve invocations |
Date: |
Tue, 08 Nov 2005 23:13:27 +0100 |
Hi Wolfgang,
On Tue, 2005-11-08 at 21:55 +0100, Wolfgang Baer wrote:
> 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.
Yep, you are right. I added the ChangeLog messages that fixed this to
the bug and closed it.
> 2005-11-08 Wolfgang Baer <address@hidden>
>
> * java/io/ObjectInputStream.java:
> (processResolution) Pass Error, RuntimeException and
> ObjectStreamException through to the caller.
Yes, this makes sense.
> 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;
Multiple nitpicks here. The comment "Can throw Errors and
RuntimeExceptions if caused by the readResolve() user code" should not
be here, but a comment of public Object readObject() method. (The fact
that SUN also does this is not really that relevant imho.) The name
'ignore' is really a misnomer now. Maybe it isn't really confusing, but
it looks funny.
Feel free to commit this with or without these nitpicks fixed.
Thanks,
Mark
signature.asc
Description: This is a digitally signed message part