mirror of
https://github.com/stleary/JSON-java.git
synced 2025-08-03 11:25:30 -04:00
Removing excessive synchronization
This commit is contained in:
parent
ef68cdf810
commit
61bb60e752
@ -1646,9 +1646,7 @@ public class JSONArray implements Iterable<Object> {
|
|||||||
@SuppressWarnings("resource")
|
@SuppressWarnings("resource")
|
||||||
public String toString(int indentFactor) throws JSONException {
|
public String toString(int indentFactor) throws JSONException {
|
||||||
StringWriter sw = new StringWriter();
|
StringWriter sw = new StringWriter();
|
||||||
synchronized (sw.getBuffer()) {
|
return this.write(sw, indentFactor, 0).toString();
|
||||||
return this.write(sw, indentFactor, 0).toString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2191,13 +2191,11 @@ public class JSONObject {
|
|||||||
@SuppressWarnings("resource")
|
@SuppressWarnings("resource")
|
||||||
public static String quote(String string) {
|
public static String quote(String string) {
|
||||||
StringWriter sw = new StringWriter();
|
StringWriter sw = new StringWriter();
|
||||||
synchronized (sw.getBuffer()) {
|
try {
|
||||||
try {
|
return quote(string, sw).toString();
|
||||||
return quote(string, sw).toString();
|
} catch (IOException ignored) {
|
||||||
} catch (IOException ignored) {
|
// will never happen - we are writing to a string writer
|
||||||
// will never happen - we are writing to a string writer
|
return "";
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2584,9 +2582,7 @@ public class JSONObject {
|
|||||||
@SuppressWarnings("resource")
|
@SuppressWarnings("resource")
|
||||||
public String toString(int indentFactor) throws JSONException {
|
public String toString(int indentFactor) throws JSONException {
|
||||||
StringWriter w = new StringWriter();
|
StringWriter w = new StringWriter();
|
||||||
synchronized (w.getBuffer()) {
|
return this.write(w, indentFactor, 0).toString();
|
||||||
return this.write(w, indentFactor, 0).toString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user