[ 
https://issues.apache.org/jira/browse/AXIS2-4285?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Amila Chinthaka Suriarachchi resolved AXIS2-4285.
-------------------------------------------------

    Resolution: Fixed

please try with a nightly build. this issue should fix with the 

xmlStreamReader.getElementText(); since it moves the reader to end element.

if you see this problem in nightly builds please reopen the issue with your 
wsdl.

> CLONE -wrong codegen for anytype
> --------------------------------
>
>                 Key: AXIS2-4285
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4285
>             Project: Axis2
>          Issue Type: Bug
>          Components: codegen
>    Affects Versions: 1.4.1
>            Reporter: Frank Kuepper
>            Assignee: Amila Chinthaka Suriarachchi
>
> I'm referring to issue AXIS-3331.  The original opener, Yuval, noticed:
> =========================================================================================
> The joy was premature.
> On the following return:
> <RetrievePropertiesResponse xmlns="urn:vim2">
>   <returnval>
>     <obj type="Task">task-173</obj>
>     <propSet>
>       <name>info.progress</name>
>       <val xsi:type="xsd:int">20</val>
>     </propSet>
>     <propSet>
>       <name>info.state</name>
>       <val xsi:type="TaskInfoState">running</val>
>     </propSet>
>   </returnval>
> </RetrievePropertiesResponse>
> propSet is an array of type DynamicProperty, which is defined as:
>          <complexType name="DynamicProperty">
>             <sequence>
>                <element name="name" type="xsd:string" />
>                <element name="val" type="xsd:anyType" />
>             </sequence>
>          </complexType>
> The generated code for reading "val" in DynamicProperty contains:
>                     
> object.setVal(org.apache.axis2.databinding.utils.ConverterUtil.getAnyTypeObject(reader,
>     com.vmware.vim2.ExtensionMapper.class));
> reader.next();
> The problem is caused by the convention that parsing an object leaves the 
> XmlStreamReader iterator on the closing tag. getAnyTypeObject when "val" is 
> "xsd:int" leaves the reader on CHARACTERS and not on the "</val>" closing 
> tag. This is in conflict with what would happen for a complex type.
> The next code that is executed is:
>    while (!reader.isStartElement() && !reader.isEndElement())
>       reader.next();
> Which excpects to reach the closing tag "</propSet>", but it actually arrives 
> "</val>". It would return from parsing "propSet" while on "</val>" and next 
> code will fail.
> I have fixed it on my code by adding:
>                     while (!xmlStreamReader.isStartElement() && 
> !xmlStreamReader.isEndElement())
>                         xmlStreamReader.next();
> In ConverterUtils.getAnyTypeObject() the end of the true block of the 
> (attributeNameSpace.equals(Constants.XSD_NAMESPACE)) check. I don't know if 
> it is correct.
> =========================================================================================
> After that, Amila noticed, it had been fixed and the issue was resolved.
> But I can reproduce the issue in Axis2 1.4.1. Inspecting the sources showed 
> me, that neither the fix proposed by Yuval nor any other
> fix addressing the problem has been included.

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