From e9c00e62d0aa1448248d377d82eb1b186152a061 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 1 Aug 2003 03:34:52 +0000 Subject: More for PR libgcj/11737: * java/io/ObjectInputStream.java (processResolution): Use getMethod. (getMethod): Make method accessible. (getField): Make field accessible. (setBooleanField): Don't call setAccessible here. (setByteField, setCharField, setDoubleField, setFloatField, setIntField, setLongField, setShortField, setObjectField): Likewise. (callReadMethod): Don't check whether method is null. Catch NoSuchMethodException. * java/io/ObjectOutputStream.java (callWriteMethod): Initialize cause on thrown exceptions. From-SVN: r70038 --- libjava/java/io/ObjectOutputStream.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'libjava/java/io/ObjectOutputStream.java') diff --git a/libjava/java/io/ObjectOutputStream.java b/libjava/java/io/ObjectOutputStream.java index 49cb636..1437a4f 100644 --- a/libjava/java/io/ObjectOutputStream.java +++ b/libjava/java/io/ObjectOutputStream.java @@ -1197,7 +1197,8 @@ public class ObjectOutputStream extends OutputStream } - private void callWriteMethod (Object obj, ObjectStreamClass osc) throws IOException + private void callWriteMethod (Object obj, ObjectStreamClass osc) + throws IOException { Class klass = osc.forClass(); try @@ -1220,13 +1221,19 @@ public class ObjectOutputStream extends OutputStream if (exception instanceof IOException) throw (IOException) exception; - throw new IOException ("Exception thrown from writeObject() on " + - klass + ": " + exception.getClass().getName()); + IOException ioe + = new IOException ("Exception thrown from writeObject() on " + + klass + ": " + exception.getClass().getName()); + ioe.initCause(exception); + throw ioe; } catch (Exception x) { - throw new IOException ("Failure invoking writeObject() on " + - klass + ": " + x.getClass().getName()); + IOException ioe + = new IOException ("Failure invoking writeObject() on " + + klass + ": " + x.getClass().getName()); + ioe.initCause(x); + throw ioe; } } -- cgit v1.1