diff --git a/apps/routerconsole/java/src/com/vuze/plugins/mlab/MLabRunner.java b/apps/routerconsole/java/src/com/vuze/plugins/mlab/MLabRunner.java index ba640194f34e5c3e54baa451f6a84599eb322595..4a42eb104e0c490d73c03b324a015f25d30683e7 100644 --- a/apps/routerconsole/java/src/com/vuze/plugins/mlab/MLabRunner.java +++ b/apps/routerconsole/java/src/com/vuze/plugins/mlab/MLabRunner.java @@ -30,9 +30,9 @@ import java.util.concurrent.atomic.AtomicBoolean; import edu.internet2.ndt.Tcpbw100; -import net.minidev.json.JSONObject; -import net.minidev.json.parser.JSONParser; -import net.minidev.json.parser.ParseException; +import org.json.simple.JSONObject; +import org.json.simple.parser.JSONParser; +import org.json.simple.parser.ParseException; import net.i2p.I2PAppContext; import net.i2p.data.DataHelper; @@ -136,9 +136,10 @@ public class MLabRunner { int code = eepget.getStatusCode(); if (code != 200) throw new IOException("ns fetch failed: " + code); - JSONParser parser = new JSONParser(JSONParser.MODE_PERMISSIVE); + JSONParser parser = new JSONParser(); byte[] b = baos.toByteArray(); - JSONObject map = (JSONObject) parser.parse(b); + String s = new String(b, "ISO-8859-1"); + JSONObject map = (JSONObject) parser.parse(s); if (map == null) { throw new IOException("no map"); } diff --git a/apps/routerconsole/java/src/edu/internet2/ndt/JSONUtils.java b/apps/routerconsole/java/src/edu/internet2/ndt/JSONUtils.java index 401d5c81a324fb53df52523f2c0102139cac0ac6..de7354717095c77cb2000ecb56c8e226485af881 100644 --- a/apps/routerconsole/java/src/edu/internet2/ndt/JSONUtils.java +++ b/apps/routerconsole/java/src/edu/internet2/ndt/JSONUtils.java @@ -1,7 +1,7 @@ package edu.internet2.ndt; -import net.minidev.json.JSONObject; -import net.minidev.json.JSONValue; +import org.json.simple.JSONObject; +import org.json.simple.JSONValue; import java.util.Iterator; import java.util.Map; diff --git a/core/java/src/net/i2p/util/DNSOverHTTPS.java b/core/java/src/net/i2p/util/DNSOverHTTPS.java index c475496dd4122c8eb7844bfd2e0549db7b29fdf4..42761e07b50398fa16722cde0b8148723cf42fcf 100644 --- a/core/java/src/net/i2p/util/DNSOverHTTPS.java +++ b/core/java/src/net/i2p/util/DNSOverHTTPS.java @@ -12,9 +12,9 @@ import java.util.Map; import gnu.getopt.Getopt; -import net.minidev.json.JSONArray; -import net.minidev.json.JSONObject; -import net.minidev.json.parser.JSONParser; +import org.json.simple.JSONArray; +import org.json.simple.JSONObject; +import org.json.simple.parser.JSONParser; import net.i2p.I2PAppContext; import net.i2p.data.DataHelper; @@ -98,7 +98,7 @@ public class DNSOverHTTPS implements EepGet.StatusListener { _log = ctx.logManager().getLog(DNSOverHTTPS.class); state = sslState; baos = new ByteArrayOutputStream(512); - parser = new JSONParser(JSONParser.MODE_PERMISSIVE); + parser = new JSONParser(); } public enum Type { V4_ONLY, V6_ONLY, V4_PREFERRED, V6_PREFERRED } @@ -255,12 +255,13 @@ public class DNSOverHTTPS implements EepGet.StatusListener { log("Got response in " + (end - fetchStart) + "ms"); byte[] b = baos.toByteArray(); try { - JSONObject map = (JSONObject) parser.parse(b); + String s = new String(b, "ISO-8859-1"); + JSONObject map = (JSONObject) parser.parse(s); if (map == null) { log("No map"); return null; } - Integer status = (Integer) map.get("Status"); + Number status = (Number) map.get("Status"); if (status == null || status.intValue() != 0) { log("Bad status: " + status); return null; @@ -280,7 +281,7 @@ public class DNSOverHTTPS implements EepGet.StatusListener { log("no data"); continue; } - Integer typ = (Integer) a.get("type"); + Number typ = (Number) a.get("type"); if (typ == null) continue; String name = (String) a.get("name"); @@ -314,7 +315,7 @@ public class DNSOverHTTPS implements EepGet.StatusListener { log("name mismatch: " + name); continue; } - Integer ttl = (Integer) a.get("TTL"); + Number ttl = (Number) a.get("TTL"); int ittl = (ttl != null) ? Math.min(ttl.intValue(), MAX_TTL) : 3600; long expires = end + (ittl * 1000L); Map<String, Result> cache = isv6 ? v6Cache : v4Cache;