See java.lang.Throwable.initCause():
public synchronized Throwable initCause(Throwable cause)
{ if (this.cause != this) throw new IllegalStateException("Can't overwrite cause"); if (cause == this) throw new IllegalArgumentException("Self-causation not permitted"); this.cause = cause; return this; }Some exceptions set this.cause to null, e.g., java.rmi.RemoteException():
public RemoteException(String s, Throwable cause)
{ super(s); initCause(null); // Disallow subsequent initCause detail = cause; }The problem surfaced with the failure of org.jboss.test.naming.test.NamingRestartUnitTestCase.testBadBindingLookup(), in the AS testsuite, which attempts to transmit an instance of org.jboss.test.naming.restart.NoSuchObjectException:
public class NonDeserializable implements Serializable
{
private static final long serialVersionUID = 0L;
private void writeObject(java.io.ObjectOutputStream out)
throws IOException
private void readObject(java.io.ObjectInputStream in)
throws IOException, ClassNotFoundException
}