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 f1f36a888..d9b3c6de5 100644 --- a/src/main/java/org/apache/commons/lang3/math/NumberUtils.java +++ b/src/main/java/org/apache/commons/lang3/math/NumberUtils.java @@ -1409,8 +1409,8 @@ public class NumberUtils { } if (chars[i] == 'l' || chars[i] == 'L') { - // not allowing L with an exponent - return foundDigit && !hasExp; + // not allowing L with an exponent or decimal point + return foundDigit && !hasExp && !hasDecPoint; } // last character is illegal return false; 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 779eb746b..bb94ab31c 100644 --- a/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java @@ -1139,6 +1139,10 @@ public class NumberUtilsTest extends TestCase { // LANG-521 val = "2."; assertTrue("isNumber(String) LANG-521 failed", NumberUtils.isNumber(val)); + + // LANG-664 + val = "1.1L"; + assertFalse("isNumber(String) LANG-664 failed", NumberUtils.isNumber(val)); } private boolean checkCreateNumber(String val) {