diff options
author | bryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-04-26 02:02:05 +0000 |
---|---|---|
committer | bryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-04-26 02:02:05 +0000 |
commit | 1dea8d9d8bd52e2984b7ab28141b95cdb7ad1235 (patch) | |
tree | 6e9ae6e83b7184ea72086b949cfcbb9f8a4c3a3d /libjava/java/io/InvalidClassException.java | |
parent | 9df0807c09bfcb7f21f4c30a95e7ca828b03c105 (diff) | |
download | ppe42-gcc-1dea8d9d8bd52e2984b7ab28141b95cdb7ad1235.tar.gz ppe42-gcc-1dea8d9d8bd52e2984b7ab28141b95cdb7ad1235.zip |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@41567 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/io/InvalidClassException.java')
-rw-r--r-- | libjava/java/io/InvalidClassException.java | 101 |
1 files changed, 39 insertions, 62 deletions
diff --git a/libjava/java/io/InvalidClassException.java b/libjava/java/io/InvalidClassException.java index fd03154a1f6..1b50bec44f5 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 - |