BufferedOutputStream.java: Re-merged with Classpath.
authorTom Tromey <tromey@redhat.com>
Sat, 15 Jun 2002 18:59:15 +0000 (18:59 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Sat, 15 Jun 2002 18:59:15 +0000 (18:59 +0000)
* 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.

From-SVN: r54655

21 files changed:
libjava/ChangeLog
libjava/java/io/BufferedOutputStream.java
libjava/java/io/CharConversionException.java
libjava/java/io/EOFException.java
libjava/java/io/FileNotFoundException.java
libjava/java/io/IOException.java
libjava/java/io/InterruptedIOException.java
libjava/java/io/InvalidClassException.java
libjava/java/io/InvalidObjectException.java
libjava/java/io/NotActiveException.java
libjava/java/io/NotSerializableException.java
libjava/java/io/ObjectStreamConstants.java
libjava/java/io/ObjectStreamException.java
libjava/java/io/OptionalDataException.java
libjava/java/io/PipedInputStream.java
libjava/java/io/PushbackInputStream.java
libjava/java/io/StreamCorruptedException.java
libjava/java/io/SyncFailedException.java
libjava/java/io/UTFDataFormatException.java
libjava/java/io/UnsupportedEncodingException.java
libjava/java/io/WriteAbortedException.java

index f3268e65f4b72852682c9b0680cdbbd26c6cb7a7..a6b89c1f63f74ee0bc4d7607f29e4d7b2219dbb2 100644 (file)
@@ -1,3 +1,26 @@
+2002-06-15  Tom Tromey  <tromey@redhat.com>
+
+       * 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.
+
 2002-06-15  Nathanael Nerode  <neroden@twcny.rr.com>
 
        * java/text/ChoiceFormat.java: Update comments from Classpath.
index 11ba1eb6cfb418c2d008540ede626c297f9d4539..2cbdd4a16879a63ba2c5d1b6dd83ba0b13c1eb1e 100644 (file)
@@ -140,6 +140,7 @@ flush() throws IOException
 
   out.write(buf, 0, count);
   count = 0;
+  out.flush();
 }
 
 /*************************************************************************/
index 4aa0626ca4d9eb45bbfb14a6970cd2807085aaa4..0cb83d2d0205efa3cbe2fa25a0057ec7ad744b1c 100644 (file)
@@ -1,5 +1,5 @@
 /* CharConversionException.java -- Character conversion exceptions
-   Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -7,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
@@ -38,49 +38,36 @@ exception statement from your version. */
 
 package java.io;
 
-/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
- * "The Java Language Specification", ISBN 0-201-63451-1
- * Status:  Complete to 1.1.
- */
-
 /**
-  * This exception is thrown to indicate that a problem occurred with
-  * an attempted character conversion.
-  *
-  * @version 0.0
-  *
-  * @author Aaron M. Renn (arenn@urbanophile.com)
-  * @author Tom Tromey <tromey@cygnus.com>
-  * @date September 25, 1998
-  */
-public class CharConversionException extends IOException
-{
-
-/*
- * Constructors
+ * This exception is thrown to indicate that a problem occurred with
+ * an attempted character conversion.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Tom Tromey <tromey@cygnus.com>
+ * @since 1.1
+ * @status updated to 1.4
  */
-
-/**
-  * Create a new CharConversionException without a descriptive error message
-  */
-public
-CharConversionException()
+public class CharConversionException extends IOException
 {
-  super();
-}
-
-/*************************************************************************/
+  /**
+   * Compatible with JDK 1.1+.
+   */
+  private static final long serialVersionUID = -8680016352018427031L;
 
-/**
-  * Create a new CharConversionException with a descriptive error message String
-  *
-  * @param message The descriptive error message
-  */
-public
-CharConversionException(String message)
-{
-  super(message);
-}
+  /**
+   * Create an exception without a descriptive error message.
+   */
+  public CharConversionException()
+  {
+  }
 
+  /**
+   * Create an exception with a descriptive error message.
+   *
+   * @param message the descriptive error message
+   */
+  public CharConversionException(String message)
+  {
+    super(message);
+  }
 } // class CharConversionException
-
index 444df7f0c1ff17d990160ad4f0e4c978fbb37389..d129cd692499dbe217aeed6bf588461f5195978e 100644 (file)
@@ -1,5 +1,5 @@
-/* EOFException.java -- Unexpected end of file exception
-   Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
+/* EOFException.java -- unexpected end of file exception
+   Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -7,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
@@ -38,53 +38,39 @@ exception statement from your version. */
 
 package java.io;
 
-/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
- * "The Java Language Specification", ISBN 0-201-63451-1
- * Status:  Complete to 1.1.
- */
-
 /**
-  * This exception is thrown when the end of the file or stream was 
-  * encountered unexpectedly.  This is not the normal way that a normal
-  * EOF condition is reported.  Normally a special value such as -1 is
-  * returned.  However, certain types of streams expecting certain data
-  * in a certain format might reach EOF before reading their expected
-  * data pattern and thus throw this exception.
-  *
-  * @version 0.0
-  *
-  * @author Aaron M. Renn (arenn@urbanophile.com)
-  * @author Tom Tromey <tromey@cygnus.com>
-  * @date September 24, 1998
-  */
-public class EOFException extends IOException
-{
-
-/*
- * Constructors
+ * This exception is thrown when the end of the file or stream was 
+ * encountered unexpectedly.  This is not the normal way that an EOF
+ * condition is reported; such as a special value like -1 being returned.
+ *  However, certain types of streams expecting certain data in a certain
+ * format might reach EOF before reading their expected data pattern and
+ * thus throw this exception.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Tom Tromey <tromey@cygnus.com>
+ * @status updated to 1.4
  */
-
-/**
-  * Create a new EOFException without a descriptive error message
-  */
-public
-EOFException()
+public class EOFException extends IOException
 {
-  super();
-}
-
-/*************************************************************************/
+  /**
+   * Compatible with JDK 1.0+.
+   */
+  private static final long serialVersionUID = 6433858223774886977L;
 
-/**
-  * Create a new EOFException with a descriptive error message String
-  *
-  * @param message The descriptive error message
-  */
-public
-EOFException(String message)
-{
-  super(message);
-}
+  /**
+   * Create an exception without a descriptive error message.
+   */
+  public EOFException()
+  {
+  }
 
+  /**
+   * Create an exception with a descriptive error message.
+   *
+   * @param message the descriptive error message
+   */
+  public EOFException(String message)
+  {
+    super(message);
+  }
 } // class EOFException
-
index 9d04d6a2611f85c1d8dd9a886a9f5e8abe5fc30f..7877aba150da8858e47734af6027b89b65d65127 100644 (file)
@@ -1,5 +1,5 @@
-/* FileNotFoundException.java -- The requested file could not be found
-   Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
+/* FileNotFoundException.java -- the requested file could not be found
+   Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -7,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
@@ -38,49 +38,36 @@ exception statement from your version. */
 
 package java.io;
 
-/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
- * "The Java Language Specification", ISBN 0-201-63451-1
- * Status:  Complete to 1.1.
- */
-
 /**
-  * This exception is thrown when an attempt is made to access a file that
-  * does not exist.
-  *
-  * @version 0.0
-  *
-  * @author Aaron M. Renn (arenn@urbanophile.com)
-  * @author Tom Tromey <tromey@cygnus.com>
-  * @date September 24, 1998
-  */
-public class FileNotFoundException extends IOException
-{
-
-/*
- * Constructors
+ * This exception is thrown when an attempt is made to access a file that
+ * does not exist, or is inaccessible for some other reason (such as writing
+ * a read-only file).
+ *
+ * @author Aaron M. Renn <arenn@urbanophile.com>
+ * @author Tom Tromey <tromey@cygnus.com>
+ * @status updated to 1.4
  */
-
-/**
-  * Create a new FileNotFoundException without a descriptive error message
-  */
-public
-FileNotFoundException()
+public class FileNotFoundException extends IOException
 {
-  super();
-}
-
-/*************************************************************************/
+  /**
+   * Compatible with JDK 1.0+.
+   */
+  private static final long serialVersionUID = -897856973823710492L;
 
-/**
-  * Create a new FileNotFoundException with a descriptive error message String
-  *
-  * @param message The descriptive error message
-  */
-public
-FileNotFoundException(String message)
-{
-  super(message);
-}
+  /**
+   * Create an exception without a descriptive error message.
+   */
+  public FileNotFoundException()
+  {
+  }
 
+  /**
+   * Create an exception with a descriptive error message.
+   *
+   * @param message the descriptive error message
+   */
+  public FileNotFoundException(String message)
+  {
+    super(message);
+  }
 } // class FileNotFoundException
-
index 1c7f254952337b143d7c91c286d6bfde5c161613..8baf593c9c2d9afcdd16424824e4d41b9a33c21a 100644 (file)
@@ -1,5 +1,5 @@
 /* IOException.java -- Generic input/output exception
-   Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -7,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
@@ -38,51 +38,37 @@ exception statement from your version. */
 
 package java.io;
 
-/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
- * "The Java Language Specification", ISBN 0-201-63451-1
- * Status:  Complete to 1.1.
- */
-
 /**
   * This exception is thrown to indicate an I/O problem of some sort
   * occurred.  Since this is a fairly generic exception, often a subclass
   * of IOException will actually be thrown in order to provide a more
   * detailed indication of what happened.
   *
-  * @version 0.0
-  *
   * @author Aaron M. Renn (arenn@urbanophile.com)
   * @author Tom Tromey <tromey@cygnus.com>
-  * @date September 24, 1998
+  * @status updated to 1.4
   */
 public class IOException extends Exception
 {
+  /**
+   * Compatible with JDK 1.0+.
+   */
+  private static final long serialVersionUID = 7818375828146090155L;
 
-/*
- * Constructors
- */
-
-/**
-  * Create a new IOException without a descriptive error message
-  */
-public
-IOException()
-{
-  super();
-}
-
-/*************************************************************************/
-
-/**
-  * Create a new IOException with a descriptive error message String
-  *
-  * @param message The descriptive error message
-  */
-public
-IOException(String message)
-{
-  super(message);
-}
+  /**
+   * Create an exception without a descriptive error message.
+   */
+  public IOException()
+  {
+  }
 
+  /**
+   * Create an exception with a descriptive error message.
+   *
+   * @param message the descriptive error message
+   */
+  public IOException(String message)
+  {
+    super(message);
+  }
 } // class IOException
-
index 52ed65332a64a69b66df7753fc178d2059d45e7a..321c2697b437ec93e7ea2d6b9fc511e75d7a57bb 100644 (file)
@@ -1,5 +1,5 @@
-/* InterruptedIOException.java -- An I/O operation was interrupted.
-   Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
+/* InterruptedIOException.java -- an I/O operation was interrupted
+   Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -7,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
@@ -38,78 +38,57 @@ exception statement from your version. */
 
 package java.io;
 
-/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
- * "The Java Language Specification", ISBN 0-201-63451-1
- * Status:  Complete to 1.1.
- */
-
 /**
-  * This exception is thrown when a in process I/O operation is 
-  * interrupted for some reason.  The field bytesTransferred will contain
-  * the number of bytes that were read/written prior to the interruption.
+  * This exception is thrown when a in process I/O operation is interrupted
+  * for some reason.  The field bytesTransferred will contain the number of
+  * bytes that were read/written prior to the interruption.
   *
-  * @version 0.0
-  *
-  * @author Aaron M. Renn (arenn@urbanophile.com)
+  * @author Aaron M. Renn <arenn@urbanophile.com>
   * @author Tom Tromey <tromey@cygnus.com>
-  * @date September 24, 1998
+  * @see Thread#interrupt()
+  * @status updated to 1.4
   */
 public class InterruptedIOException extends IOException
 {
-
-private static final long serialVersionUID = 4020568460727500567L;
-
-/*
- * Instance Variables
- */
-
-/**
-  * The number of bytes read/written prior to the interruption
-  */
-public int bytesTransferred;
-
-/*************************************************************************/
-
-/*
- * Constructors
- */
-
-/**
-  * Create a new InterruptedIOException without a descriptive error message
-  */
-public
-InterruptedIOException()
-{
-  super();
-}
-
-/*************************************************************************/
-
-/**
-  * Create a new InterruptedIOException with a descriptive error message String
-  *
-  * @param message The descriptive error message
-  */
-public
-InterruptedIOException(String message)
-{
-  super(message);
-}
-
-/*************************************************************************/
-
-/**
-  * Create a new InterruptedIOException with a descriptive error message 
-  * String.  Also sets the value of the bytesTransferred field.
-  * 
-  * @param message The descriptive error message
-  * @param bytesTransferred The number of bytes tranferred before the interruption
-  */
-InterruptedIOException(String message, int bytesTransferred)
-{
-  super(message);
-  this.bytesTransferred = bytesTransferred;
-}
-
+  /**
+   * Compatible with JDK 1.0+.
+   */
+  private static final long serialVersionUID = 4020568460727500567L;
+
+  /**
+   * The number of bytes read/written prior to the interruption.
+   *
+   * @serial count of bytes successfully transferred
+   */
+  public int bytesTransferred;
+
+  /**
+   * Create an extends without a descriptive error message.
+   */
+  public InterruptedIOException()
+  {
+  }
+
+  /**
+   * Create an exception with a descriptive error message.
+   *
+   * @param message the descriptive error message
+   */
+  public InterruptedIOException(String message)
+  {
+    super(message);
+  }
+
+  /**
+   * Create an exception with a descriptive error message and count of
+   * bytes transferred.
+   *
+   * @param message the descriptive error message
+   * @param bytesTransferred number of bytes tranferred before interruption
+   */
+  InterruptedIOException(String message, int bytesTransferred)
+  {
+    super(message);
+    this.bytesTransferred = bytesTransferred;
+  }
 } // class InterruptedIOException
-
index 57ae399a9569ebb4e301881ea84db0d627311cd3..a98a22b91619df4414db4db2c357100ac07ce28d 100644 (file)
@@ -1,5 +1,5 @@
-/* InvalidClassException.java -- An I/O operation was interrupted.
-   Copyright (C) 1998 Free Software Foundation, Inc.
+/* InvalidClassException.java -- deserializing a class failed
+   Copyright (C) 1998, 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -7,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
@@ -39,44 +39,54 @@ exception statement from your version. */
 package java.io;
 
 /**
-  * This exception is thrown when there is some sort of problem with a
-  * class during a serialization operation.  This could be that the
-  * versions don't match, that there are unknown datatypes in the class
-  * or that the class doesn't have a default no-arg constructor.
-  * <p>
-  * The field <code>classname</code> will contain the name of the
-  * class that caused the problem if known.  The getMessage() method
-  * for this exception will always include the name of that class
-  * if known.
-  *
-  * @version 0.0
-  *
-  * @author Aaron M. Renn (arenn@urbanophile.com)
-  */
+ * This exception is thrown when there is some sort of problem with a
+ * class during a serialization operation.  This could be:<br><ul>
+ * <li>the serial version of the class doesn't match</li>
+ * <li>the class contains unknown datatypes</li>
+ * <li>the class does not have an accessible no-arg constructor</li>
+ * </ul>.
+ *
+ * <p>The field <code>classname</code> will contain the name of the
+ * class that caused the problem if known.  The getMessage() method
+ * for this exception will always include the name of that class
+ * if known.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @since 1.1
+ * @status updated to 1.4
+ */
 public class InvalidClassException extends ObjectStreamException
 {
   /**
-    * The name of the class which encountered the error.
-    */
+   * Compatible with JDK 1.1+.
+   */
+  private static final long serialVersionUID = -4333316296251054416L;
+
+  /**
+   * The name of the class which encountered the error.
+   *
+   * @serial the classname causing the error
+   */
   public String classname;
 
   /**
-    * Create a new InvalidClassException with a descriptive error message String
-    *
-    * @param message The descriptive error message
-    */
+   * Create an exception with a descriptive error message, but a null
+   * classname.
+   *
+   * @param message the descriptive error message
+   */
   public InvalidClassException(String message)
   {
     super(message);
   }
 
   /**
-    * Create a new InvalidClassException with a descriptive error message 
-    * String, and the name of the class that caused the problem.
-    * 
-    * @param classname The number of bytes tranferred before the interruption
-    * @param message The descriptive error message
-    */
+   * Create an exception with a descriptive error message, and the name of
+   * the class that caused the problem.
+   *
+   * @param classname the name of the faulty class
+   * @param message the descriptive error message
+   */
   public InvalidClassException(String classname, String message)
   {
     super(message);
@@ -84,15 +94,18 @@ public class InvalidClassException extends ObjectStreamException
   }
 
   /**
-    * Returns the descriptive error message for this exception.  It will
-    * include the class name that caused the problem if known.  This method
-    * overrides Throwable.getMessage()
-    *
-    * @return A descriptive error message
-    */
+   * Returns the descriptive error message for this exception. It will
+   * include the class name that caused the problem if known, in the format:
+   * <code>[classname][; ][super.getMessage()]</code>.
+   *
+   * @return A descriptive error message, may be null
+   */
   public String getMessage()
   {
-    return super.getMessage() + (classname == null ? "" : ": " + classname);
+    String msg = super.getMessage();
+    if (msg == null)
+      return classname;
+    return (classname == null ? "" : classname + "; ") + msg;
   }
 }
 
index 4a848780d33efa2a6d3605f541fb4ed301ac879b..c7846a53952f9f8f5d1ca9a40ac726808d202000 100644 (file)
@@ -1,5 +1,5 @@
-/* InvalidObjectException.java -- An I/O operation was interrupted.
-   Copyright (C) 1998 Free Software Foundation, Inc.
+/* InvalidObjectException.java -- deserialization failed verification
+   Copyright (C) 1998, 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -7,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
@@ -39,30 +39,28 @@ exception statement from your version. */
 package java.io;
 
 /**
-  * This exception is thrown when an object fails a validation test
-  * during serialization.
-  *
-  * @version 0.0
-  *
-  * @author Aaron M. Renn (arenn@urbanophile.com)
-  */
-public class InvalidObjectException extends ObjectStreamException
-{
-
-/*
- * Constructors
+ * This exception is thrown when an object fails a validation test
+ * during serialization.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @since 1.1
+ * @status updated to 1.4
  */
-
-/**
-  * Create a new InvalidObjectException with a descriptive error message String
-  *
-  * @param message The descriptive error message
-  */
-public
-InvalidObjectException(String message)
+public class InvalidObjectException extends ObjectStreamException
 {
-  super(message);
-}
+  /**
+   * Compatible with JDK 1.1+.
+   */
+  private static final long serialVersionUID = 3233174318281839583L;
 
+  /**
+   * Create an exception with a descriptive error message String. This should
+   * be the cause of the verification failure.
+   *
+   * @param message the descriptive error message
+   */
+  public InvalidObjectException(String message)
+  {
+    super(message);
+  }
 } // class InvalidObjectException
-
index 3f205f1649f59a8e895a6c3f3b81bc94b61e5381..22c7e63d88855a8cfaac1a09d9746cd8586594d0 100644 (file)
@@ -1,5 +1,5 @@
-/* NotActiveException.java -- Unexpected end of file exception
-   Copyright (C) 1998 Free Software Foundation, Inc.
+/* NotActiveException.java -- thrown when serialization is not active
+   Copyright (C) 1998, 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -7,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
@@ -39,41 +39,34 @@ exception statement from your version. */
 package java.io;
 
 /**
-  * This exception is thrown when a problem occurs due to the fact that
-  * serialization is not active.
-  *
-  * @version 0.0
-  *
-  * @author Aaron M. Renn (arenn@urbanophile.com)
-  */
-public class NotActiveException extends ObjectStreamException
-{
-
-/*
- * Constructors
+ * This exception is thrown when a problem occurs due to the fact that
+ * serialization is not active.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @since 1.1
+ * @status updated to 1.4
  */
-
-/**
-  * Create a new NotActiveException without a descriptive error message
-  */
-public
-NotActiveException()
+public class NotActiveException extends ObjectStreamException
 {
-  super();
-}
+  /**
+   * Compatible with JDK 1.1+.
+   */
+  private static final long serialVersionUID = -3893467273049808895L;
 
-/*************************************************************************/
-
-/**
-  * Create a new NotActiveException with a descriptive error message String
-  *
-  * @param message The descriptive error message
-  */
-public
-NotActiveException(String message)
-{
-  super(message);
-}
+  /**
+   * Create an exception without a descriptive error message.
+   */
+  public NotActiveException()
+  {
+  }
 
+  /**
+   * Create an exception with a descriptive error message.
+   *
+   * @param message the descriptive error message
+   */
+  public NotActiveException(String message)
+  {
+    super(message);
+  }
 } // class NotActiveException
-
index 55da2606cb4b3aec44578ab413a4478895fa2c11..fbafd3dd555d2e6821806961da941422ddf6f4a0 100644 (file)
@@ -1,5 +1,5 @@
-/* NotSerializableException.java -- Unexpected end of file exception
-   Copyright (C) 1998 Free Software Foundation, Inc.
+/* NotSerializableException.java -- a Serializable class that isn't
+   Copyright (C) 1998, 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -7,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
@@ -39,42 +39,36 @@ exception statement from your version. */
 package java.io;
 
 /**
-  * This exception is thrown when a class may not be serialized.  The
-  * descriptive message will consist of the name of the class in question.
-  *
-  * @version 0.0
-  *
-  * @author Aaron M. Renn (arenn@urbanophile.com)
-  */
-public class NotSerializableException extends ObjectStreamException
-{
-
-/*
- * Constructors
+ * This exception is thrown when a class implements Serializable because
+ * of a superclass, but should not be serialized.  The descriptive message
+ * will consist of the name of the class in question.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @since 1.1
+ * @status updated to 1.4
  */
-
-/**
-  * Create a new NotSerializableException without a descriptive error message
-  */
-public
-NotSerializableException()
+public class NotSerializableException extends ObjectStreamException
 {
-  super();
-}
+  /**
+   * Compatible with JDK 1.1+.
+   */
+  private static final long serialVersionUID = 2906642554793891381L;
 
-/*************************************************************************/
-
-/**
-  * Create a new NotSerializableException with a descriptive error message String
-  * This should be the name of the class that cannot be serialized.
-  *
-  * @param message The descriptive error message
-  */
-public
-NotSerializableException(String message)
-{
-  super(message);
-}
+  /**
+   * Create an exception without a descriptive error message.
+   */
+  public NotSerializableException()
+  {
+  }
 
+  /**
+   * Create an exception with a descriptive error message, which should
+   * be the name of the class.
+   *
+   * @param message the descriptive error message
+   */
+  public NotSerializableException(String message)
+  {
+    super(message);
+  }
 } // class NotSerializableException
-
index cad3f29c719a24cd2e650e295b14b1765ab5e28c..111a0f3fa26673cfdf9a47e3b60e35e749acd5da 100644 (file)
@@ -54,18 +54,20 @@ public interface ObjectStreamConstants
   final static short STREAM_MAGIC = (short)0xaced;
   final static short STREAM_VERSION = 5;
 
-  final static byte TC_NULL = (byte)112;
-  final static byte TC_REFERENCE = (byte)113;
-  final static byte TC_CLASSDESC = (byte)114;
-  final static byte TC_OBJECT = (byte)115;
-  final static byte TC_STRING = (byte)116;
-  final static byte TC_ARRAY = (byte)117;
-  final static byte TC_CLASS = (byte)118;
-  final static byte TC_BLOCKDATA = (byte)119;
-  final static byte TC_ENDBLOCKDATA = (byte)120;
-  final static byte TC_RESET = (byte)121;
-  final static byte TC_BLOCKDATALONG = (byte)122;
-  final static byte TC_EXCEPTION = (byte)123;
+  final static byte TC_NULL = (byte)112;            //0x70
+  final static byte TC_REFERENCE = (byte)113;       //0x71
+  final static byte TC_CLASSDESC = (byte)114;       //0x72
+  final static byte TC_OBJECT = (byte)115;          //0x73
+  final static byte TC_STRING = (byte)116;          //0x74
+  final static byte TC_ARRAY = (byte)117;           //0x75
+  final static byte TC_CLASS = (byte)118;           //0x76
+  final static byte TC_BLOCKDATA = (byte)119;       //0x77
+  final static byte TC_ENDBLOCKDATA = (byte)120;    //0x78
+  final static byte TC_RESET = (byte)121;           //0x79
+  final static byte TC_BLOCKDATALONG = (byte)122;   //0x7A
+  final static byte TC_EXCEPTION = (byte)123;       //0x7B
+  final static byte TC_LONGSTRING = (byte)124;      //0x7C
+  final static byte TC_PROXYCLASSDESC = (byte)125;  //0x7D
 
   final static byte TC_BASE = TC_NULL;
   final static byte TC_MAX = TC_EXCEPTION;
index 91b76cfde6b84a35646a13b40b9ae0910dfc509e..ee4a34167d1cb62a0554068619fb573afe4a62f0 100644 (file)
@@ -1,5 +1,5 @@
-/* ObjectStreamException.java -- Superclass of all serialisation exceptions
-   Copyright (C) 1998, 2000, 2001 Free Software Foundation, Inc.
+/* ObjectStreamException.java -- Superclass of all serialization exceptions
+   Copyright (C) 1998, 2000, 2001, 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -7,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
@@ -38,49 +38,37 @@ exception statement from your version. */
 
 package java.io;
 
-/* Written using on-line Java Platform 1.2 API Specification.
- * Status:  Believed complete and correct.
- */
-
 /**
-  * This exception is thrown when a problem occurs during serialization.
-  * There are more specific subclasses than give more fine grained 
-  * indications of the precise failure.
-  *
-  * @version 0.0
-  *
-  * @author Aaron M. Renn (arenn@urbanophile.com)
-  * @author Warren Levy <warrenl@cygnus.com>
-  * @date February 7, 2000. 
-  */
-public abstract class ObjectStreamException extends IOException 
-{
-
-/*
- * Constructors
+ * This exception is thrown when a problem occurs during serialization.
+ * There are more specific subclasses than give more fine grained
+ * indications of the precise failure.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Warren Levy <warrenl@cygnus.com>
+ * @since 1.1
+ * @status updated to 1.4
  */
-
-/**
-  * Create a new ObjectStreamException without a descriptive error message
-  */
-protected
-ObjectStreamException()
+public abstract class ObjectStreamException extends IOException
 {
-  super();
-}
+  /**
+   * Compatible with JDK 1.1+.
+   */
+  private static final long serialVersionUID = 7260898174833392607L;
 
-/*************************************************************************/
-
-/**
-  * Create a new ObjectStreamException with a descriptive error message String
-  *
-  * @param message The descriptive error message
-  */
-protected
-ObjectStreamException(String message)
-{
-  super(message);
-}
+  /**
+   * Create an exception without a descriptive error message.
+   */
+  protected ObjectStreamException()
+  {
+  }
 
+  /**
+   * Create an exception with a descriptive error message.
+   *
+   * @param message the descriptive error message
+   */
+  protected ObjectStreamException(String message)
+  {
+    super(message);
+  }
 } // class ObjectStreamException
-
index b369d837feadf08197ac844e2ba7afe22fff1e6d..919c2bf0f4d392647c895f9d0fde23f29e9370a3 100644 (file)
@@ -1,5 +1,5 @@
-/* OptionalDataException.java -- indicates unexpected data in serialised stream
-   Copyright (C) 1998, 2000, 2001 Free Software Foundation, Inc.
+/* OptionalDataException.java -- indicates unexpected data in serialized stream
+   Copyright (C) 1998, 2000, 2001, 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -7,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
@@ -38,61 +38,54 @@ exception statement from your version. */
 
 package java.io;
 
-/* Written using on-line Java Platform 1.2 API Specification.
- * Status:  Believed complete and correct.
- */
-
 /**
-  * This exception is thrown when unexpected data appears in the input
-  * stream from which a serialized object is being read.  The field
-  * <code>eof</code> will always be set to true (***Why even have it?***) and 
-  * the <code>count</code> field will contain the number of valid bytes
-  * available to be read.
-  *
-  * @version 0.0
-  *
-  * @author Aaron M. Renn (arenn@urbanophile.com)
-  * @author Warren Levy <warrenl@cygnus.com>
-  * @date February 7, 2000. 
-  */
-public class OptionalDataException extends ObjectStreamException
-{
-
-private static final long serialVersionUID = -8011121865681257820L;
-
-/*
- * Instance Variables
+ * This exception is thrown when unexpected data appears in the input
+ * stream from which a serialized object is being read. There are two
+ * cases:<br><ul>
+ * <li>The next stream element is primitive data. <code>eof</code> will
+ *     be false, and <code>count</code> is the number of bytes of primitive
+ *     data available.</li>
+ * <li>The data consumable by readObject or readExternal has been exhausted.
+ *     <code>eof</code> is true, and <code>count</code> is 0.</li>
+ * </ul>
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Warren Levy <warrenl@cygnus.com>
+ * @since 1.1
+ * @status updated to 1.4
  */
-
-/**
-  * Whether or not the end of the stream has been reached
-  */
-public boolean eof;
-
-/**
-  * The number of valid bytes that can be read
-  */
-public int length;
-
-/*************************************************************************/
-
-/*
- * Constructors
- */
-
-/**
-  * Create a new OptionalDataException with an eof parameter indicating
-  * whether or not the end of stream is reached and the number of valid
-  * bytes that may be read.
-  *
-  * @param eof 'true' if end of stream reached, 'false' otherwise
-  * @param count The number of valid bytes to be read.
-  */
-OptionalDataException(boolean eof, int count)
+public class OptionalDataException extends ObjectStreamException
 {
-  this.eof = eof;
-  this.length = count;
-}
-
+  /**
+   * Compatible with JDK 1.1+.
+   */
+  private static final long serialVersionUID = -8011121865681257820L;
+
+  /**
+   * Whether or not the end of the stream has been reached.
+   *
+   * @serial the end of the buffer was reached
+   */
+  public boolean eof;
+
+  /**
+   * The number of valid bytes that can be read.
+   *
+   * @serial the bytes of the buffer remaining
+   */
+  public int length;
+
+  /**
+   * Create a new OptionalDataException with an eof parameter indicating
+   * whether or not the end of stream is reached and the number of valid
+   * bytes that may be read.
+   *
+   * @param eof 'true' if end of stream reached, 'false' otherwise
+   * @param count The number of valid bytes to be read
+   */
+  OptionalDataException(boolean eof, int count)
+  {
+    this.eof = eof;
+    this.length = count;
+  }
 } // class OptionalDataException
-
index 4f25d5fc7b2caa48f0787d41eca9084122237adb..4816ce6f79b5bdb3edcc0e9ad6d1f422c2d0c8ea 100644 (file)
@@ -67,10 +67,15 @@ public class PipedInputStream extends InputStream
   /** Set to true if close() has been called on this InputStream. */
   boolean closed;
 
+
   /**
-    * The size of the internal buffer used for input/output.
-    */
-  protected static final int PIPE_SIZE = 2048;
+   * The size of the internal buffer used for input/output.
+   */
+  /* The "Constant Field Values" Javadoc of the Sun J2SE 1.4
+   * specifies 1024.
+   */
+  protected static final int PIPE_SIZE = 1024;
+
 
   /**
     * This is the internal circular buffer used for storing bytes written
index ebf0e38616af30f1f0edf7ef2fa8bc10d66726d7..ffc582f9ecf22d65d95ea3235ee51dd694d7f40d 100644 (file)
@@ -201,6 +201,7 @@ public class PushbackInputStream extends FilterInputStream
   public synchronized int read(byte[] b, int off, int len) throws IOException
   {
     int numBytes = Math.min(buf.length - pos, len);
+
     if (numBytes > 0)
       {
        System.arraycopy (buf, pos, b, off, numBytes);
@@ -209,10 +210,10 @@ public class PushbackInputStream extends FilterInputStream
        off += numBytes;
       }
 
-    if (len > 0)
+    if (len > 0) 
       {
         len = super.read(b, off, len);
-       if (len == -1) // EOF
+        if (len == -1) //EOF
          return numBytes > 0 ? numBytes : -1;
        numBytes += len;
       }
@@ -318,7 +319,8 @@ public class PushbackInputStream extends FilterInputStream
        int numread = (int) Math.min((long) (buf.length - pos), n);
        pos += numread;
        n -= numread;
-       n -= super.skip(n);
+       if (n > 0)
+         n -= super.skip(n);
       }
 
     return origN - n;
index 3461c577b6056618db3c6bdf9e10cb7af11e15be..004047fb6542f2aabb7ea150485fa935511eb8a7 100644 (file)
@@ -1,5 +1,5 @@
 /* StreamCorruptedException.java -- Error in stream during serialization
-   Copyright (C) 1998, 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2000, 2001, 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -7,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
@@ -38,48 +38,36 @@ exception statement from your version. */
 
 package java.io;
 
-/* Written using on-line Java Platform 1.2 API Specification.
- * Status:  Believed complete and correct. 
- */
-  
 /**
-  * This exception is thrown when there is an error in the data that is
-  * read from a stream during de-serialization.
-  *
-  * @version 0.0
-  *
-  * @author Aaron M. Renn (arenn@urbanophile.com)
-  * @author Warren Levy <warrenl@cygnus.com>
-  * @date February 7, 2000.
-  */
-public class StreamCorruptedException extends ObjectStreamException
-{
-
-/*
- * Constructors
+ * This exception is thrown when there is an error in the data that is
+ * read from a stream during de-serialization.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Warren Levy <warrenl@cygnus.com>
+ * @since 1.1
+ * @status updated to 1.4
  */
-
-/**
-  * Create a new StreamCorruptedException without a descriptive error message
-  */
-public
-StreamCorruptedException()
+public class StreamCorruptedException extends ObjectStreamException
 {
-  super();
-}
-
-/*************************************************************************/
+  /**
+   * Compatible with JDK 1.1+.
+   */
+  private static final long serialVersionUID = 8983558202217591746L;
 
-/**
-  * Create a new StreamCorruptedException with a descriptive error message String
-  *
-  * @param message The descriptive error message
-  */
-public
-StreamCorruptedException(String message)
-{
-  super(message);
-}
+  /**
+   * Create an exception without a descriptive error message.
+   */
+  public StreamCorruptedException()
+  {
+  }
 
+  /**
+   * Create an exception with a descriptive error message.
+   *
+   * @param message the descriptive error message
+   */
+  public StreamCorruptedException(String message)
+  {
+    super(message);
+  }
 } // class StreamCorruptedException
-
index e06d86f94bbcc5fd678a6326de7bb30e82eff1fa..a896ffb5e43da3505d689e014cf9a6656c0c77e8 100644 (file)
@@ -1,5 +1,5 @@
-/* SyncFailedException.java -- The sync failed (?)
-   Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
+/* SyncFailedException.java -- a file sync failed
+   Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -7,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
@@ -38,49 +38,29 @@ exception statement from your version. */
 
 package java.io;
 
-/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
- * "The Java Language Specification", ISBN 0-201-63451-1
- * Status:  Complete to 1.1.
- */
-
 /**
-  * I really wish I knew what caused this exception to be thrown.
-  *
-  * @version 0.0
-  *
-  * @author Aaron M. Renn (arenn@urbanophile.com)
-  * @author Tom Tromey <tromey@cygnus.com>
-  * @date September 24, 1998
-  */
-public class SyncFailedException extends IOException
-{
-
-private static final long serialVersionUID = -2353342684412443330L;
-
-/*
- * Constructors
+ * Thrown when a file synchronization fails.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Tom Tromey <tromey@cygnus.com>
+ * @see FileDescriptor#sync()
+ * @since 1.1
+ * @status updated to 1.4
  */
-
-/**
-  * Create a new SyncFailedException without a descriptive error message
-  */
-SyncFailedException()
-{
-  super();
-}
-
-/*************************************************************************/
-
-/**
-  * Create a new SyncFailedException with a descriptive error message String
-  *
-  * @param message The descriptive error message
-  */
-public
-SyncFailedException(String message)
+public class SyncFailedException extends IOException
 {
-  super(message);
-}
-
+  /**
+   * Compatible with JDK 1.1+.
+   */
+  private static final long serialVersionUID = -2353342684412443330L;
+
+  /**
+   * Create an exception with a descriptive error message.
+   *
+   * @param message the descriptive error message
+   */
+  public SyncFailedException(String message)
+  {
+    super(message);
+  }
 } // class SyncFailedException
-
index 8fcf278d78d95ac17e35acb937a704a6f7cfb327..a38e25179f5794ed9471943c538b6ebdf48db6d7 100644 (file)
@@ -1,5 +1,5 @@
-/* UTFDataFormatException.java -- Bad format in UTF data
-   Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
+/* UTFDataFormatException.java -- thrown on bad format in UTF data
+   Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -7,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
@@ -38,49 +38,37 @@ exception statement from your version. */
 
 package java.io;
 
-/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
- * "The Java Language Specification", ISBN 0-201-63451-1
- * Status:  Complete to 1.1.
- */
-
 /**
-  * When reading a UTF string from an input stream, this exception is thrown
-  * to indicate that the data read is invalid.
-  *
-  * @version 0.0
-  *
-  * @author Aaron M. Renn (arenn@urbanophile.com)
-  * @author Tom Tromey <tromey@cygnus.com>
-  * @date September 24, 1998
-  */
-public class UTFDataFormatException extends IOException
-{
-
-/*
- * Constructors
+ * When reading a UTF string from an input stream, this exception is thrown
+ * to indicate that the data read is invalid.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Tom Tromey <tromey@cygnus.com>
+ * @see DataInput
+ * @see DataInputStream#readUTF(DataInput)
+ * @status updated to 1.4
  */
-
-/**
-  * Create a new UTFDataFormatException without a descriptive error message
-  */
-public
-UTFDataFormatException()
+public class UTFDataFormatException extends IOException
 {
-  super();
-}
-
-/*************************************************************************/
+  /**
+   * Compatible with JDK 1.0+.
+   */
+  private static final long serialVersionUID = 420743449228280612L;
 
-/**
-  * Create a new UTFDataFormatException with a descriptive error message String
-  *
-  * @param message The descriptive error message
-  */
-public
-UTFDataFormatException(String message)
-{
-  super(message);
-}
+  /**
+   * Create a new UTFDataFormatException without a descriptive error message.
+   */
+  public UTFDataFormatException()
+  {
+  }
 
+  /**
+   * Create a new UTFDataFormatException with a descriptive error message.
+   *
+   * @param message the descriptive error message
+   */
+  public UTFDataFormatException(String message)
+  {
+    super(message);
+  }
 } // class UTFDataFormatException
-
index 23147960a4282f60e867d93aef864b9882cfe5ef..8ee686bde0322d278f67db05867c686e6fb03251 100644 (file)
@@ -1,5 +1,5 @@
-/* UnsupportedEncodingException.java -- The requested encoding isn't supported
-   Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
+/* UnsupportedEncodingException.java -- the requested encoding isn't supported
+   Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -7,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
@@ -38,49 +38,36 @@ exception statement from your version. */
 
 package java.io;
 
-/* Written using "Java Class Libraries", 2nd edition, plus online
- * API docs for JDK 1.2 beta from http://www.javasoft.com.
- * Status:  Believed complete and correct.
- */
 /**
-  * This exception is thrown when the requested character encoding is 
-  * not supported.
-  *
-  * @version 0.0
-  *
-  * @author Aaron M. Renn (arenn@urbanophile.com)
-  * @author Per Bothner <bothner@cygnus.com>
-  * @date April 17, 1998.
-  */
-public class UnsupportedEncodingException extends IOException
-{
-
-/*
- * Constructors
+ * This exception is thrown when the requested character encoding is 
+ * not supported.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Per Bothner <bothner@cygnus.com>
+ * @since 1.1
+ * @status updated to 1.4
  */
-
-/**
-  * Create a new UnsupportedEncodingException without a descriptive error message
-  */
-public
-UnsupportedEncodingException()
+public class UnsupportedEncodingException extends IOException
 {
-  super();
-}
-
-/*************************************************************************/
+  /**
+   * Compatible with JDK 1.1+.
+   */
+  private static final long serialVersionUID = -4274276298326136670L;
 
-/**
-  * Create a new UnsupportedEncodingException with a descriptive error message String
-  *
-  * @param message The descriptive error message
-  */
-public
-UnsupportedEncodingException(String message)
-{
-  super(message);
-}
+  /**
+   * Create an exception without a descriptive error message.
+   */
+  public UnsupportedEncodingException()
+  {
+  }
 
+  /**
+   * Create an exception with a descriptive error message.
+   *
+   * @param message the descriptive error message
+   */
+  public UnsupportedEncodingException(String message)
+  {
+    super(message);
+  }
 } // class UnsupportedEncodingException
-
index ce824a94c982574194674d5a89c16515abe510d3..0204862ef14e27bfbdde8b4de0d79c6759b9fa52 100644 (file)
@@ -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
-