[jira] [Closed] (AXIS2-5575) ConverterUtil.convertToToken method can't handle String value with trailing spaces

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Closed] (AXIS2-5575) ConverterUtil.convertToToken method can't handle String value with trailing spaces

Adam Fordham (Jira)

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

Robert Lazarski closed AXIS2-5575.
----------------------------------
    Resolution: Fixed

> ConverterUtil.convertToToken method can't handle String value with trailing spaces
> ----------------------------------------------------------------------------------
>
>                 Key: AXIS2-5575
>                 URL: https://issues.apache.org/jira/browse/AXIS2-5575
>             Project: Axis2
>          Issue Type: Bug
>          Components: databinding
>    Affects Versions: 1.6.2
>         Environment: Windows 7
>            Reporter: Gogon
>            Priority: Minor
>              Labels: ConverterUtil, databinding, token, wsdl2java
>
> I used wsdl2java.bat to generate client class from wsdl and xsd. The xsd contains token type elements.
> In my application, I used the client class to call the webservice and I got this error:
> org.apache.axis2.AxisFault: data=[ENG ]
> at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
> at com.example.MyWebServiceStub.fromOM(MyWebServiceStub.java:22807)
> ...
> Caused by: java.lang.IllegalArgumentException: data=[ENG ]
> at org.apache.axis2.databinding.types.Token.<init>(Token.java:47)
> at org.apache.axis2.databinding.utils.ConverterUtil.convertToToken(ConverterUtil.java:643)
> at com.example.MyWebServiceStub$Transaction$Factory.parse(MyWebServiceStub.java:9795)
> ...
> The error is in this line inside the MyWebServiceStub.java:
> object.setSecurityCode(org.apache.axis2.databinding.utils.ConverterUtil.convertToToken(content));
> The element value retrieved from webservice contains String value with trailing spaces ("ENG "). What I can understand is the class tried to convert the String value to Token for generating response, but since Token doesn't accept trailing spaces so that's why it throws error.
> Meanwhile, to fix this problem, I added trim() to the code:
> object.setSecurityCode(org.apache.axis2.databinding.utils.ConverterUtil.convertToToken(content.trim()));



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]