Skip to content

Commit

Permalink
fixed files form Lang #7
Browse files Browse the repository at this point in the history
  • Loading branch information
tdurieux committed Mar 7, 2017
1 parent ee5ba00 commit 085dbd3
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 -
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit 085dbd3

Please sign in to comment.