summaryrefslogtreecommitdiff
path: root/libjava/classpath/java/io/ObjectOutputStream.java
diff options
context:
space:
mode:
authormark <mark@138bc75d-0d04-0410-961f-82ee72b054a4>2006-05-18 17:29:21 +0000
committermark <mark@138bc75d-0d04-0410-961f-82ee72b054a4>2006-05-18 17:29:21 +0000
commit64089cc9f030d8ef7972adb5d117e0b23f47d62b (patch)
tree9f9c470de62ee62fba1331a396450d728d2b1fad /libjava/classpath/java/io/ObjectOutputStream.java
parent96034e28360d660d7a7708807fcbc4b519574d8e (diff)
downloadgcc-64089cc9f030d8ef7972adb5d117e0b23f47d62b.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@113887 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/classpath/java/io/ObjectOutputStream.java')
-rw-r--r--libjava/classpath/java/io/ObjectOutputStream.java60
1 files changed, 22 insertions, 38 deletions
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 <code>PROTOCOL_VERSION_1</code>
* and <code>PROTOCOL_VERSION_2</code>. This implementation writes
* data using <code>PROTOCOL_VERSION_2</code> by default, as is done
- * by the JDK 1.2.
- *
- * A non-portable method, <code>setDefaultProtocolVersion (int
- * version)</code> is provided to change the default protocol
- * version.
- *
+ * since the JDK 1.2.
+ * <p>
* For an explanation of the differences between the two protocols
- * see XXX: the Java ObjectSerialization Specification.
- *
- * @exception IOException if <code>version</code> is not a valid
- * protocol
- *
- * @see #setDefaultProtocolVersion(int)
+ * see the Java Object Serialization Specification.
+ * </p>
+ *
+ * @param version the version to use.
+ *
+ * @throws IllegalArgumentException if <code>version</code> 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;
}
-
- /**
- * <em>GNU $classpath specific</em>
- *
- * Changes the default stream protocol used by all
- * <code>ObjectOutputStream</code>s. There are currently two
- * different protocols, specified by <code>PROTOCOL_VERSION_1</code>
- * and <code>PROTOCOL_VERSION_2</code>. The default default is
- * <code>PROTOCOL_VERSION_1</code>.
- *
- * @exception IOException if <code>version</code> 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