diff --git a/projects/Lang/7/org/apache/commons/lang3/math/NumberUtils.java b/projects/Lang/7/org/apache/commons/lang3/math/NumberUtils.java index d49da7f..064f547 100644 --- a/projects/Lang/7/org/apache/commons/lang3/math/NumberUtils.java +++ b/projects/Lang/7/org/apache/commons/lang3/math/NumberUtils.java @@ -449,9 +449,6 @@ public static Number createNumber(String str) throws NumberFormatException { if (StringUtils.isBlank(str)) { throw new NumberFormatException("A blank string is not a valid number"); } - if (str.startsWith("--")) { - return null; - } if (str.startsWith("0x") || str.startsWith("-0x") || str.startsWith("0X") || str.startsWith("-0X")) { int hexDigits = str.length() - 2; // drop 0x if (str.startsWith("-")) { // drop - @@ -718,10 +715,13 @@ public static BigDecimal createBigDecimal(String str) { if (StringUtils.isBlank(str)) { throw new NumberFormatException("A blank string is not a valid number"); } + if (str.trim().startsWith("--")) { // this is protection for poorness in java.lang.BigDecimal. // it accepts this as a legal value, but it does not appear // to be in specification of class. OS X Java parses it to // a wrong value. + throw new NumberFormatException(str + " is not a valid number."); + } return new BigDecimal(str); }