8261290: Improve error message for NumberFormatException on null input

Reviewed-by: attila, alanb
This commit is contained in:
Joe Darcy 2021-02-21 18:43:26 +00:00
parent 18188c2aa7
commit 564011cff0
2 changed files with 6 additions and 6 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1994, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1994, 2021, 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
@ -627,7 +627,7 @@ public final class Integer extends Number
*/
if (s == null) {
throw new NumberFormatException("null");
throw new NumberFormatException("Cannot parse null string");
}
if (radix < Character.MIN_RADIX) {
@ -832,7 +832,7 @@ public final class Integer extends Number
public static int parseUnsignedInt(String s, int radix)
throws NumberFormatException {
if (s == null) {
throw new NumberFormatException("null");
throw new NumberFormatException("Cannot parse null string");
}
int len = s.length();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1994, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1994, 2021, 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
@ -682,7 +682,7 @@ public final class Long extends Number
throws NumberFormatException
{
if (s == null) {
throw new NumberFormatException("null");
throw new NumberFormatException("Cannot parse null string");
}
if (radix < Character.MIN_RADIX) {
@ -893,7 +893,7 @@ public final class Long extends Number
public static long parseUnsignedLong(String s, int radix)
throws NumberFormatException {
if (s == null) {
throw new NumberFormatException("null");
throw new NumberFormatException("Cannot parse null string");
}
int len = s.length();