List of usage examples for java.io ObjectStreamException initCause
public synchronized Throwable initCause(Throwable cause)
From source file:org.grouplens.grapht.annotation.AnnotationProxy.java
/** * Customized {@code readObject} implementation to ensure the cached type is resolved. * * @param in The stream./* w w w .ja v a 2 s. c o m*/ * @throws java.io.ObjectStreamException If there is an error reading the object from the stream. */ @SuppressWarnings("unchecked") private void readObject(ObjectInputStream in) throws ObjectStreamException { try { in.defaultReadObject(); cachedType = (Class<T>) annotationType.resolve(); } catch (IOException e) { ObjectStreamException ex = new StreamCorruptedException("IO exception"); ex.initCause(e); throw ex; } catch (ClassNotFoundException e) { ObjectStreamException ex = new InvalidObjectException("IO exception"); ex.initCause(e); throw ex; } }