aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/io/InvalidClassException.java
diff options
context:
space:
mode:
authorBryce McKinlay <bryce@waitaki.otago.ac.nz>2001-04-26 02:02:05 +0000
committerBryce McKinlay <bryce@gcc.gnu.org>2001-04-26 03:02:05 +0100
commit0cd99be7377980b537d5b3a5c1b2903f6b114d9b (patch)
tree6e9ae6e83b7184ea72086b949cfcbb9f8a4c3a3d /libjava/java/io/InvalidClassException.java
parent7b518b39532eb29e51d8e1a81794ed1c59fdff86 (diff)
downloadgcc-0cd99be7377980b537d5b3a5c1b2903f6b114d9b.zip
gcc-0cd99be7377980b537d5b3a5c1b2903f6b114d9b.tar.gz
gcc-0cd99be7377980b537d5b3a5c1b2903f6b114d9b.tar.bz2
re PR libgcj/2237 (serialization doesn't throw exception on failure)
Fix PR libgcj/2237: * java/io/ObjectStreamClass.java (setClass): Calculate serialVersionUID for local class and compare it against the UID from the Object Stream. Throw InvalidClassException upon mismatch. (setUID): Renamed to... (getClassUID): this. Return the calculated class UID rather than setting uid field directly. (getDefinedSUID): Removed. * java/io/ObjectInputStream.java (resolveClass): Use the three-argument Class.forName(). * java/io/InvalidClassException (toString): Don't include classname in result if it is null. From-SVN: r41567
Diffstat (limited to 'libjava/java/io/InvalidClassException.java')
-rw-r--r--libjava/java/io/InvalidClassException.java101
1 files changed, 39 insertions, 62 deletions
diff --git a/libjava/java/io/InvalidClassException.java b/libjava/java/io/InvalidClassException.java
index fd03154..1b50bec 100644
--- a/libjava/java/io/InvalidClassException.java
+++ b/libjava/java/io/InvalidClassException.java
@@ -44,67 +44,44 @@ package java.io;
*/
public class InvalidClassException extends ObjectStreamException
{
-
-/*
- * Instance Variables
- */
-
-/**
- * The name of the class which encountered the error.
- */
-public String classname;
-
-/*************************************************************************/
-
-/*
- * Constructors
- */
-
-/**
- * Create a new InvalidClassException with a descriptive error message String
- *
- * @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
- */
-public
-InvalidClassException(String classname, String message)
-{
- super(message);
- this.classname = classname;
+ /**
+ * The name of the class which encountered the error.
+ */
+ public String classname;
+
+ /**
+ * Create a new InvalidClassException with a descriptive error message String
+ *
+ * @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
+ */
+ public InvalidClassException(String classname, String message)
+ {
+ super(message);
+ this.classname = classname;
+ }
+
+ /**
+ * 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
+ */
+ public String getMessage()
+ {
+ return super.getMessage() + (classname == null ? "" : ": " + classname);
+ }
}
-/*************************************************************************/
-
-/*
- * Instance Methods
- */
-
-/**
- * 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
- */
-public String
-getMessage()
-{
- return(super.getMessage() + ": " + classname);
-}
-
-} // class InvalidClassException
-