NullPointerException processing schema
--------------------------------------

                 Key: WSCOMMONS-533
                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-533
             Project: WS-Commons
          Issue Type: Bug
    Affects Versions: XmlSchema 1.4.5
            Reporter: Brian McDonald


When processing a imported schema without a targetnamespace (where the import 
had a namespace defined) you hit this exception:

[] java.lang.RuntimeException: java.lang.NullPointerException
[]      at 
org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1907)
[]      at 
org.apache.ws.commons.schema.SchemaBuilder.handleImport(SchemaBuilder.java:1615)
[]      at 
org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:224)
[]      at 
org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:505)
[]      at 
com.itko.lisa.ws.nx.WSDLSchemaUtils.processTypes(WSDLSchemaUtils.java:2142)
[]      at 
com.itko.lisa.ws.nx.WSDLSchemaUtils.processWsdlDefsForSchemas(WSDLSchemaUtils.java:2092)
[]      at 
com.itko.lisa.ws.nx.WSDLSchemaUtils.processWsdlSchema(WSDLSchemaUtils.java:2081)
[]      at 
com.itko.lisa.ws.nx.WSDLSchemaUtils.processWsdlSchema(WSDLSchemaUtils.java:2060)
[]      at 
com.itko.lisa.ws.nx.ui.NxWSStepEditor.processNewWSDL(NxWSStepEditor.java:433)
[]      at 
com.itko.lisa.ws.nx.ui.ConnectionInfoEditor$30.run(ConnectionInfoEditor.java:940)
[] Caused by: java.lang.NullPointerException
[]      at 
org.apache.ws.commons.schema.SchemaBuilder$1.validate(SchemaBuilder.java:1602)
[]      at 
org.apache.ws.commons.schema.SchemaBuilder.setNamespaceAttributes(SchemaBuilder.java:369)
[]      at 
org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:134)
[]      at 
org.apache.ws.commons.schema.SchemaBuilder.build(SchemaBuilder.java:121)
[]      at 
org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:491)
[]      at 
org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:364)
[]      at 
org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1901)
[]      ... 9 more


It is caused by this line in SchemaBuilder:

                                if (isEmpty(uri)) {
                                        valid = 
isEmpty(pSchema.syntacticalTargetNamespace);
                                } else {
                                        valid = 
pSchema.syntacticalTargetNamespace.equals(uri); // <=====
                                }

Simply inverting the equals will solve the problem

                                        valid = 
uri.equals(pSchema.syntacticalTargetNamespace); // <=====


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to