Integrated: 8261290: Improve error message for NumberFormatException on null input
Joe Darcy
darcy at openjdk.java.net
Sun Feb 21 18:46:40 UTC 2021
On Sat, 20 Feb 2021 21:44:12 GMT, Joe Darcy <darcy at openjdk.org> wrote:
> In Integer and Long, several of the parsing methods are specified to throw NumberFormatException on a null input rather than an NPE. That behavior is not proposed to be modified. However, I think it is reasonable for the NumberFormatException to have a more informative error message than just "null" -- specifically "Cannot parse null string" is proposed here.
>
> All four prior occurrences of
>
> throw new NumberFormatException("null")
>
> have be updated; there were no other instances of this idiom in the java.lang package.
>
> All java/lang/{Integer, Long} regression tests pass with this change.
This pull request has now been integrated.
Changeset: 564011cf
Author: Joe Darcy <darcy at openjdk.org>
URL: https://git.openjdk.java.net/jdk/commit/564011cf
Stats: 6 lines in 2 files changed: 0 ins; 0 del; 6 mod
8261290: Improve error message for NumberFormatException on null input
Reviewed-by: attila, alanb
-------------
PR: https://git.openjdk.java.net/jdk/pull/2663
More information about the core-libs-dev
mailing list