[#JAX_WS-1181] NullPointerException with

Werbung
[JAX_WS-1181] NullPointerException with @SchemaValidation of a
webservice where xsd has an empty namespace Created: 22/Dec/15 Updated: 21/Jan/16
Status:
Project:
Component/s:
Affects
Version/s:
Fix Version/s:
Open
jax-ws
runtime
None
Type:
Reporter:
Resolution:
Labels:
Remaining
Estimate:
Time Spent:
Original
Estimate:
Bug
huberdav
Unresolved
None
Not Specified
None
Priority:
Assignee:
Votes:
Major
Unassigned
0
Not Specified
Not Specified
Description
There is a tiny bug in artefact webservices-rt-2.3.1.jar in class com.sun.xml.ws.util.pipe.AbstractSchemaValidati
In method 'createMasterPseudoSchema()' on line 539 the if statement is not complete and might produce a NullP
or the empty String. In case of the empty String the handling is correct, but in case of 'null' a NullPointerExcepti
Current implementation:
private Source createMasterPseudoSchema(Map<String, String> docs) {
final StringBuilder sb = new StringBuilder("<xsd:schema xmlns:xsd='http://www.w3.o
targetNamespace='urn:x-jax-ws-master'>\n");
for(Map.Entry<String, String> e : docs.entrySet()) {
String systemId = e.getValue();
String ns = e.getKey();
sb.append("<xsd:import schemaLocation='").append(systemId).append("'");
if (!ns.equals("")) {
sb.append(" namespace='").append(ns).append("'");
}
sb.append("/>\n");
}
sb.append("</xsd:schema>");
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.log(Level.FINE, "Master Pseudo Schema = {0}", sb);
}
// override getReader() so that the same source can be used multiple times
return new StreamSource("file:x-jax-ws-master-doc") {
@Override
public Reader getReader() {
return new StringReader(sb.toString());
}
};
}
Fix:
if (ns != null && !"".equals(ns)) {
sb.append(" namespace='").append(ns).append("'");
}
SCHWERWIEGEND: WSSERVLET11: Laufzeitdeskriptor konnte nicht geparst werden: java.lang.Null
java.lang.NullPointerException
at com.sun.xml.ws.util.pipe.AbstractSchemaValidationTube.createMasterPseudoSchema(
at com.sun.xml.ws.util.pipe.AbstractSchemaValidationTube.getSchemaSources(Abstract
at com.sun.xml.ws.server.ServerSchemaValidationTube.<init>(ServerSchemaValidationT
at com.sun.xml.ws.api.pipe.ServerTubeAssemblerContext.createValidationTube(ServerT
at com.sun.xml.ws.assembler.jaxws.ValidationTubeFactory.createTube(ValidationTubeF
at com.sun.xml.ws.assembler.TubeCreator.createTube(TubeCreator.java:96)
at com.sun.xml.ws.assembler.MetroTubelineAssembler.createServer(MetroTubelineAssem
at com.sun.xml.ws.server.WSEndpointImpl.<init>(WSEndpointImpl.java:193)
at com.sun.xml.ws.server.EndpointFactory.create(EndpointFactory.java:337)
at com.sun.xml.ws.server.EndpointFactory.create(EndpointFactory.java:332)
at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:164)
at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:577)
at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:560)
at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parseAdapters(Deployme
at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parse(DeploymentDescri
at
com.sun.xml.ws.transport.http.servlet.WSServletContextListener.parseAdaptersAndCreateDeleg
at com.sun.xml.ws.transport.http.servlet.WSServletContainerInitializer.onStartup(W
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:517
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.StandardContext.reload(StandardContext.java:3755)
at org.apache.catalina.loader.WebappLoader.backgroundProcess(WebappLoader.java:292
at org.apache.catalina.core.StandardContext.backgroundProcess(StandardContext.java
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChil
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChil
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChil
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(Contain
at java.lang.Thread.run(Thread.java:745)
Dez 22, 2015 4:29:39 PM org.apache.catalina.core.StandardContext startInternal
SCHWERWIEGEND: Error during ServletContainerInitializer processing
javax.servlet.ServletException: com.sun.xml.ws.transport.http.servlet.WSServletException:
nicht geparst werden: java.lang.NullPointerException
at com.sun.xml.ws.transport.http.servlet.WSServletContainerInitializer.onStartup(W
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:517
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.StandardContext.reload(StandardContext.java:3755)
at org.apache.catalina.loader.WebappLoader.backgroundProcess(WebappLoader.java:292
at org.apache.catalina.core.StandardContext.backgroundProcess(StandardContext.java
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChil
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChil
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChil
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(Contain
at java.lang.Thread.run(Thread.java:745)
Caused by: com.sun.xml.ws.transport.http.servlet.WSServletException: WSSERVLET11: Laufzeit
werden: java.lang.NullPointerException
at
com.sun.xml.ws.transport.http.servlet.WSServletContextListener.parseAdaptersAndCreateDeleg
at com.sun.xml.ws.transport.http.servlet.WSServletContainerInitializer.onStartup(W
... 10 more
Caused by: java.lang.NullPointerException
at com.sun.xml.ws.util.pipe.AbstractSchemaValidationTube.createMasterPseudoSchema(
at com.sun.xml.ws.util.pipe.AbstractSchemaValidationTube.getSchemaSources(Abstract
at com.sun.xml.ws.server.ServerSchemaValidationTube.<init>(ServerSchemaValidationT
at com.sun.xml.ws.api.pipe.ServerTubeAssemblerContext.createValidationTube(ServerT
at com.sun.xml.ws.assembler.jaxws.ValidationTubeFactory.createTube(ValidationTubeF
at com.sun.xml.ws.assembler.TubeCreator.createTube(TubeCreator.java:96)
at com.sun.xml.ws.assembler.MetroTubelineAssembler.createServer(MetroTubelineAssem
at com.sun.xml.ws.server.WSEndpointImpl.<init>(WSEndpointImpl.java:193)
at com.sun.xml.ws.server.EndpointFactory.create(EndpointFactory.java:337)
at com.sun.xml.ws.server.EndpointFactory.create(EndpointFactory.java:332)
at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:164)
at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:577)
at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:560)
at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parseAdapters(Deployme
at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parse(DeploymentDescri
at
com.sun.xml.ws.transport.http.servlet.WSServletContextListener.parseAdaptersAndCreateDeleg
... 11 more
Comments
Comment by lukedirtwalker [ 21/Jan/16 ]
I think the actual root problem is on line 329 if tns is null we insert the null object in the map,
I'm not sure if that is intended?
Generated at Wed Apr 05 10:59:17 UTC 2017 using JIRA 6.2.3#6260sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.
Herunterladen