Package java.io
Class InvalidClassException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.io.IOException
-
- java.io.ObjectStreamException
-
- java.io.InvalidClassException
-
- All Implemented Interfaces:
Serializable
public class InvalidClassException extends ObjectStreamException
Signals a problem during the serialization or or deserialization of an object. Possible reasons include:- The SUIDs of the class loaded by the VM and the serialized class info do not match.
- A serializable or externalizable object cannot be instantiated (when deserializing) because the no-arg constructor that needs to be run is not visible or fails.
-
-
Constructor Summary
Constructors Constructor Description InvalidClassException(String detailMessage)Constructs a newInvalidClassExceptionwith its stack trace and detailed message filled in.InvalidClassException(String className, String detailMessage)Constructs a newInvalidClassExceptionwith its stack trace, detail message and the fully qualified name of the class which caused the exception filled in.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetMessage()Returns the detail message which was provided when the exception was created.-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Field Detail
-
classname
public String classname
The fully qualified name of the class that caused the problem.
-
-
Constructor Detail
-
InvalidClassException
public InvalidClassException(String detailMessage)
Constructs a newInvalidClassExceptionwith its stack trace and detailed message filled in.- Parameters:
detailMessage- the detail message for this exception.
-
InvalidClassException
public InvalidClassException(String className, String detailMessage)
Constructs a newInvalidClassExceptionwith its stack trace, detail message and the fully qualified name of the class which caused the exception filled in.- Parameters:
className- the name of the class that caused the exception.detailMessage- the detail message for this exception.
-
-
Method Detail
-
getMessage
public String getMessage()
Returns the detail message which was provided when the exception was created.nullis returned if no message was provided at creation time. If a detail message as well as a class name are provided, then the values are concatenated and returned.- Overrides:
getMessagein classThrowable- Returns:
- the detail message, possibly concatenated with the name of the class that caused the problem.
-
-