Uploaded image for project: 'JBoss Marshalling'
  1. JBoss Marshalling
  2. JBMAR-103

TraceInformation.getOrAddTraceInformation() should guard against exceptions whose cause cannot be set

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 1.2.1.GA, 1.3.0.CR2
    • 1.2.0.GA
    • None
    • None

      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

      { out.defaultWriteObject(); }

      private void readObject(java.io.ObjectInputStream in)
      throws IOException, ClassNotFoundException

      { throw new java.rmi.NoSuchObjectException("Let's see how this is handled"); }

      }

            dlloyd@redhat.com David Lloyd
            rsigal@redhat.com Ronald Sigal
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: