2

I'm struggling with some code which systematicly fails on jenkins, but passes without issues on my machine, of course.

public static FaultException getFaultException(String faultCode, String faultString) {
    LOGGER.debug("start getFaultException");
    Fault fault = new Fault();
    fault.setFaultCode(faultCode);
    fault.setFaultString(faultString);
    LOGGER.debug("Returning new FaultException");
    FaultException fex = new FaultException("Fault exception", fault);

    LOGGER.debug("fex is ", fex);

    try {
        if (fex == null) {
            LOGGER.debug("getFaultException fex is null");
        }
    }catch(NullPointerException nex) {
        LOGGER.debug("catched npe ", nex);
    }

    LOGGER.debug("fex class is " + fex.getClass().getCanonicalName());
    LOGGER.debug("fex built in getFaultException");
    return fex;
}

The code you see will display on jenkins catched npe + the null pointer exception, and will re-trigger a npe on the next line. So basicly i am having a npe while checking if an object is null (the if (fex == null) line is the culprit). However the LOGGER.debug("fex is ", fex); line will successfully dump a FaultException object.

How can this be? The jenkinks machine runs openjdk 1.7.0_85-b01, my machine is a windows machine with 1.7.0_80. Also, the FaultException class is a generated class, with a @WebFault annotation, but i compared the resulted bytecode on the two machines and are the same. (except paths and stuff like that)

Thanks for looking!

UPDATE, the log file:

            18-11-15;14:27:37;MessageContentFactory;DEBUG;start getFaultException 
            18-11-15;14:27:37;MessageContentFactory;DEBUG;Returning new FaultException 
            18-11-15;14:27:37;MessageContentFactory;DEBUG;fex is  
            [censored].service.FaultException: Fault exception
                at [censored].service.operations.common.MessageContentFactory.getFaultException(MessageContentFactory.java:98)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.lang.reflect.Method.invoke(Method.java:606)
                at org.powermock.api.mockito.internal.invocation.MockitoMethodInvocationControl$1.invoke(MockitoMethodInvocationControl.java:242)
                at org.mockito.internal.invocation.realmethod.FilteredCGLIBProxyRealMethod.invoke(FilteredCGLIBProxyRealMethod.java:27)
                at org.mockito.internal.invocation.InvocationImpl.callRealMethod(InvocationImpl.java:108)
                at org.mockito.internal.stubbing.answers.CallsRealMethods.answer(CallsRealMethods.java:36)
                at org.mockito.internal.stubbing.StubbedInvocationMatcher.answer(StubbedInvocationMatcher.java:34)
                at org.mockito.internal.handler.MockHandlerImpl.handle(MockHandlerImpl.java:91)
                at org.powermock.api.mockito.internal.invocation.MockitoMethodInvocationControl.performIntercept(MockitoMethodInvocationControl.java:260)
                at org.powermock.api.mockito.internal.invocation.MockitoMethodInvocationControl.invoke(MockitoMethodInvocationControl.java:192)
                at org.powermock.core.MockGateway.doMethodCall(MockGateway.java:105)
                at org.powermock.core.MockGateway.methodCall(MockGateway.java:60)
                at [censored].service.operations.common.MessageContentFactory.getFaultException(MessageContentFactory.java)
                at [censored].service.operations.Tr069Cwmp10PortTypeImpl.getFaultException(Tr069Cwmp10PortTypeImpl.java:301)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.lang.reflect.Method.invoke(Method.java:606)
                at org.powermock.api.mockito.internal.invocation.MockitoMethodInvocationControl$1.invoke(MockitoMethodInvocationControl.java:242)
                at org.mockito.internal.invocation.realmethod.FilteredCGLIBProxyRealMethod.invoke(FilteredCGLIBProxyRealMethod.java:27)
                at org.mockito.internal.invocation.InvocationImpl.callRealMethod(InvocationImpl.java:108)
                at org.mockito.internal.stubbing.answers.CallsRealMethods.answer(CallsRealMethods.java:36)
                at org.mockito.internal.handler.MockHandlerImpl.handle(MockHandlerImpl.java:93)
                at org.powermock.api.mockito.internal.invocation.MockitoMethodInvocationControl.performIntercept(MockitoMethodInvocationControl.java:260)
                at org.powermock.api.mockito.internal.invocation.MockitoMethodInvocationControl.invoke(MockitoMethodInvocationControl.java:192)
                at org.powermock.core.MockGateway.doMethodCall(MockGateway.java:105)
                at org.powermock.core.MockGateway.methodCall(MockGateway.java:168)
                at [censored].service.operations.Tr069Cwmp10PortTypeImpl.getFaultException(Tr069Cwmp10PortTypeImpl.java)
                at [censored].service.operations.Tr069Cwmp10PortTypeImpl.inform(Tr069Cwmp10PortTypeImpl.java:280)
                at [censored].service.operations.Tr069Cwmp10PortTypeImpl$$EnhancerByMockitoWithCGLIB$$665825f2.CGLIB$inform$10(<generated>)
                at [censored].service.operations.Tr069Cwmp10PortTypeImpl$$EnhancerByMockitoWithCGLIB$$665825f2$$FastClassByMockitoWithCGLIB$$cd84789d.invoke(<generated>)
                at org.mockito.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:216)
                at org.mockito.internal.creation.AbstractMockitoMethodProxy.invokeSuper(AbstractMockitoMethodProxy.java:10)
                at org.mockito.internal.invocation.realmethod.CGLIBProxyRealMethod.invoke(CGLIBProxyRealMethod.java:22)
                at org.mockito.internal.invocation.realmethod.FilteredCGLIBProxyRealMethod.invoke(FilteredCGLIBProxyRealMethod.java:27)
                at org.mockito.internal.invocation.InvocationImpl.callRealMethod(InvocationImpl.java:108)
                at org.mockito.internal.stubbing.answers.CallsRealMethods.answer(CallsRealMethods.java:36)
                at org.mockito.internal.handler.MockHandlerImpl.handle(MockHandlerImpl.java:93)
                at org.mockito.internal.handler.NullResultGuardian.handle(NullResultGuardian.java:29)
                at org.mockito.internal.handler.InvocationNotifierHandler.handle(InvocationNotifierHandler.java:38)
                at org.mockito.internal.creation.MethodInterceptorFilter.intercept(MethodInterceptorFilter.java:51)
                at [censored].service.operations.Tr069Cwmp10PortTypeImpl$$EnhancerByMockitoWithCGLIB$$665825f2.inform(<generated>)
                at [censored].service.operations.Tr069Cwmp10PortTypeImplTest.executeTestInform(Tr069Cwmp10PortTypeImplTest.java:393)
                at [censored].service.operations.Tr069Cwmp10PortTypeImplTest.testInformInvalidParams(Tr069Cwmp10PortTypeImplTest.java:500)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.lang.reflect.Method.invoke(Method.java:606)
                at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:68)
                at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$PowerMockJUnit44MethodRunner.runTestMethod(PowerMockJUnit44RunnerDelegateImpl.java:310)
                at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:88)
                at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:96)
                at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$PowerMockJUnit44MethodRunner.executeTest(PowerMockJUnit44RunnerDelegateImpl.java:294)
                at org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl$PowerMockJUnit47MethodRunner.executeTestInSuper(PowerMockJUnit47RunnerDelegateImpl.java:127)
                at org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl$PowerMockJUnit47MethodRunner.executeTest(PowerMockJUnit47RunnerDelegateImpl.java:82)
                at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$PowerMockJUnit44MethodRunner.runBeforesThenTestThenAfters(PowerMockJUnit44RunnerDelegateImpl.java:282)
                at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:86)
                at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:49)
                at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.invokeTestMethod(PowerMockJUnit44RunnerDelegateImpl.java:207)
                at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.runMethods(PowerMockJUnit44RunnerDelegateImpl.java:146)
                at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$1.run(PowerMockJUnit44RunnerDelegateImpl.java:120)
                at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:33)
                at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:45)
                at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.run(PowerMockJUnit44RunnerDelegateImpl.java:118)
                at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.run(JUnit4TestSuiteChunkerImpl.java:101)
                at org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.run(AbstractCommonPowerMockRunner.java:53)
                at org.powermock.modules.junit4.PowerMockRunner.run(PowerMockRunner.java:53)
                at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
                at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
                at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
                at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.lang.reflect.Method.invoke(Method.java:606)
                at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
                at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
            18-11-15;14:27:37;MessageContentFactory;DEBUG;catched npe  
            java.lang.NullPointerException
                at [censored].service.operations.common.MessageContentFactory.getFaultException(MessageContentFactory.java:100)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.lang.reflect.Method.invoke(Method.java:606)
                at org.powermock.api.mockito.internal.invocation.MockitoMethodInvocationControl$1.invoke(MockitoMethodInvocationControl.java:242)
                at org.mockito.internal.invocation.realmethod.FilteredCGLIBProxyRealMethod.invoke(FilteredCGLIBProxyRealMethod.java:27)
                at org.mockito.internal.invocation.InvocationImpl.callRealMethod(InvocationImpl.java:108)
                at org.mockito.internal.stubbing.answers.CallsRealMethods.answer(CallsRealMethods.java:36)
                at org.mockito.internal.stubbing.StubbedInvocationMatcher.answer(StubbedInvocationMatcher.java:34)
                at org.mockito.internal.handler.MockHandlerImpl.handle(MockHandlerImpl.java:91)
                at org.powermock.api.mockito.internal.invocation.MockitoMethodInvocationControl.performIntercept(MockitoMethodInvocationControl.java:260)
                at org.powermock.api.mockito.internal.invocation.MockitoMethodInvocationControl.invoke(MockitoMethodInvocationControl.java:192)
                at org.powermock.core.MockGateway.doMethodCall(MockGateway.java:105)
                at org.powermock.core.MockGateway.methodCall(MockGateway.java:60)
                at [censored].service.operations.common.MessageContentFactory.getFaultException(MessageContentFactory.java)
                at [censored].service.operations.Tr069Cwmp10PortTypeImpl.getFaultException(Tr069Cwmp10PortTypeImpl.java:301)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.lang.reflect.Method.invoke(Method.java:606)
                at org.powermock.api.mockito.internal.invocation.MockitoMethodInvocationControl$1.invoke(MockitoMethodInvocationControl.java:242)
                at org.mockito.internal.invocation.realmethod.FilteredCGLIBProxyRealMethod.invoke(FilteredCGLIBProxyRealMethod.java:27)
                at org.mockito.internal.invocation.InvocationImpl.callRealMethod(InvocationImpl.java:108)
                at org.mockito.internal.stubbing.answers.CallsRealMethods.answer(CallsRealMethods.java:36)
                at org.mockito.internal.handler.MockHandlerImpl.handle(MockHandlerImpl.java:93)
                at org.powermock.api.mockito.internal.invocation.MockitoMethodInvocationControl.performIntercept(MockitoMethodInvocationControl.java:260)
                at org.powermock.api.mockito.internal.invocation.MockitoMethodInvocationControl.invoke(MockitoMethodInvocationControl.java:192)
                at org.powermock.core.MockGateway.doMethodCall(MockGateway.java:105)
                at org.powermock.core.MockGateway.methodCall(MockGateway.java:168)
                at [censored].service.operations.Tr069Cwmp10PortTypeImpl.getFaultException(Tr069Cwmp10PortTypeImpl.java)
                at [censored].service.operations.Tr069Cwmp10PortTypeImpl.inform(Tr069Cwmp10PortTypeImpl.java:280)
                at [censored].service.operations.Tr069Cwmp10PortTypeImpl$$EnhancerByMockitoWithCGLIB$$665825f2.CGLIB$inform$10(<generated>)
                at [censored].service.operations.Tr069Cwmp10PortTypeImpl$$EnhancerByMockitoWithCGLIB$$665825f2$$FastClassByMockitoWithCGLIB$$cd84789d.invoke(<generated>)
                at org.mockito.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:216)
                at org.mockito.internal.creation.AbstractMockitoMethodProxy.invokeSuper(AbstractMockitoMethodProxy.java:10)
                at org.mockito.internal.invocation.realmethod.CGLIBProxyRealMethod.invoke(CGLIBProxyRealMethod.java:22)
                at org.mockito.internal.invocation.realmethod.FilteredCGLIBProxyRealMethod.invoke(FilteredCGLIBProxyRealMethod.java:27)
                at org.mockito.internal.invocation.InvocationImpl.callRealMethod(InvocationImpl.java:108)
                at org.mockito.internal.stubbing.answers.CallsRealMethods.answer(CallsRealMethods.java:36)
                at org.mockito.internal.handler.MockHandlerImpl.handle(MockHandlerImpl.java:93)
                at org.mockito.internal.handler.NullResultGuardian.handle(NullResultGuardian.java:29)
                at org.mockito.internal.handler.InvocationNotifierHandler.handle(InvocationNotifierHandler.java:38)
                at org.mockito.internal.creation.MethodInterceptorFilter.intercept(MethodInterceptorFilter.java:51)
                at [censored].service.operations.Tr069Cwmp10PortTypeImpl$$EnhancerByMockitoWithCGLIB$$665825f2.inform(<generated>)
                at [censored].service.operations.Tr069Cwmp10PortTypeImplTest.executeTestInform(Tr069Cwmp10PortTypeImplTest.java:393)
                at [censored].service.operations.Tr069Cwmp10PortTypeImplTest.testInformInvalidParams(Tr069Cwmp10PortTypeImplTest.java:500)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.lang.reflect.Method.invoke(Method.java:606)
                at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:68)
                at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$PowerMockJUnit44MethodRunner.runTestMethod(PowerMockJUnit44RunnerDelegateImpl.java:310)
                at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:88)
                at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:96)
                at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$PowerMockJUnit44MethodRunner.executeTest(PowerMockJUnit44RunnerDelegateImpl.java:294)
                at org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl$PowerMockJUnit47MethodRunner.executeTestInSuper(PowerMockJUnit47RunnerDelegateImpl.java:127)
                at org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl$PowerMockJUnit47MethodRunner.executeTest(PowerMockJUnit47RunnerDelegateImpl.java:82)
                at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$PowerMockJUnit44MethodRunner.runBeforesThenTestThenAfters(PowerMockJUnit44RunnerDelegateImpl.java:282)
                at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:86)
                at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:49)
                at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.invokeTestMethod(PowerMockJUnit44RunnerDelegateImpl.java:207)
                at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.runMethods(PowerMockJUnit44RunnerDelegateImpl.java:146)
                at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$1.run(PowerMockJUnit44RunnerDelegateImpl.java:120)
                at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:33)
                at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:45)
                at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.run(PowerMockJUnit44RunnerDelegateImpl.java:118)
                at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.run(JUnit4TestSuiteChunkerImpl.java:101)
                at org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.run(AbstractCommonPowerMockRunner.java:53)
                at org.powermock.modules.junit4.PowerMockRunner.run(PowerMockRunner.java:53)
                at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
                at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
                at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
                at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.lang.reflect.Method.invoke(Method.java:606)
                at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
                at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)

UPDATE 2: the FaultException.java file:

@WebFault(name = "Fault", targetNamespace = "urn:dslforum-org:cwmp-1-0")
public class FaultException extends Exception {

private [censored].Fault fault;

public FaultException() {
    super();
}

public FaultException(String message) {
    super(message);
}

public FaultException(String message, Throwable cause) {
    super(message, cause);
}

public FaultException(String message, [censored].Fault fault) {
    super(message);
    this.fault = fault;
}

public FaultException(String message, [censored].Fault fault, Throwable cause) {
    super(message, cause);
    this.fault = fault;
}

public [censored].Fault getFaultInfo() {
    return this.fault;
}

}

aciobanu
  • 391
  • 1
  • 4
  • 14
  • Did you post the exact code? The try-block should not throw an NPE except `LOGGER` is null - which can't be true since you'd get the NPE right before the try-block then. – Thomas Nov 18 '15 at 14:40
  • I strongly suspect that what is running on your machine is different from what is running on Jenkins. What you show cannot throw a NPE except if LOGGER is null. – wero Nov 18 '15 at 14:42
  • Yes i copied pasted the code. I can't understand it either.The try catch line really does trigger the NPE and the logger is definitly not null as it displays all the log lines. – aciobanu Nov 18 '15 at 14:42
  • @wero this is what i also thought, so i downloaded the .class files from jenkins and checked them. They are exactly what i was expecting (my code from my machine) – aciobanu Nov 18 '15 at 14:43
  • @aciobanu can you add the log output – wero Nov 18 '15 at 14:46
  • For the sake of completion, could you confirm which line in the source you posted is line 100? – JonK Nov 18 '15 at 14:53
  • LOGGER.debug("fex is ", fex); that throws the NPE :-) – nano_nano Nov 18 '15 at 14:54
  • In your log I can see `.getFaultException(MessageContentFactory.java:XXX)` twice, once with 98 and once with 100. Does it end up calling itself when you get NPE? – Jaroslaw Pawlak Nov 18 '15 at 14:55
  • no, it is because after catching it in try/catch the code still executes and the next line which uses fex triggers again a NPE which is catched in another try catch, in the method that calls the method you see, that is why you see it twice. – aciobanu Nov 18 '15 at 14:58
  • 2
    No more guessing. Provide an MCVE. – Sotirios Delimanolis Nov 18 '15 at 14:59
  • @SotiriosDelimanolis The problem is that i only have this on the jenkins machine, on all the other machines it's as it should be ... – aciobanu Nov 18 '15 at 15:00
  • 1
    The code and the logs do not fit together: `fex is ...` seems to be printed on line 98, `catched npe` on line 100. In your code both log statements are 4 lines apart which clearly indicates a difference. – Thomas Nov 18 '15 at 15:05

1 Answers1

2

what do you expect? you are using fex after your null check normaly:

try {
    if (fex == null) {
        LOGGER.debug("getFaultException fex is null");
    }
}catch(NullPointerException nex) {
    LOGGER.debug("catched npe ", nex);
}

HERE --> LOGGER.debug("fex class is " + fex.getClass().getCanonicalName());

that must leads to a NPE because fex can only be null if your first condition was true.

That would be make more sense:

    if (fex == null) {
        LOGGER.debug("getFaultException fex is null");
    }else{
        LOGGER.debug("fex class is " + fex.getClass().getCanonicalName());
        LOGGER.debug("fex built in getFaultException");
    }
    return fex;

btw. try catch NPE is not necessary here. it cannot be thrown. Would be the LOGGER null the first line of your method would throw a NPE.

nano_nano
  • 12,351
  • 8
  • 55
  • 83
  • fex is initialized to a new object when it is declared. Why should it be null? – wero Nov 18 '15 at 14:47
  • from the question posted it cannot be null. I think there is a difference between the message and the shown code. – nano_nano Nov 18 '15 at 14:49
  • and yet this is the case ... look at the stack dump, you will see that the catched npe part is executed/displayed. – aciobanu Nov 18 '15 at 14:57