#813 - moved number conversion related common changes to utility static method.

This commit is contained in:
rudrajyoti biswas
2023-10-23 19:16:25 +05:30
parent 04a4c5a3ec
commit 98b79ae7bf
5 changed files with 326 additions and 227 deletions

View File

@@ -331,7 +331,7 @@ public class JSONArray implements Iterable<Object> {
if (object instanceof Number) {
return (Number)object;
}
return JSONObject.stringToNumber(object.toString());
return NumberConversionUtil.stringToNumber(object.toString());
} catch (Exception e) {
throw wrongValueFormatException(index, "number", object, e);
}
@@ -1078,7 +1078,7 @@ public class JSONArray implements Iterable<Object> {
if (val instanceof String) {
try {
return JSONObject.stringToNumber((String) val);
return NumberConversionUtil.stringToNumber((String) val);
} catch (Exception e) {
return defaultValue;
}