File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -480,6 +480,7 @@ public JSONObject(Object object, String ... names) {
480480 try {
481481 this .putOpt (name , c .getField (name ).get (object ));
482482 } catch (Exception ignore ) {
483+ // if invalid, do not include key:value pair in JSONObject
483484 }
484485 }
485486 }
@@ -651,9 +652,9 @@ public static String doubleToString(double d) {
651652 return "null" ;
652653 }
653654
654- // Shave off trailing zeros and decimal point, if possible.
655-
655+ // Shave off trailing zeros and decimal point, if possible.
656656 String string = Double .toString (d );
657+ // idx = 0 case is covered by behavior of Double.toString()
657658 if (string .indexOf ('.' ) > 0 && string .indexOf ('e' ) < 0
658659 && string .indexOf ('E' ) < 0 ) {
659660 while (string .endsWith ("0" )) {
@@ -1130,8 +1131,8 @@ public static String numberToString(Number number) throws JSONException {
11301131 testValidity (number );
11311132
11321133 // Shave off trailing zeros and decimal point, if possible.
1133-
11341134 String string = number .toString ();
1135+ // idx = 0 case is covered by behavior of .toString()
11351136 if (string .indexOf ('.' ) > 0 && string .indexOf ('e' ) < 0
11361137 && string .indexOf ('E' ) < 0 ) {
11371138 while (string .endsWith ("0" )) {
You can’t perform that action at this time.
0 commit comments