mirror of
https://github.com/stleary/JSON-java.git
synced 2025-08-03 19:35:31 -04:00
Removing excessive synchronization
This commit is contained in:
parent
ef68cdf810
commit
61bb60e752
@ -1646,10 +1646,8 @@ 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();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write the contents of the JSONArray as JSON text to a writer. For
|
* Write the contents of the JSONArray as JSON text to a writer. For
|
||||||
|
@ -2191,7 +2191,6 @@ 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) {
|
||||||
@ -2199,7 +2198,6 @@ public class JSONObject {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public static Writer quote(String string, Writer w) throws IOException {
|
public static Writer quote(String string, Writer w) throws IOException {
|
||||||
if (string == null || string.isEmpty()) {
|
if (string == null || string.isEmpty()) {
|
||||||
@ -2584,10 +2582,8 @@ 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();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make a JSON text of an Object value. If the object has an
|
* Make a JSON text of an Object value. If the object has an
|
||||||
|
Loading…
x
Reference in New Issue
Block a user