[
https://issues.apache.org/jira/browse/XMLRPC-154?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13054448#comment-13054448
]
Dmitry Katsubo commented on XMLRPC-154:
---------------------------------------
Michael, Jochen,
I have got the same problem when communicating with Perl XMLRPC::Lite server.
This post (http://tech.dir.groups.yahoo.com/group/soaplite/message/1326) tells
that the problem is in XMLRPC::Lite module, there is even a patch for that
(http://forums.sixapart.com/index.php?showtopic=12363#entry59257).
But what specification do you refer to?
I have found the following:
http://www.w3.org/TR/2000/NOTE-SOAP-20000508/#_Toc478383510
which says "However, instead of integers, they are defined as XML qualified
names" and gives an example "Client.Authentication".
In my case the server returns faultCode="Client", which is string and
corresponds to above mentioned spec.
Another spec (http://www.xmlrpc.com/spec#faults) does not strictly that the
type of "faultCode" is int: it provided the example with int value.
I also believe there is a minor bug in XmlRpcResponseParser.java code:
faultCode.intValue() never throws NumberFormatException. The code should be
adapted like below (will not throw ClassCastException but more reasonable
SAXParseException):
=== cut ===
--- XmlRpcResponseParser.java.orig 2011-06-24 14:35:39.391077200 +0200
+++ XmlRpcResponseParser.java 2011-06-24 15:15:18.312552200 +0200
@@ -58,12 +58,12 @@
super.setResult(pResult);
} else {
Map map = (Map) pResult;
- Integer faultCode = (Integer) map.get("faultCode");
+ String faultCode = (String) map.get("faultCode");
if (faultCode == null) {
throw new SAXParseException("Missing
faultCode", getDocumentLocator());
}
try {
- errorCode = faultCode.intValue();
+ errorCode = Integer.valueOf(faultCode);
} catch (NumberFormatException e) {
throw new SAXParseException("Invalid faultCode:
" + faultCode,
getDocumentLocator());
=== cut ===
> ClassCastException getting faultCode in XmlResponseParser.addResult
> -------------------------------------------------------------------
>
> Key: XMLRPC-154
> URL: https://issues.apache.org/jira/browse/XMLRPC-154
> Project: XML-RPC
> Issue Type: Bug
> Components: Source
> Affects Versions: 3.1
> Environment: Windows server 2003
> Reporter: Wes
>
> In 3.1 XmlRpcResponseParser.addResult(Object), the following unguarded code
> throws a ClassCastException:
> Integer faultCode = (Integer) map.get("faultCode");
> The server (in this case Bugzilla::WebService::Bug::get_bugs.pm) might be
> using the wrong type (String) for faultCode , but this exception hides the
> true error being reported so it would be nice if the code were guarded.
> I'm using binaries from xmlrpc-3.1-bin.tar.gz.
> (As an aside, I can't figure out what Object[] to send to get_bugs: neither
> Integer nor String works.)
> java.lang.ClassCastException: java.lang.String incompatible with
> java.lang.Integer
> at
> org.apache.xmlrpc.parser.XmlRpcResponseParser.addResult(XmlRpcResponseParser.java:58)
> at
> org.apache.xmlrpc.parser.RecursiveTypeParserImpl.endValueTag(RecursiveTypeParserImpl.java:71)
> at
> org.apache.xmlrpc.parser.XmlRpcResponseParser.endElement(XmlRpcResponseParser.java:183)
> at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown
> Source)
> at
> org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
> at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
> Source)
> at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
> Source)
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
> at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
> at
> org.apache.xmlrpc.client.XmlRpcStreamTransport.readResponse(XmlRpcStreamTransport.java:175)
> at
> org.apache.xmlrpc.client.XmlRpcStreamTransport.sendRequest(XmlRpcStreamTransport.java:145)
> at
> org.apache.xmlrpc.client.XmlRpcHttpTransport.sendRequest(XmlRpcHttpTransport.java:94)
> at
> org.apache.xmlrpc.client.XmlRpcSunHttpTransport.sendRequest(XmlRpcSunHttpTransport.java:44)
> at
> org.apache.xmlrpc.client.XmlRpcClientWorker.execute(XmlRpcClientWorker.java:53)
> at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:166)
> at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:136)
> at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:125)
> Thanks,
> Wes
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]