Add a branch in processXmlRpcResponse() to convert a Map to a Hashtable.
Use ...else if... rather then separate if statements for mutually exclusive conditions in processXmlRpcResponse().
This commit is contained in:
parent
4245d6d08f
commit
37d086d5f3
1 changed files with 7 additions and 6 deletions
|
@ -504,6 +504,7 @@ public final class RhinoCore {
|
|||
* convert a JavaScript Object object to a generic Java object stucture.
|
||||
*/
|
||||
public Object processXmlRpcResponse (Object what) throws Exception {
|
||||
// unwrap if argument is a Wrapper
|
||||
if (what instanceof Wrapper) {
|
||||
what = ((Wrapper) what).unwrap();
|
||||
}
|
||||
|
@ -521,8 +522,7 @@ public final class RhinoCore {
|
|||
}
|
||||
}
|
||||
what = ht;
|
||||
}
|
||||
if (what instanceof NativeArray) {
|
||||
} else if (what instanceof NativeArray) {
|
||||
NativeArray na = (NativeArray) what;
|
||||
Number n = (Number) na.get("length", na);
|
||||
int l = n.intValue();
|
||||
|
@ -531,16 +531,17 @@ public final class RhinoCore {
|
|||
retval.add(i, processXmlRpcResponse(na.get(i, na)));
|
||||
}
|
||||
what = retval;
|
||||
}
|
||||
if (what instanceof Number) {
|
||||
} else if (what instanceof Map) {
|
||||
Map map = (Map) what;
|
||||
what = new Hashtable(map);
|
||||
} else if (what instanceof Number) {
|
||||
Number n = (Number) what;
|
||||
if (what instanceof Float || what instanceof Long) {
|
||||
what = new Double(n.doubleValue());
|
||||
} else if (!(what instanceof Double)) {
|
||||
what = new Integer(n.intValue());
|
||||
}
|
||||
}
|
||||
if (what instanceof Scriptable) {
|
||||
} else if (what instanceof Scriptable) {
|
||||
Scriptable s = (Scriptable) what;
|
||||
if ("Date".equals(s.getClassName())) {
|
||||
what = new Date((long) ScriptRuntime.toNumber(s));
|
||||
|
|
Loading…
Add table
Reference in a new issue