spring-projects / spring-ws

Spring Web Services
https://spring.io/projects/spring-ws
Apache License 2.0
316 stars 302 forks source link

NPE when unmarshalling invalid request with Jaxb1Marshaller [SWS-260] #417

Closed gregturn closed 16 years ago

gregturn commented 16 years ago

Erik-Berndt Scheper opened SWS-260 and commented

When unmarshalling an invalid request a NullPointerException occurs in the AbstractStaxXmlReader. The default exception resolver generates the following WARN debug log:

IWA-UM WARN 21-12-2007 09:19:00,009 [WebContainer : 0] (org.springframework.ws.soap.server.SoapMessageDispatcher) | Endpoint invocation resulted in exception - responding with SOAP Fault java.lang.NullPointerException at org.springframework.xml.stream.AbstractStaxXmlReader.parse(AbstractStaxXmlReader.java:70) at org.springframework.xml.stream.AbstractStaxXmlReader.parse(AbstractStaxXmlReader.java:50) at org.apache.xerces.jaxp.validation.ValidatorHandlerImpl.validate(Unknown Source) at org.apache.xerces.jaxp.validation.ValidatorImpl.validate(Unknown Source) at javax.xml.validation.Validator.validate(Validator.java:141) at org.springframework.xml.validation.Jaxp13ValidatorFactory$Jaxp13Validator.validate(Jaxp13ValidatorFactory.java:61) at org.springframework.ws.server.endpoint.interceptor.AbstractValidatingInterceptor.handleRequest(AbstractValidatingInterceptor.java:143) at org.springframework.ws.server.MessageDispatcher.dispatch(MessageDispatcher.java:207) at org.springframework.ws.server.MessageDispatcher.receive(MessageDispatcher.java:162) at org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:87) at org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:57) at org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:197) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:476) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:441) at javax.servlet.http.HttpServlet.service(HttpServlet.java:763) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1572) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1521) at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:136) at nl.icscards.commons.monitoring.FlowTracerFilter.doFilter(FlowTracerFilter.java:69) at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:142) at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:121) at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:82) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:759) at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3177) at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:253) at com.ibm.ws.webcontainer.VirtualHost.handleRequest(VirtualHost.java:229) at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1970) at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:114) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:472) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:411) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:288) at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminaters(NewConnectionInitialReadCallback.java:207) at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:109) at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:566) at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:619) at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:952) at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1039) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1471)


Affects: 1.0.2

Issue Links:

gregturn commented 16 years ago

Erik-Berndt Scheper commented

Note: the XML was invalid in this case.

gregturn commented 16 years ago

Arjen Poutsma commented

Does the log show any more details of the stack trace? Most importantly, the location the NullpointerException occurred?

gregturn commented 16 years ago

Erik-Berndt Scheper commented

I've looked further into this. The NPE occurs exactly at line 70 of AbstractStaxXmlReader, where the following statement is executed: SAXParseException saxException = new SAXParseException(ex.getMessage(), null, null, ex.getLocation().getLineNumber(), ex.getLocation().getColumnNumber(), ex);

The original exception (ex) is an XmlStreamException, as expected. But unfortunately ex.getLocation() returns null, so a NPE is produced.

Fortunately this is already fixed in 1.0.3 (as per #380).

See also: http://fisheye3.cenqua.com/browse/springframework/spring-ws/branches/spring-ws-1.0/xml/src/main/java/org/springframework/xml/stream/AbstractStaxXmlReader.java?r1=8941&r2=9163

gregturn commented 16 years ago

Erik-Berndt Scheper commented

Consequentially these issues can be linked, and this one can be added to the fix list of 1.0.3.