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 "Tobias Jordan (JIRA)" <ji...@apache.org> on 2007/07/27 21:58:53 UTC

[jira] Created: (AXIS2-3028) Generated ADBBean: Issue with getPullParser() method 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


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


[jira] Commented: (AXIS2-3028) Generated ADBBean: Issue with getPullParser() method for optional attributes

Posted by "Jose Antonio (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-3028?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12525772 ] 

Jose Antonio commented on AXIS2-3028:
-------------------------------------

Well, that would work if it weren't because of this bug:

https://issues.apache.org/jira/browse/AXIS2-3184

Anyway, using OMElement as an intermediary object does not solve the problem. getPullParser() method still does not respect the optional attributes so I suggest to reopen this bug if you wish and if that method is not going to be deprecated for the 1.4 version.

> 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


[jira] Commented: (AXIS2-3028) Generated ADBBean: Issue with getPullParser() method for optional attributes

Posted by "Amila Chinthaka Suriarachchi (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-3028?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12516284 ] 

Amila Chinthaka Suriarachchi commented on AXIS2-3028:
-----------------------------------------------------

please check with a nightly build (take a latest from branch). now ADB does not use the getPullparser method. 


> 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


[jira] Commented: (AXIS2-3028) Generated ADBBean: Issue with getPullParser() method for optional attributes

Posted by "Jose Antonio (JIRA)" <ji...@apache.org>.
    [ 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


[jira] Commented: (AXIS2-3028) Generated ADBBean: Issue with getPullParser() method for optional attributes

Posted by "Amila Chinthaka Suriarachchi (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-3028?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12525283 ] 

Amila Chinthaka Suriarachchi commented on AXIS2-3028:
-----------------------------------------------------

can you send the full stack trace if there is a NullPointerException. It can not call for the getPullParser method.

> 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


[jira] Resolved: (AXIS2-3028) Generated ADBBean: Issue with getPullParser() method for optional attributes

Posted by "Deepal Jayasinghe (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-3028?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Deepal Jayasinghe resolved AXIS2-3028.
--------------------------------------

    Resolution: Fixed

seems like issue is fixed.
About the release : We are planing on this week.

Thanks
Deepal

> 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


[jira] Commented: (AXIS2-3028) Generated ADBBean: Issue with getPullParser() method for optional attributes

Posted by "Jose Antonio (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-3028?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12525362 ] 

Jose Antonio commented on AXIS2-3028:
-------------------------------------

It's not called automatically. I call it myself because I need to parse an ADB object A to an ADB object B so I have to call

B.Factory.parse(A.getPullParser(B.name))

A has some optional attributes which are not set, expiresAt among them and it fails because when getPullParser is called its value is null, which is correct as it's optional but the code doesn't treat it as optional.

> 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


[jira] Assigned: (AXIS2-3028) Generated ADBBean: Issue with getPullParser() method for optional attributes

Posted by "Deepal Jayasinghe (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-3028?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Deepal Jayasinghe reassigned AXIS2-3028:
----------------------------------------

    Assignee: Amila Chinthaka Suriarachchi

> 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


[jira] Closed: (AXIS2-3028) Generated ADBBean: Issue with getPullParser() method for optional attributes

Posted by "Tobias Jordan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-3028?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tobias Jordan closed AXIS2-3028.
--------------------------------


Ok. Thanks!

> 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


[jira] Commented: (AXIS2-3028) Generated ADBBean: Issue with getPullParser() method for optional attributes

Posted by "Tobias Jordan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-3028?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12516332 ] 

Tobias Jordan commented on AXIS2-3028:
--------------------------------------

Ok. I checked it with the lastest build and it works. Thanks. Have you just fixed it? Because I tried the 1.3 RC2 too and there was the same issue.

Do you already know, when the 1.3 release will be officially released?

> 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


[jira] Commented: (AXIS2-3028) Generated ADBBean: Issue with getPullParser() method for optional attributes

Posted by "Amila Chinthaka Suriarachchi (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-3028?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12525619 ] 

Amila Chinthaka Suriarachchi commented on AXIS2-3028:
-----------------------------------------------------

use getOMElement().getXMLStreamReader() to get the xml stream reader.

you can pass the OMAbstractFactory.getOMFactory() to pass the factory to getOMElement method.

> 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