diff --git a/JSONArray.java b/JSONArray.java index 10e08d2..8847c5d 100644 --- a/JSONArray.java +++ b/JSONArray.java @@ -1409,7 +1409,7 @@ public class JSONArray implements Iterable { public Writer write(Writer writer, int indentFactor, int indent) throws JSONException { try { - boolean hasComma = false; + boolean needsComma = false; int length = this.length(); writer.write('['); @@ -1424,7 +1424,7 @@ public class JSONArray implements Iterable { final int newIndent = indent + indentFactor; for (int i = 0; i < length; i += 1) { - if (hasComma) { + if (needsComma) { writer.write(','); } if (indentFactor > 0) { @@ -1437,7 +1437,7 @@ public class JSONArray implements Iterable { } catch (Exception e) { throw new JSONException("Unable to write JSONArray value at index: " + i, e); } - hasComma = true; + needsComma = true; } if (indentFactor > 0) { writer.write('\n'); diff --git a/JSONObject.java b/JSONObject.java index 90de2e4..399dfe4 100644 --- a/JSONObject.java +++ b/JSONObject.java @@ -2496,7 +2496,7 @@ public class JSONObject { public Writer write(Writer writer, int indentFactor, int indent) throws JSONException { try { - boolean hasComma = false; + boolean needsComma = false; final int length = this.length(); writer.write('{'); @@ -2516,7 +2516,7 @@ public class JSONObject { } else if (length != 0) { final int newIndent = indent + indentFactor; for (final Entry entry : this.entrySet()) { - if (hasComma) { + if (needsComma) { writer.write(','); } if (indentFactor > 0) { @@ -2534,7 +2534,7 @@ public class JSONObject { } catch (Exception e) { throw new JSONException("Unable to write JSONObject value for key: " + key, e); } - hasComma = true; + needsComma = true; } if (indentFactor > 0) { writer.write('\n');