Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-2329

NullPointerException in JAXBEncoderDecoder when marshalling a null Array

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.2.2
    • 2.1.6, 2.2.3
    • JAXB Databinding
    • None
    • Novice

    Description

      I have an Exception object that includes an array that is initialized to null. When the JAXBEncoderDecoder is going to encode it, it encounters an NPE as follows:

      WARNING: Exception occurred while writing fault.
      org.apache.cxf.interceptor.Fault: Marshalling Error: null
      at org.apache.cxf.jaxb.JAXBEncoderDecoder.marshallException(JAXBEncoderDecoder.java:294)
      at org.apache.cxf.jaxb.io.DataWriterImpl.write(DataWriterImpl.java:162)
      at org.apache.cxf.interceptor.FaultOutInterceptor.handleMessage(FaultOutInterceptor.java:78)
      at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
      at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:96)
      at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:284)
      at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:89)
      at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:302)
      at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:265)
      at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:70)
      at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:722)
      at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206)
      at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
      at org.mortbay.jetty.Server.handle(Server.java:324)
      at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
      at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:842)
      at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:648)
      at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
      at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
      at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
      at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450)
      Caused by: java.lang.NullPointerException
      at org.apache.cxf.jaxb.JAXBEncoderDecoder.writeArrayObject(JAXBEncoderDecoder.java:313)
      at org.apache.cxf.jaxb.JAXBEncoderDecoder.marshallException(JAXBEncoderDecoder.java:283)
      ... 20 more

      It seems like a simple null check could fix this one...

      Attachments

        Activity

          People

            Unassigned Unassigned
            kalebwalton Kaleb Walton
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 0.5h
                0.5h
                Remaining:
                Remaining Estimate - 0.5h
                0.5h
                Logged:
                Time Spent - Not Specified
                Not Specified