[ http://issues.apache.org/jira/browse/AXIS2-987?page=all ]

Davanum Srinivas resolved AXIS2-987.
------------------------------------

    Resolution: Fixed

Sorry about that. Applied again in  r431362.

-- dims

> NullPointerException when using reference on XmlSchemaElement from imported 
> schema
> ----------------------------------------------------------------------------------
>
>                 Key: AXIS2-987
>                 URL: http://issues.apache.org/jira/browse/AXIS2-987
>             Project: Apache Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: wsdl
>            Reporter: Fabian Christ
>         Attachments: sample-wsdl.zip, SchemaCompiler.patch.txt
>
>
> You have the following situation:
> A WSDL file uses X.xsd for types and X.xsd imports Y.xsd. Now an element of 
> X.xsd references an element of the imported Y.xsd.
> At this point the SchemaCompiler crashes with a NullPointerException when 
> trying to handle the referenced element.
> 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:235)
>       at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:32)
>       at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:21)
> Caused by: java.lang.RuntimeException: 
> java.lang.reflect.InvocationTargetException
>       at 
> org.apache.axis2.wsdl.codegen.extension.SimpleDBExtension.engage(SimpleDBExtension.java:52)
>       at 
> org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:188)
>       ... 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:585)
>       at 
> org.apache.axis2.wsdl.codegen.extension.SimpleDBExtension.engage(SimpleDBExtension.java:49)
>       ... 3 more
> Caused by: org.apache.axis2.schema.SchemaCompilationException: 
> java.lang.NullPointerException
>       at 
> org.apache.axis2.schema.SchemaCompiler.compile(SchemaCompiler.java:230)
>       at 
> org.apache.axis2.schema.ExtensionUtility.invoke(ExtensionUtility.java:77)
>       ... 8 more
> Caused by: java.lang.NullPointerException
>       at 
> org.apache.axis2.schema.SchemaCompiler.process(SchemaCompiler.java:1218)
>       at 
> org.apache.axis2.schema.SchemaCompiler.processParticle(SchemaCompiler.java:1128)
>       at 
> org.apache.axis2.schema.SchemaCompiler.processComplexType(SchemaCompiler.java:798)
>       at 
> org.apache.axis2.schema.SchemaCompiler.processNamedComplexSchemaType(SchemaCompiler.java:769)
>       at 
> org.apache.axis2.schema.SchemaCompiler.processSchema(SchemaCompiler.java:725)
>       at 
> org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.java:466)
>       at 
> org.apache.axis2.schema.SchemaCompiler.processElement(SchemaCompiler.java:437)
>       at 
> org.apache.axis2.schema.SchemaCompiler.compile(SchemaCompiler.java:299)
>       at 
> org.apache.axis2.schema.SchemaCompiler.compile(SchemaCompiler.java:281)
>       at 
> org.apache.axis2.schema.SchemaCompiler.compile(SchemaCompiler.java:221)
>       ... 9 more
> This happens because in 
> org.apache.axis2.schema.SchemaCompiler.process(XmlSchemaObjectCollection, 
> BeanWriterMetaInfoHolder, boolean, XmlSchema) the referenced element is 
> handled by
>                 }else{ //probably this is referenced
>                     referencedQName = elt.getRefName();
>                     boolean arrayStatus = ((Boolean) 
> processedElementArrayStatusMap.get(elt)).booleanValue();
>                     clazzName = findRefClassName(referencedQName,arrayStatus);
>                     metainfHolder.registerMapping(referencedQName,
>                             
> parentSchema.getElementByName(referencedQName).getSchemaTypeName()
>                             , clazzName,
>                             arrayStatus ?
>                                     SchemaConstants.ARRAY_TYPE :
>                                     SchemaConstants.ELEMENT_TYPE);
>                 }
> but at this point the function parentSchema.getElementByName(referencedQName) 
> returns null. The referenced element is not found in the 
> parentSchema.elements. So the conclusion is that elements from imported 
> schemas are not correct imported in the parentSchema object.

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

        

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

Reply via email to