Package java.io

Class 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.
    See Also:
    #readObject(), ObjectInputValidation.validateObject(), Serialized Form
    • 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 new InvalidClassException with 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 new InvalidClassException with 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. null is 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:
        getMessage in class Throwable
        Returns:
        the detail message, possibly concatenated with the name of the class that caused the problem.