Permalink
Browse files

200

  • Loading branch information...
1 parent df6190f commit 9bb970c6bc347513deca99e9f6f8f6df571fde72 @douglascrockford douglascrockford committed Nov 14, 2011
Showing with 6 additions and 6 deletions.
  1. +6 −6 JSONWriter.java
View
@@ -54,10 +54,10 @@ of this software and associated documentation files (the "Software"), to deal
* <p>
* This can sometimes be easier than using a JSONObject to build a string.
* @author JSON.org
- * @version 2010-12-24
+ * @version 2011-11-14
*/
public class JSONWriter {
- private static final int maxdepth = 20;
+ private static final int maxdepth = 200;
/**
* The comma flag determines if a comma should be output before the next
@@ -78,7 +78,7 @@ of this software and associated documentation files (the "Software"), to deal
/**
* The object/array stack.
*/
- private JSONObject stack[];
+ private final JSONObject stack[];
/**
* The stack top index. A value of 0 indicates that the stack is empty.
@@ -157,7 +157,7 @@ public JSONWriter array() throws JSONException {
*/
private JSONWriter end(char mode, char c) throws JSONException {
if (this.mode != mode) {
- throw new JSONException(mode == 'a' ? "Misplaced endArray." :
+ throw new JSONException(mode == 'a' ? "Misplaced endArray." :
"Misplaced endObject.");
}
this.pop(mode);
@@ -204,7 +204,7 @@ public JSONWriter key(String string) throws JSONException {
}
if (this.mode == 'k') {
try {
- stack[top - 1].putOnce(string, Boolean.TRUE);
+ this.stack[this.top - 1].putOnce(string, Boolean.TRUE);
if (this.comma) {
this.writer.write(',');
}
@@ -259,7 +259,7 @@ private void pop(char c) throws JSONException {
throw new JSONException("Nesting error.");
}
this.top -= 1;
- this.mode = this.top == 0 ?
+ this.mode = this.top == 0 ?
'd' : this.stack[this.top - 1] == null ? 'a' : 'k';
}

0 comments on commit 9bb970c

Please sign in to comment.