| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -480,6 +480,7 @@ public JSONObject(Object object, String ... names) { | |||
| 480 | 480 | try { | |
| 481 | 481 | this.putOpt(name, c.getField(name).get(object)); | |
| 482 | 482 | } catch (Exception ignore) { | |
| 483 | + // if invalid, do not include key:value pair in JSONObject | ||
| 483 | 484 | } | |
| 484 | 485 | } | |
| 485 | 486 | } | |
@@ -651,9 +652,9 @@ public static String doubleToString(double d) { | |||
| 651 | 652 | return "null"; | |
| 652 | 653 | } | |
| 653 | 654 | ||
| 654 | - // Shave off trailing zeros and decimal point, if possible. | ||
| 655 | - | ||
| 655 | + // Shave off trailing zeros and decimal point, if possible. | ||
| 656 | 656 | String string = Double.toString(d); | |
| 657 | + // idx = 0 case is covered by behavior of Double.toString() | ||
| 657 | 658 | if (string.indexOf('.') > 0 && string.indexOf('e') < 0 | |
| 658 | 659 | && string.indexOf('E') < 0) { | |
| 659 | 660 | while (string.endsWith("0")) { | |
@@ -1130,8 +1131,8 @@ public static String numberToString(Number number) throws JSONException { | |||
| 1130 | 1131 | testValidity(number); | |
| 1131 | 1132 | ||
| 1132 | 1133 | // Shave off trailing zeros and decimal point, if possible. | |
| 1133 | - | ||
| 1134 | 1134 | String string = number.toString(); | |
| 1135 | + // idx = 0 case is covered by behavior of .toString() | ||
| 1135 | 1136 | if (string.indexOf('.') > 0 && string.indexOf('e') < 0 | |
| 1136 | 1137 | && string.indexOf('E') < 0) { | |
| 1137 | 1138 | while (string.endsWith("0")) { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments