what = new Hashtable(map);
Hashtable ht = new Hashtable(map.size()*2); for (Iterator it=map.entrySet().iterator(); it.hasNext();) { Map.Entry entry = (Map.Entry) it.next(); ht.put(entry.getKey().toString(), processXmlRpcResponse(entry.getValue())); } what = ht;
    public Object processXmlRpcResponse (Object what) throws Exception {        // unwrap if argument is a Wrapper        if (what instanceof Wrapper) {            what = ((Wrapper) what).unwrap();        }        if (what instanceof NativeObject) {            NativeObject no = (NativeObject) what;            Object[] ids = no.getIds();            Hashtable ht = new Hashtable(ids.length);            for (int i=0; i<ids.length; i++) {                if (ids[i] instanceof String) {                    String key = (String) ids[i];                    Object o = no.get(key, no);                    if (o != null) {                        ht.put(key, processXmlRpcResponse(o));                    }                }            }            what = ht;        } else if (what instanceof NativeArray) {            NativeArray na = (NativeArray) what;            Number n = (Number) na.get("length", na);            int l = n.intValue();            Vector retval = new Vector(l);            for (int i=0; i<l; i++) {                retval.add(i, processXmlRpcResponse(na.get(i, na)));            }            what = retval;        } 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());            }        } else if (what instanceof Scriptable) {            Scriptable s = (Scriptable) what;            if ("Date".equals(s.getClassName())) {                what = new Date((long) ScriptRuntime.toNumber(s));            }        }        return what;    }