NullPointerException during codegen when using JaxB RI databinding
------------------------------------------------------------------

                 Key: AXIS2-3634
                 URL: https://issues.apache.org/jira/browse/AXIS2-3634
             Project: Axis 2.0 (Axis2)
          Issue Type: Bug
          Components: codegen
    Affects Versions: 1.3, 1.4
         Environment: Windows XP, Java 6
            Reporter: Aaron Gourley


I was able to get around the following exception by replacing 
org.apache.axis2.jaxbri.CodeGenerationUtility line 125 of Axis2 1.4 RC1 as 
follows (in anonymous EntityResolver.resolveEntity())

Replace this: if (key.getTargetNamespace().equals(publicId)) {
With this: if (key.getTargetNamespace() != null && 
key.getTargetNamespace().equals(publicId)) {

Additionally, I'm not sure if it would be acceptable to skip the for loop all 
together if publicId is null.

The exception that I encountered was:
Exception in thread "main" 
org.apache.axis2.wsdl.codegen.CodeGenerationException: 
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
  at 
org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:271)
  at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35)
  at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)
Caused by: java.lang.RuntimeException: 
java.lang.reflect.InvocationTargetException
  at 
org.apache.axis2.wsdl.codegen.extension.JAXBRIExtension.engage(JAXBRIExtension.java:112)
  at 
org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:224)
  ... 2 more
Caused by: java.lang.reflect.InvocationTargetException
  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.apache.axis2.wsdl.codegen.extension.JAXBRIExtension.engage(JAXBRIExtension.java:101)
  ... 3 more
Caused by: java.lang.RuntimeException: java.lang.NullPointerException
  at 
org.apache.axis2.jaxbri.CodeGenerationUtility.processSchemas(CodeGenerationUtility.java:307)
  ... 8 more
Caused by: java.lang.NullPointerException
  at 
org.apache.axis2.jaxbri.CodeGenerationUtility$1.resolveEntity(CodeGenerationUtility.java:125)
  at com.sun.tools.xjc.reader.internalizer.DOMForest.parse(DOMForest.java:296)
  at 
com.sun.tools.xjc.reader.internalizer.AbstractReferenceFinderImpl.startElement(AbstractReferenceFinderImpl.java:95)
  at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
  at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown 
Source)
  at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown 
Source)
  at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
 Source)
  at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown 
Source)
  at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
  at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
  at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
  at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
  at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
  at com.sun.tools.xjc.reader.internalizer.DOMForest.parse(DOMForest.java:394)
  at com.sun.tools.xjc.reader.internalizer.DOMForest.parse(DOMForest.java:274)
  at 
com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.parseSchema(SchemaCompilerImpl.java:148)
  at 
org.apache.axis2.jaxbri.CodeGenerationUtility.processSchemas(CodeGenerationUtility.java:193)
  ... 8 more

I will attach a WSDL that exploits this issue and the WSDL2Java parameters used.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to