#790 - Update XML with changes for string to number conversion.

Moved the code logic to a common utility to de-duplicate.
This commit is contained in:
rudrajyoti biswas
2023-10-14 10:05:36 +05:30
parent f346203cd6
commit 7b2677ac5a
8 changed files with 322 additions and 176 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;
}