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:
hns 2004-02-18 11:42:47 +00:00
parent 4245d6d08f
commit 37d086d5f3

View file

@ -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));