8176425: Add radix indication in NumberFormatException message for Integer.decode

Reviewed-by: lancea
This commit is contained in:
Joe Darcy 2018-08-15 10:16:15 -07:00
parent b71faed5df
commit b0954bc7ab
4 changed files with 23 additions and 20 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1994, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1994, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -61,8 +61,11 @@ class NumberFormatException extends IllegalArgumentException {
*
* @param s the input causing the error
*/
static NumberFormatException forInputString(String s) {
return new NumberFormatException("For input string: \"" + s + "\"");
static NumberFormatException forInputString(String s, int radix) {
return new NumberFormatException("For input string: \"" + s + "\"" +
(radix == 10 ?
"" :
" under radix " + radix));
}
/**