Details
Description
When a WSDL specifies an incorrect namespace for a imported WSDL, code generation throws a nondescript NPE. The call stack and a test case follow.
org.apache.maven.lifecycle.LifecycleExecutionException: java.lang.NullPointerException
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:564)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:480)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:459)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:334)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:280)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: java.lang.NullPointerException
at org.apache.cxf.maven_plugin.WSDL2JavaMojo.processWsdl(WSDL2JavaMojo.java:348)
at org.apache.cxf.maven_plugin.WSDL2JavaMojo.execute(WSDL2JavaMojo.java:223)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:443)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
... 16 more
Caused by: org.apache.cxf.tools.common.ToolException: java.lang.NullPointerException
at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:240)
at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:83)
at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:103)
at org.apache.cxf.maven_plugin.WSDL2JavaMojo.processWsdl(WSDL2JavaMojo.java:344)
... 19 more
Caused by: java.lang.NullPointerException
at org.apache.cxf.tools.validator.internal.WSDLRefValidator.getXNode(WSDLRefValidator.java:305)
at org.apache.cxf.tools.validator.internal.WSDLRefValidator.collectValidationPointsForBindings(WSDLRefValidator.java:398)
at org.apache.cxf.tools.validator.internal.WSDLRefValidator.collectValidationPoints(WSDLRefValidator.java:383)
at org.apache.cxf.tools.validator.internal.WSDLRefValidator.isValid(WSDLRefValidator.java:214)
at org.apache.cxf.tools.validator.internal.WSDL11Validator.isValid(WSDL11Validator.java:126)
at org.apache.cxf.tools.wsdlto.frontend.jaxws.wsdl11.JAXWSDefinitionBuilder.validate(JAXWSDefinitionBuilder.java:200)
at org.apache.cxf.tools.wsdlto.frontend.jaxws.wsdl11.JAXWSDefinitionBuilder.validate(JAXWSDefinitionBuilder.java:62)
at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:132)
at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:232)
... 22 more
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" name="Parent">
<wsdl:import namespace="http://incorrect-namespace" location="child.wsdl" />
</wsdl:definitions>
<wsdl:definitions name="Child"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://child/"
xmlns:xsd="http://child/xsd"
targetNamespace="http://child/">
<wsdl:types>
<xs:schema targetNamespace="http://child/xsd">
<xs:element name="Message">
<xs:complexType>
<xs:sequence/>
</xs:complexType>
</xs:element>
</xs:schema>
</wsdl:types>
<wsdl:message name="Message">
<wsdl:part name="msg" element="xsd:Message"/>
</wsdl:message>
<wsdl:portType name="PortType">
<wsdl:operation name="Operation">
<wsdl:input message="tns:Message"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="Binding" type="tns:PortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="Operation">
<soap:operation style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="Service">
<wsdl:port name="Port" binding="tns:Binding">
<soap:address location="http://localhost/service" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>