summaryrefslogtreecommitdiffstats
path: root/libjava/java/io/WriteAbortedException.java
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2002-06-15 18:59:15 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2002-06-15 18:59:15 +0000
commitfcffb5ea0b1c2f8aef9c2237f0fc5a809ffc2003 (patch)
tree1552fa58fe7792b5a7327cb8881602dd3ea5a4aa /libjava/java/io/WriteAbortedException.java
parent2f3b04d9c4bbc3b2eeaf13fce0cee94afeb1deb4 (diff)
downloadppe42-gcc-fcffb5ea0b1c2f8aef9c2237f0fc5a809ffc2003.tar.gz
ppe42-gcc-fcffb5ea0b1c2f8aef9c2237f0fc5a809ffc2003.zip
* java/io/BufferedOutputStream.java: Re-merged with Classpath.
* java/io/CharConversionException.java: Likewise. * java/io/EOFException.java: Likewise. * java/io/FileNotFoundException.java: Likewise. * java/io/IOException.java: Likewise. * java/io/InterruptedIOException.java: Likewise. * java/io/InvalidClassException.java: Likewise. * java/io/InvalidObjectException.java: Likewise. * java/io/NotActiveException.java: Likewise. * java/io/NotSerializableException.java: Likewise. * java/io/ObjectStreamException.java: Likewise. * java/io/ObjectStreamConstants.java: Likewise. * java/io/OptionalDataException.java: Likewise. * java/io/PipedInputStream.java: Likewise. * java/io/PushbackInputStream.java: Likewise. * java/io/StreamCorruptedException.java: Likewise. * java/io/SyncFailedException.java: Likewise. * java/io/UTFDataFormatException.java: Likewise. * java/io/UnsupportedEncodingException.java: Likewise. * java/io/WriteAbortedException.java: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@54655 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/io/WriteAbortedException.java')
-rw-r--r--libjava/java/io/WriteAbortedException.java121
1 files changed, 65 insertions, 56 deletions
diff --git a/libjava/java/io/WriteAbortedException.java b/libjava/java/io/WriteAbortedException.java
index ce824a94c98..0204862ef14 100644
--- a/libjava/java/io/WriteAbortedException.java
+++ b/libjava/java/io/WriteAbortedException.java
@@ -1,6 +1,5 @@
-/* WriteAbortedException.java -- An exception occurred while writing a
- serialization stream
- Copyright (C) 1998, 2000 Free Software Foundation, Inc.
+/* WriteAbortedException.java -- wraps an exception thrown while writing
+ Copyright (C) 1998, 2000, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -8,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -40,61 +39,71 @@ exception statement from your version. */
package java.io;
/**
- * This exception is thrown when one of the other ObjectStreamException
- * subclasses was thrown during a serialization write.
- *
- * @version 0.0
+ * This exception is thrown when another ObjectStreamException occurs during
+ * a serialization read or write. The stream is reset, and deserialized
+ * objects are discarded.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Eric Blake <ebb9@email.byu.edu>
+ * @since 1.1
+ * @status updated to 1.4
*/
public class WriteAbortedException extends ObjectStreamException
{
-
-/*
- * Instance Variables
- */
-
-/**
- * The detailed exception that caused this exception to be thrown
- */
-public Exception detail;
-private transient String message;
-
-/*************************************************************************/
-
-/*
- * Constructors
- */
-
-/**
- * Create a new WriteAbortedException with an eof parameter indicating
- * the detailed Exception that caused this exception to be thrown.
- *
- * @param detail The exception that caused this exception to be thrown
- */
-public
-WriteAbortedException(String msg, Exception detail)
-{
- this.message = msg;
- this.detail = detail;
-}
-
-/*************************************************************************/
-
-/*
- * Instance Variables
- */
-
-/**
- * This method returns a message indicating what went wrong, including
- * the message text from the initial exception that caused this one to
- * be thrown
- */
-public String
-getMessage()
-{
- return(message + ": " + detail.getMessage());
-}
-
+ /**
+ * Compatible with JDK 1.1+.
+ */
+ private static final long serialVersionUID = -3326426625597282442L;
+
+ /**
+ * The cause of this exception. This pre-dates the exception chaining
+ * of Throwable; and although you can change this field, you are wiser
+ * to leave it alone.
+ *
+ * @serial the exception cause
+ */
+ public Exception detail;
+
+ /**
+ * Create a new WriteAbortedException with a specified message and
+ * cause.
+ *
+ * @param msg the message
+ * @param detail the cause
+ */
+ public WriteAbortedException(String msg, Exception detail)
+ {
+ super(msg);
+ initCause(detail);
+ this.detail = detail;
+ }
+
+ /**
+ * This method returns a message indicating what went wrong, in this
+ * format:
+ * <code>super.getMessage() + (detail == null ? "" : "; " + detail)<code>.
+ *
+ * @return the chained message
+ */
+ public String getMessage()
+ {
+ if (detail == this || detail == null)
+ return super.getMessage();
+ return super.getMessage() + "; " + detail;
+ }
+
+ /**
+ * Returns the cause of this exception. Note that this may not be the
+ * original cause, thanks to the <code>detail</code> field being public
+ * and non-final (yuck). However, to avoid violating the contract of
+ * Throwable.getCause(), this returns null if <code>detail == this</code>,
+ * as no exception can be its own cause.
+ *
+ * @return the cause
+ * @since 1.4
+ */
+ public Throwable getCause()
+ {
+ return detail == this ? null : detail;
+ }
} // class WriteAbortedException
-
OpenPOWER on IntegriCloud