diff --git a/mobile/android/services/src/main/java/org/mozilla/gecko/sync/ExtendedJSONObject.java b/mobile/android/services/src/main/java/org/mozilla/gecko/sync/ExtendedJSONObject.java index 04778465c3a..e308f8619dc 100644 --- a/mobile/android/services/src/main/java/org/mozilla/gecko/sync/ExtendedJSONObject.java +++ b/mobile/android/services/src/main/java/org/mozilla/gecko/sync/ExtendedJSONObject.java @@ -173,37 +173,6 @@ public class ExtendedJSONObject { this.object = o; } - public ExtendedJSONObject deepCopy() { - final ExtendedJSONObject out = new ExtendedJSONObject(); - @SuppressWarnings("unchecked") - final Set> entries = this.object.entrySet(); - for (Map.Entry entry : entries) { - final String key = entry.getKey(); - final Object value = entry.getValue(); - if (value instanceof JSONArray) { - // Oh god. - try { - out.put(key, new JSONParser().parse(((JSONArray) value).toJSONString())); - } catch (ParseException e) { - // This should never occur, because we're round-tripping. - } - continue; - } - if (value instanceof JSONObject) { - out.put(key, new ExtendedJSONObject((JSONObject) value).deepCopy().object); - continue; - } - if (value instanceof ExtendedJSONObject) { - out.put(key, ((ExtendedJSONObject) value).deepCopy()); - continue; - } - // Oh well. - out.put(key, value); - } - - return out; - } - public ExtendedJSONObject(Reader in) throws IOException, ParseException, NonObjectJSONException { if (in == null) { this.object = new JSONObject(); diff --git a/mobile/android/tests/background/junit4/src/org/mozilla/gecko/sync/test/TestExtendedJSONObject.java b/mobile/android/tests/background/junit4/src/org/mozilla/gecko/sync/test/TestExtendedJSONObject.java index 4b6a204f534..413f51ce60d 100644 --- a/mobile/android/tests/background/junit4/src/org/mozilla/gecko/sync/test/TestExtendedJSONObject.java +++ b/mobile/android/tests/background/junit4/src/org/mozilla/gecko/sync/test/TestExtendedJSONObject.java @@ -32,17 +32,6 @@ public class TestExtendedJSONObject { public static String exampleJSON = "{\"modified\":1233702554.25,\"success\":[\"{GXS58IDC}12\",\"{GXS58IDC}13\",\"{GXS58IDC}15\",\"{GXS58IDC}16\",\"{GXS58IDC}18\",\"{GXS58IDC}19\"],\"failed\":{\"{GXS58IDC}11\":[\"invalid parentid\"],\"{GXS58IDC}14\":[\"invalid parentid\"],\"{GXS58IDC}17\":[\"invalid parentid\"],\"{GXS58IDC}20\":[\"invalid parentid\"]}}"; public static String exampleIntegral = "{\"modified\":1233702554,}"; - @Test - public void testDeepCopy() throws NonObjectJSONException, IOException, ParseException, NonArrayJSONException { - ExtendedJSONObject a = new ExtendedJSONObject(exampleJSON); - ExtendedJSONObject c = a.deepCopy(); - assertTrue(a != c); - assertTrue(a.equals(c)); - assertTrue(a.get("modified") == c.get("modified")); - assertTrue(a.getArray("success") != c.getArray("success")); - assertTrue(a.getArray("success").equals(c.getArray("success"))); - } - @Test public void testFractional() throws IOException, ParseException, NonObjectJSONException { ExtendedJSONObject o = new ExtendedJSONObject(exampleJSON);