diff --git a/build.gradle b/build.gradle index 8a3708a74..fbc2ff1f1 100644 --- a/build.gradle +++ b/build.gradle @@ -20,7 +20,7 @@ repositories { } dependencies { - testImplementation 'junit:junit:4.13.1' + testImplementation 'junit:junit:4.13.2' testImplementation 'com.jayway.jsonpath:json-path:2.1.0' testImplementation 'org.mockito:mockito-core:4.2.0' } diff --git a/pom.xml b/pom.xml index 720529c50..29592fcdf 100644 --- a/pom.xml +++ b/pom.xml @@ -57,7 +57,7 @@ junit junit - 4.13.1 + 4.13.2 test diff --git a/src/main/java/org/json/JSONArray.java b/src/main/java/org/json/JSONArray.java index cc9531e22..b0c912d1f 100644 --- a/src/main/java/org/json/JSONArray.java +++ b/src/main/java/org/json/JSONArray.java @@ -1646,9 +1646,7 @@ public String toString() { @SuppressWarnings("resource") public String toString(int indentFactor) throws JSONException { StringWriter sw = new StringWriter(); - synchronized (sw.getBuffer()) { - return this.write(sw, indentFactor, 0).toString(); - } + return this.write(sw, indentFactor, 0).toString(); } /** diff --git a/src/main/java/org/json/JSONObject.java b/src/main/java/org/json/JSONObject.java index 72cdff253..acef67d9f 100644 --- a/src/main/java/org/json/JSONObject.java +++ b/src/main/java/org/json/JSONObject.java @@ -2183,13 +2183,11 @@ public Object optQuery(JSONPointer jsonPointer) { @SuppressWarnings("resource") public static String quote(String string) { StringWriter sw = new StringWriter(); - synchronized (sw.getBuffer()) { - try { - return quote(string, sw).toString(); - } catch (IOException ignored) { - // will never happen - we are writing to a string writer - return ""; - } + try { + return quote(string, sw).toString(); + } catch (IOException ignored) { + // will never happen - we are writing to a string writer + return ""; } } @@ -2576,9 +2574,7 @@ public String toString() { @SuppressWarnings("resource") public String toString(int indentFactor) throws JSONException { StringWriter w = new StringWriter(); - synchronized (w.getBuffer()) { - return this.write(w, indentFactor, 0).toString(); - } + return this.write(w, indentFactor, 0).toString(); } /**