From a8a661bdf72790767ef7c516ca7fab4530239c31 Mon Sep 17 00:00:00 2001 From: tdurieux Date: Tue, 7 Mar 2017 13:26:15 +0100 Subject: [PATCH] fixed files form Lang #27 --- .../Lang/27/org/apache/commons/lang3/math/NumberUtils.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/Lang/27/org/apache/commons/lang3/math/NumberUtils.java b/projects/Lang/27/org/apache/commons/lang3/math/NumberUtils.java index fd03ab8..f1f36a8 100644 --- a/projects/Lang/27/org/apache/commons/lang3/math/NumberUtils.java +++ b/projects/Lang/27/org/apache/commons/lang3/math/NumberUtils.java @@ -476,7 +476,7 @@ public static Number createNumber(String str) throws NumberFormatException { if (decPos > -1) { if (expPos > -1) { - if (expPos < decPos) { + if (expPos < decPos || expPos > str.length()) { throw new NumberFormatException(str + " is not a valid number."); } dec = str.substring(decPos + 1, expPos); @@ -486,6 +486,9 @@ public static Number createNumber(String str) throws NumberFormatException { mant = str.substring(0, decPos); } else { if (expPos > -1) { + if (expPos > str.length()) { + throw new NumberFormatException(str + " is not a valid number."); + } mant = str.substring(0, expPos); } else { mant = str;