Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Duplicate
-
3.0b1
-
None
-
None
Description
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]))
}
if (matching) {
for (int j = 0; j < args.length; j++)
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!
Attachments
Issue Links
- duplicates
-
XMLRPC-94 ReflectiveXmlRpcHandler.execute fails to properly lookup method
- Closed