Skip to content

Commit 9bb26bd

Browse files
committed
sonar cube stuff
1 parent 78137d3 commit 9bb26bd

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/main/java/org/json/JSONObject.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff 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")) {

0 commit comments

Comments
 (0)