From 4f9533c7722fa07511a94d005227961f4a4dec23 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Thu, 18 May 2006 17:29:21 +0000 Subject: Imported GNU Classpath 0.90 Imported GNU Classpath 0.90 * scripts/makemake.tcl: LocaleData.java moved to gnu/java/locale. * sources.am: Regenerated. * gcj/javaprims.h: Regenerated. * Makefile.in: Regenerated. * gcj/Makefile.in: Regenerated. * include/Makefile.in: Regenerated. * testsuite/Makefile.in: Regenerated. * gnu/java/lang/VMInstrumentationImpl.java: New override. * gnu/java/net/local/LocalSocketImpl.java: Likewise. * gnu/classpath/jdwp/VMMethod.java: Likewise. * gnu/classpath/jdwp/VMVirtualMachine.java: Update to latest interface. * java/lang/Thread.java: Add UncaughtExceptionHandler. * java/lang/reflect/Method.java: Implements GenericDeclaration and isSynthetic(), * java/lang/reflect/Field.java: Likewise. * java/lang/reflect/Constructor.java * java/lang/Class.java: Implements Type, GenericDeclaration, getSimpleName() and getEnclosing*() methods. * java/lang/Class.h: Add new public methods. * java/lang/Math.java: Add signum(), ulp() and log10(). * java/lang/natMath.cc (log10): New function. * java/security/VMSecureRandom.java: New override. * java/util/logging/Logger.java: Updated to latest classpath version. * java/util/logging/LogManager.java: New override. From-SVN: r113887 --- libjava/classpath/java/io/ObjectOutputStream.java | 60 +++++++++-------------- 1 file changed, 22 insertions(+), 38 deletions(-) (limited to 'libjava/classpath/java/io/ObjectOutputStream.java') diff --git a/libjava/classpath/java/io/ObjectOutputStream.java b/libjava/classpath/java/io/ObjectOutputStream.java index 55a12e4eae8..61f07bc7cfb 100644 --- a/libjava/classpath/java/io/ObjectOutputStream.java +++ b/libjava/classpath/java/io/ObjectOutputStream.java @@ -549,53 +549,37 @@ public class ObjectOutputStream extends OutputStream * different protocols, specified by PROTOCOL_VERSION_1 * and PROTOCOL_VERSION_2. This implementation writes * data using PROTOCOL_VERSION_2 by default, as is done - * by the JDK 1.2. - * - * A non-portable method, setDefaultProtocolVersion (int - * version) is provided to change the default protocol - * version. - * + * since the JDK 1.2. + *

* For an explanation of the differences between the two protocols - * see XXX: the Java ObjectSerialization Specification. - * - * @exception IOException if version is not a valid - * protocol - * - * @see #setDefaultProtocolVersion(int) + * see the Java Object Serialization Specification. + *

+ * + * @param version the version to use. + * + * @throws IllegalArgumentException if version is not a valid + * protocol. + * @throws IllegalStateException if called after the first the first object + * was serialized. + * @throws IOException if an I/O error occurs. + * + * @see ObjectStreamConstants#PROTOCOL_VERSION_1 + * @see ObjectStreamConstants#PROTOCOL_VERSION_2 + * + * @since 1.2 */ public void useProtocolVersion(int version) throws IOException { if (version != PROTOCOL_VERSION_1 && version != PROTOCOL_VERSION_2) - throw new IOException("Invalid protocol version requested."); + throw new IllegalArgumentException("Invalid protocol version requested."); + + if (nextOID != baseWireHandle) + throw new IllegalStateException("Protocol version cannot be changed " + + "after serialization started."); protocolVersion = version; } - - /** - * GNU $classpath specific - * - * Changes the default stream protocol used by all - * ObjectOutputStreams. There are currently two - * different protocols, specified by PROTOCOL_VERSION_1 - * and PROTOCOL_VERSION_2. The default default is - * PROTOCOL_VERSION_1. - * - * @exception IOException if version is not a valid - * protocol - * - * @see #useProtocolVersion(int) - */ - public static void setDefaultProtocolVersion(int version) - throws IOException - { - if (version != PROTOCOL_VERSION_1 && version != PROTOCOL_VERSION_2) - throw new IOException("Invalid protocol version requested."); - - defaultProtocolVersion = version; - } - - /** * An empty hook that allows subclasses to write extra information * about classes to the stream. This method is called the first -- cgit v1.2.1