You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Jose Antonio (JIRA)" <ji...@apache.org> on 2007/09/05 16:15:34 UTC
[jira] Commented: (AXIS2-3028) Generated ADBBean: Issue with
getPullParser() method for optional attributes
[ https://issues.apache.org/jira/browse/AXIS2-3028?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12525107 ]
Jose Antonio commented on AXIS2-3028:
-------------------------------------
It's not solved. Using Axis2 1.3 final with a schema with optional attributes I get the same error.
For the elements I get something like:
if (localContextManagerTracker) {
elementList.add(new javax.xml.namespace.QName(
"http://docs.oasis-open.org/ws-caf/2005/10/wsctx",
"context-manager"));
if (localContextManager == null) {
throw new org.apache.axis2.databinding.ADBException(
"context-manager cannot be null!!");
}
elementList.add(localContextManager);
}
}
but for attributes I get:
attribList.add(new javax.xml.namespace.QName("", "expiresAt"));
attribList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
localExpiresAt));
and convertToString fails with NullPointerException. Note that expiresAt attribute is marked as optional in the original schema, so I think it should have something like:
if (localExpiresAt) {
attribList.add(new javax.xml.namespace.QName("", "expiresAt"));
attribList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(
localExpiresAt));
}
for optional attributes.
> Generated ADBBean: Issue with getPullParser() method for optional attributes
> ----------------------------------------------------------------------------
>
> Key: AXIS2-3028
> URL: https://issues.apache.org/jira/browse/AXIS2-3028
> Project: Axis 2.0 (Axis2)
> Issue Type: Bug
> Components: codegen
> Affects Versions: 1.2
> Reporter: Tobias Jordan
> Assignee: Amila Chinthaka Suriarachchi
>
> A complexType in my XSD file contains a optional attribute. For example:
> <xs:complexType name="foo_T">
> <xs:attribute use="optional" name="bla" type="bla_T">
> </xs:complexType>
> The generated ADBBean class Foo_T.java has the following code part in the getPullParser() method:
> attribList.add(new javax.xml.namespace.QName("", "bla"));
> attribList.add(localBla.toString());
> And here comes the issue:
> I wrote a custom handler to print the SOAP messages to stdout:
> SOAPEnvelope env = msgContext.getEnvelope();
> System.out.println(env.toString());
> For messages containing an optional attribute as described above, the toString() call on the SOAP envelope results in a NullPointerException. The NullPointer occurs because toString() ends up in the getPullParser() method and the localBla variable isn't set (since it is optional!).
> So I guess there is a missing check against null in the generated code.
--
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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org