FileDocCategorySizeDatePackage
InvalidClassException.javaAPI DocAndroid 1.5 API3226Wed May 06 22:41:04 BST 2009java.io

InvalidClassException

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
ObjectInputStream #readObject()
see
ObjectInputValidation#validateObject()
since
Android 1.0

Fields Summary
private static final long
serialVersionUID
public String
classname
The fully qualified name of the class that caused the problem.
Constructors Summary
public InvalidClassException(String detailMessage)
Constructs a new {@code InvalidClassException} with its stack trace and detailed message filled in.

param
detailMessage the detail message for this exception.
since
Android 1.0


                                              
       
        super(detailMessage);
    
public InvalidClassException(String className, String detailMessage)
Constructs a new {@code InvalidClassException} with its stack trace, detail message and the fully qualified name of the class which caused the exception filled in.

param
className the name of the class that caused the exception.
param
detailMessage the detail message for this exception.
since
Android 1.0

        super(detailMessage);
        this.classname = className;
    
Methods Summary
public java.lang.StringgetMessage()
Returns the detail message which was provided when the exception was created. {@code 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.

return
the detail message, possibly concatenated with the name of the class that caused the problem.
since
Android 1.0

        String msg = super.getMessage();
        if (classname != null) {
            msg = classname + "; " + msg; //$NON-NLS-1$
        }
        return msg;