@@ -54,10 +54,10 @@ of this software and associated documentation files (the "Software"), to deal
5454 * <p>
5555 * This can sometimes be easier than using a JSONObject to build a string.
5656 * @author JSON.org
57- * @version 2010-12-24
57+ * @version 2011-11-14
5858 */
5959public class JSONWriter {
60- private static final int maxdepth = 20 ;
60+ private static final int maxdepth = 200 ;
6161
6262 /**
6363 * The comma flag determines if a comma should be output before the next
@@ -78,7 +78,7 @@ public class JSONWriter {
7878 /**
7979 * The object/array stack.
8080 */
81- private JSONObject stack [];
81+ private final JSONObject stack [];
8282
8383 /**
8484 * The stack top index. A value of 0 indicates that the stack is empty.
@@ -157,7 +157,7 @@ public JSONWriter array() throws JSONException {
157157 */
158158 private JSONWriter end (char mode , char c ) throws JSONException {
159159 if (this .mode != mode ) {
160- throw new JSONException (mode == 'a' ? "Misplaced endArray." :
160+ throw new JSONException (mode == 'a' ? "Misplaced endArray." :
161161 "Misplaced endObject." );
162162 }
163163 this .pop (mode );
@@ -204,7 +204,7 @@ public JSONWriter key(String string) throws JSONException {
204204 }
205205 if (this .mode == 'k' ) {
206206 try {
207- stack [top - 1 ].putOnce (string , Boolean .TRUE );
207+ this . stack [this . top - 1 ].putOnce (string , Boolean .TRUE );
208208 if (this .comma ) {
209209 this .writer .write (',' );
210210 }
@@ -259,7 +259,7 @@ private void pop(char c) throws JSONException {
259259 throw new JSONException ("Nesting error." );
260260 }
261261 this .top -= 1 ;
262- this .mode = this .top == 0 ?
262+ this .mode = this .top == 0 ?
263263 'd' : this .stack [this .top - 1 ] == null ? 'a' : 'k' ;
264264 }
265265
0 commit comments