Skip to content

Commit

Permalink
[Truffle] Add Sprintf InvalidFormatException for precision too big
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon Fish committed Dec 12, 2016
1 parent af87bdf commit 4b10c01
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 0 additions & 1 deletion spec/truffle/tags/core/string/modulo_tags.txt
@@ -1,5 +1,4 @@
fails:String#% raises an ArgumentError for unused arguments when $DEBUG is true
fails:String#% raises an ArgumentError for huge precisions for %s
fails:String#% behaves as if calling Kernel#Float for %e arguments, when the passed argument does not respond to #to_ary
fails:String#% behaves as if calling Kernel#Float for %e arguments, when the passed argument is hexadecimal string
fails:String#% behaves as if calling Kernel#Float for %E arguments, when the passed argument does not respond to #to_ary
Expand Down
Expand Up @@ -336,7 +336,11 @@ public LookAheadResult getNum(int startI, int end) {

Integer result;
if (sb.length() > 0) {
result = Integer.parseInt(sb.toString());
try {
result = Integer.parseInt(sb.toString());
} catch (NumberFormatException nfe) {
throw new InvalidFormatException("precision too big");
}
} else {
result = null;
}
Expand Down

0 comments on commit 4b10c01

Please sign in to comment.