private Throwable readFromByteArray(byte[] contents) {
// only for top level we would have the contents as not null.
if (contents != null) {
ByteArrayInputStream bais = new ByteArrayInputStream(contents);
try {
ObjectInputStream ois = new ObjectInputStreamWithClassloader(bais, ExceptionHolder.class.getClassLoader());
return (Throwable)ois.readObject();
} catch (Exception e) {
//
}
}
return null;