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 "Gogon (JIRA)" <ji...@apache.org> on 2013/05/18 06:25:15 UTC
[jira] [Created] (AXIS2-5575) ConverterUtil.convertToToken method
can't handle String value with trailing spaces
Gogon created AXIS2-5575:
----------------------------
Summary: 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
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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org