diff --git a/src/main/java/org/apache/commons/lang3/math/NumberUtils.java b/src/main/java/org/apache/commons/lang3/math/NumberUtils.java index ee26f2e23..7db1f4e1e 100644 --- a/src/main/java/org/apache/commons/lang3/math/NumberUtils.java +++ b/src/main/java/org/apache/commons/lang3/math/NumberUtils.java @@ -1364,7 +1364,8 @@ public class NumberUtils { } } return true; - } else { // leading 0, but not hex, must be octal + } else if (Character.isDigit(chars[start + 1])) { + // leading 0, but not hex, must be octal int i = start + 1; for (; i < chars.length; i++) { if (chars[i] < '0' || chars[i] > '7') { diff --git a/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java b/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java index ea895e256..919020f31 100644 --- a/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java @@ -1234,6 +1234,12 @@ public class NumberUtilsTest { compareIsNumberWithCreateNumber("00", true); } + @Test + public void testLANG992() { + compareIsNumberWithCreateNumber("0.0", true); + compareIsNumberWithCreateNumber("0.4790", true); + } + @Test public void testLANG972() { compareIsNumberWithCreateNumber("0xABCD", true);