From 73eb130916f39f689a0c6089e4ee699d89f85907 Mon Sep 17 00:00:00 2001 From: Jeroen Frijters Date: Fri, 24 Sep 2004 09:05:10 +0000 Subject: ObjectInputStream.java (readObject): Delegate instantation of Externalizable classes to ObjectStreamClass. 2004-09-24 Jeroen Frijters * java/io/ObjectInputStream.java (readObject): Delegate instantation of Externalizable classes to ObjectStreamClass. * java/io/ObjectStreamClass.java (newInstance): New method to instantiate Externalizable (while ignoring the accessibility of the constructor). (constructor): New field to cache the constructor. From-SVN: r88019 --- libjava/java/io/ObjectInputStream.java | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) (limited to 'libjava/java/io/ObjectInputStream.java') diff --git a/libjava/java/io/ObjectInputStream.java b/libjava/java/io/ObjectInputStream.java index 809e9b1..b9bba27 100644 --- a/libjava/java/io/ObjectInputStream.java +++ b/libjava/java/io/ObjectInputStream.java @@ -291,29 +291,7 @@ public class ObjectInputStream extends InputStream if (osc.realClassIsExternalizable) { - Externalizable obj = null; - - try - { - obj = (Externalizable)clazz.newInstance(); - } - catch (InstantiationException e) - { - throw new ClassNotFoundException - ("Instance of " + clazz + " could not be created"); - } - catch (IllegalAccessException e) - { - throw new ClassNotFoundException - ("Instance of " + clazz + " could not be created because class or " - + "zero-argument constructor is not accessible"); - } - catch (NoSuchMethodError e) - { - throw new ClassNotFoundException - ("Instance of " + clazz - + " could not be created because zero-argument constructor is not defined"); - } + Externalizable obj = osc.newInstance(); int handle = assignNewHandle(obj); -- cgit v1.1