Skip to content

Commit cd6866c

Browse files
authored
Merge pull request #208 from emopers/long_bad_76
LongValue does not catch NumberFormatException
2 parents 822bbbe + 4fad4af commit cd6866c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/main/java/net/sf/jsqlparser/expression/LongValue.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,12 @@ public LongValue(final String value) {
3434
if (val.charAt(0) == '+') {
3535
val = val.substring(1);
3636
}
37-
this.value = Long.parseLong(val);
38-
this.stringValue = val;
37+
try {
38+
this.value = Long.parseLong(val);
39+
} catch (NumberFormatException e) {
40+
throw new NumberFormatException("Passed value does not contain a parsable long value");
41+
}
42+
this.stringValue = val;
3943
}
4044

4145
public LongValue(long value) {

0 commit comments

Comments
 (0)