NullPointerException in XMLbeans code generation with xmime:contentType
-----------------------------------------------------------------------

         Key: AXIS2-774
         URL: http://issues.apache.org/jira/browse/AXIS2-774
     Project: Apache Axis 2.0 (Axis2)
        Type: Bug

  Components: databinding  
    Versions: 1.0    
    Reporter: Kent Tong


In the org.apache.axis2.xmlbeans.CodeGenerationUtility class, the 
findBase64Types() method (as shown below) contains a bug: It is calling 
getDocumentElementName() on the outer type but this method works on the 
"document type" only, otherwise it will return null:

            if (sType.getContentType() == SchemaType.SIMPLE_CONTENT && 
sType.getPrimitiveType() != null) {
                if 
(Constants.BASE_64_CONTENT_QNAME.equals(sType.getPrimitiveType().getName())) {
                    outerType = sType.getOuterType();
                    //check the outer type further to see whether it has the 
contenttype attribute from
                    //XMime namespace
                    SchemaProperty[] properties = sType.getProperties();
                    for (int j = 0; j < properties.length; j++) {
                        if 
(Constants.XMIME_CONTENT_TYPE_QNAME.equals(properties[j].getName())) {
                            
base64ElementQNamesList.add(outerType.getDocumentElementName());
                            break;
                        }
                    }
                }
            }

The result is, the base64 qname list will only contain null's as its elements. 
This will later cause the 
AxisServiceBasedMultiLanguageEmitter.getBase64Elements() to fail. The stack 
trace is:
     [java] Caused by: java.lang.NullPointerException
     [java]     at 
org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.getBase64Elements(AxisServiceBasedMultiLanguageEmitter.java:972)
     [java]     at 
org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.createDOMElementforDatabinders(AxisServiceBasedMultiLanguageEmitte
r.java:931)
     [java]     at 
org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.createDocumentForMessageReceiver(AxisServiceBasedMultiLanguageEmit
ter.java:849)
     [java]     at 
org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.writeMessageReceiver(AxisServiceBasedMultiLanguageEmitter.java:796
)
     [java]     at 
org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.emitSkeletonService(AxisServiceBasedMultiLanguageEmitter.java:693)
     [java]     at 
org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.emitSkeleton(AxisServiceBasedMultiLanguageEmitter.java:638)



-- 
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