[TOC] [Prev] [Next]

Exceptions In Object Serialization


All exceptions thrown by serialization classes are subclasses of ObjectStreamException which is a subclass of IOException.

Exception Description
ObjectStreamException Superclass of all serialization exceptions.
InvalidClassException Thrown when a class cannot be used to restore objects for any of these reasons:
  • The class does not match the serial version of the class in the stream.
  • The class contains fields with invalid primitive data types.
  • The class is not public; the class does not have an accessible no-arg constructor.
NotSerializableException Thrown by a readObject or writeObject method to terminate serialization or deserialization.
StreamCorruptedException Thrown when the stream header is invalid or when control information in the stream is not found or found to be invalid.
NotActiveException Thrown if registerValidation is not called during readObject.
InvalidObjectException Thrown when a restored object cannot be made valid.
OptionalDataException Thrown by readObject when there is primitive data in the stream and an object is expected. The length field of the exception indicates the number of bytes that are available in the current block.
WriteAbortedException Thrown when reading a stream terminated by an exception that occurred while the stream was being written.



[TOC] [Prev] [Next]

Copyright © 1996, 1997 Sun Microsystems, Inc. All rights reserved.