@@ -84,11 +84,11 @@ of this software and associated documentation files (the "Software"), to deal
8484 * @version 2
8585 */
8686public class JSONObject {
87-
87+
8888//#if CLDC=="1.0"
8989 public static final Boolean TRUE = new Boolean (true );
9090 public static final Boolean FALSE = new Boolean (false );
91- //#endif
91+ //#endif
9292
9393 /**
9494 * JSONObject.NULL is equivalent to the value that JavaScript calls null,
@@ -245,8 +245,8 @@ public JSONObject(JSONTokener x) throws JSONException {
245245//# }
246246//# }
247247//# }
248- //#endif
249-
248+ //#endif
249+
250250 /**
251251 * Construct a JSONObject from a string.
252252 * This is the most commonly used JSONObject constructor.
@@ -295,8 +295,8 @@ public JSONObject accumulate(String key, Object value)
295295//# * @param key A key string.
296296//# * @param value An object to be accumulated under the key.
297297//# * @return this.
298- //# * @throws JSONException If the key is null or if the current value
299- //# * associated with the key is not a JSONArray.
298+ //# * @throws JSONException If the key is null or if the current value
299+ //# * associated with the key is not a JSONArray.
300300//# */
301301//# public JSONObject append(String key, Object value)
302302//# throws JSONException {
@@ -305,8 +305,8 @@ public JSONObject accumulate(String key, Object value)
305305//# if (o == null) {
306306//# put(key, new JSONArray().put(value));
307307//# } else if (o instanceof JSONArray) {
308- //# throw new JSONException("JSONObject[" + key +
309- //# "] is not a JSONArray.");
308+ //# throw new JSONException("JSONObject[" + key +
309+ //# "] is not a JSONArray.");
310310//# } else {
311311//# put(key, new JSONArray().put(o).put(value));
312312//# }
@@ -323,11 +323,11 @@ public JSONObject accumulate(String key, Object value)
323323//# */
324324//# static public String doubleToString(double d) {
325325//# if (Double.isInfinite(d) || Double.isNaN(d)) {
326- //# return "null";
326+ //# return "null";
327327//# }
328- //#
328+ //#
329329//# // Shave off trailing zeros and decimal point, if possible.
330- //#
330+ //#
331331//# String s = Double.toString(d);
332332//# if (s.indexOf('.') > 0 && s.indexOf('e') < 0 && s.indexOf('E') < 0) {
333333//# while (s.endsWith("0")) {
@@ -418,7 +418,7 @@ public boolean getBoolean(String key) throws JSONException {
418418//# throw new JSONException("JSONObject[" + quote(key) +
419419//# "] is not a number.");
420420//# }
421- //# }
421+ //# }
422422//# throw new JSONException("JSONObject[" + quote(key) +
423423//# "] is not a number.");
424424//# }
@@ -452,7 +452,7 @@ public int getInt(String key) throws JSONException {
452452//# } else if (o instanceof String) {
453453//# return (int) getDouble(key);
454454//#endif
455- }
455+ }
456456 throw new JSONException ("JSONObject[" + quote (key ) +
457457 "] is not a number." );
458458 }
@@ -519,7 +519,7 @@ public long getLong(String key) throws JSONException {
519519//# } else if (o instanceof String) {
520520//# return (long) getDouble(key);
521521//#endif
522- }
522+ }
523523 throw new JSONException ("JSONObject[" + quote (key ) +
524524 "] is not a number." );
525525 }
@@ -592,7 +592,7 @@ public JSONArray names() {
592592 return ja .length () == 0 ? null : ja ;
593593 }
594594
595-
595+
596596 /**
597597 * Shave off trailing zeros and decimal point, if possible.
598598 */
@@ -663,21 +663,21 @@ public boolean optBoolean(String key, boolean defaultValue) {
663663 }
664664 }
665665
666-
666+
667667 /**
668668 * Put a key/value pair in the JSONObject, where the value will be a
669669 * JSONArray which is produced from a Collection.
670- * @param key A key string.
671- * @param value A Collection value.
672- * @return this.
670+ * @param key A key string.
671+ * @param value A Collection value.
672+ * @return this.
673673 * @throws JSONException
674674 */
675675 public JSONObject put (String key , Vector value ) throws JSONException {
676676 put (key , new JSONArray (value ));
677677 return this ;
678678 }
679679
680-
680+
681681//#if CLDC!="1.0"
682682//# /**
683683//# * Get an optional double associated with a key,
@@ -895,22 +895,22 @@ public JSONObject put(String key, long value) throws JSONException {
895895 return this ;
896896 }
897897
898-
898+
899899//#ifdef PRODUCER
900900//# /**
901901//# * Put a key/value pair in the JSONObject, where the value will be a
902902//# * JSONObject which is produced from a Map.
903- //# * @param key A key string.
904- //# * @param value A Map value.
905- //# * @return this.
903+ //# * @param key A key string.
904+ //# * @param value A Map value.
905+ //# * @return this.
906906//# * @throws JSONException
907907//# */
908908//# public JSONObject put(String key, Hashtable value) throws JSONException {
909909//# put(key, new JSONObject(value));
910910//# return this;
911911//# }
912- //#endif
913-
912+ //#endif
913+
914914 /**
915915 * Put a key/value pair in the JSONObject. If the value is null,
916916 * then the key will be removed from the JSONObject if it is present.
@@ -1197,23 +1197,23 @@ static String valueToString(Object value) throws JSONException {
11971197 return "null" ;
11981198 }
11991199 if (value instanceof JSONString ) {
1200- Object o ;
1201- try {
1202- o = ((JSONString )value ).toJSONString ();
1200+ Object o ;
1201+ try {
1202+ o = ((JSONString )value ).toJSONString ();
12031203 } catch (Exception e ) {
1204- throw new JSONException (e );
1204+ throw new JSONException (e );
12051205 }
12061206 if (o instanceof String ) {
1207- return (String )o ;
1208- }
1207+ return (String )o ;
1208+ }
12091209 throw new JSONException ("Bad value from toJSONString: " + o );
12101210 }
12111211//#if CLDC!="1.0"
12121212//# if (value instanceof Float || value instanceof Double ||
12131213//#else
12141214 if (
12151215//#endif
1216- value instanceof Byte || value instanceof Short ||
1216+ value instanceof Byte || value instanceof Short ||
12171217 value instanceof Integer || value instanceof Long ) {
12181218 return numberToString (value );
12191219 }
@@ -1245,21 +1245,21 @@ static String valueToString(Object value, int indentFactor, int indent)
12451245 return "null" ;
12461246 }
12471247 try {
1248- if (value instanceof JSONString ) {
1249- Object o = ((JSONString )value ).toJSONString ();
1250- if (o instanceof String ) {
1251- return (String )o ;
1252- }
1253- }
1248+ if (value instanceof JSONString ) {
1249+ Object o = ((JSONString )value ).toJSONString ();
1250+ if (o instanceof String ) {
1251+ return (String )o ;
1252+ }
1253+ }
12541254 } catch (Exception e ) {
1255- /* forget about it */
1255+ /* forget about it */
12561256 }
12571257//#if CLDC!="1.0"
12581258//# if (value instanceof Float || value instanceof Double ||
12591259//#else
12601260 if (
12611261//#endif
1262- value instanceof Byte || value instanceof Short ||
1262+ value instanceof Byte || value instanceof Short ||
12631263 value instanceof Integer || value instanceof Long ) {
12641264 return numberToString (value );
12651265 }
0 commit comments