Serious problem with method selection in ReflectiveXmlRpcHandler
----------------------------------------------------------------
Key: XMLRPC-98
URL: http://issues.apache.org/jira/browse/XMLRPC-98
Project: XML-RPC
Issue Type: Bug
Components: Source
Affects Versions: 3.0b1
Reporter: Aleksey Gureev
Priority: Critical
There's a trouble with loop indexes in the code preventing normal selection of
methods to execute. Please examine this code:
---
for (int i = 0; i < methods.length; i++) {
MethodData methodData = methods[i];
TypeConverter[] converters = methodData.typeConverters;
if (args.length == converters.length) {
boolean matching = true;
for (int j = 0; j < args.length; j++) {
if (!converters[j].isConvertable(args[i])) {
matching = false;
break;
}
}
if (matching) {
for (int j = 0; j < args.length; j++) {
args[i] = converters[i].convert(args[i]);
}
return invoke(instance, methodData.method, args);
}
}
}
---
It should be (insignificant parts skipped):
---
for (int i = 0; i < methods.length; i++) {
...
if (!converters[j].isConvertable(args[j])) {
...
args[j] = converters[j].convert(args[j]);
...
}
---
Please notice the change in indexes:
* in isConvertable() call it's 'j' as we loop through args
* in the line with convert() call there are three 'j' instead of three 'i'
Frankly speaking, such mistakes look very scary. I'm moving our server from
xmlrpc-1.2 to 3.0 and this makes me think and think if it's worth the effort
even though the version 1.2 has a terrible bug with exception handling and
threads leak. Sorry for telling this.
Anyway, keep up good work and thanks for a good open-source project!
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
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]