Uploaded image for project: 'Arquillian'
  1. Arquillian
  2. ARQ-1437

NPE in ExceptionProxy.readExternal() for root cause leads to deserializationProblem = true

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor Minor
    • 1.1.5.Final
    • 1.0.2.Final, 1.1.0.Final
    • None
    • None
    • Hide

      From an arquillian test method, call an ejb method that throws some exception and then debug EceptionProxy.readExternal.

      Show
      From an arquillian test method, call an ejb method that throws some exception and then debug EceptionProxy.readExternal .

      See line 199 (for 1.0.2.Final):

      // reset the cause, so we can de-serialize them individual
      SecurityActions.setFieldValue(Throwable.class, original, "cause", causeProxy.createException());
      

      For the root cause of an exception, causeProxy will always be null and so a NullPointerException is thrown.

      As the code is wrapped in a try block with follwoing catch block:

      catch (Throwable e) // ClassNotFoundExcpetion / NoClassDefFoundError
      {
          // ignore, could not load class on client side, move on and create a fake 'proxy' later
          deserializationProblem = true;
      }
      

      the NPE is caught and is "expected" to be a ClassNotFoundExcpetion or NoClassDefFoundError which is clearly not the case.

      Possible fix:
      original.cause should only be overwritten when causeProxy is not null.

      More context information:
      I came across this problem while trying to find the reason for an unexpected ArquillianProxyException:

      org.jboss.arquillian.test.spi.ArquillianProxyException: javax.ejb.EJBException : javax.persistence.OptimisticLockException [Proxied because : Original exception not deserilizable, ClassNotFoundException]

      The root problem was not the NPE, but the ClassNotFoundException mislead me and so I debugged ExceptionProxy.
      I my case there is an InvalidClassException because of an older hibernate version on the client side.
      So that is another problem of ExceptionProxy as it assumes that only ClassNotFoundExcpetion or NoClassDefFoundError can occur!

              aslak@redhat.com Aslak Knutsen
              falko.modler@t-systems.com Falko Modler (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: