8261290: Improve error message for NumberFormatException on null input
Reviewed-by: attila, alanb
This commit is contained in:
parent
18188c2aa7
commit
564011cff0
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* 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) {
|
if (s == null) {
|
||||||
throw new NumberFormatException("null");
|
throw new NumberFormatException("Cannot parse null string");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (radix < Character.MIN_RADIX) {
|
if (radix < Character.MIN_RADIX) {
|
||||||
@ -832,7 +832,7 @@ public final class Integer extends Number
|
|||||||
public static int parseUnsignedInt(String s, int radix)
|
public static int parseUnsignedInt(String s, int radix)
|
||||||
throws NumberFormatException {
|
throws NumberFormatException {
|
||||||
if (s == null) {
|
if (s == null) {
|
||||||
throw new NumberFormatException("null");
|
throw new NumberFormatException("Cannot parse null string");
|
||||||
}
|
}
|
||||||
|
|
||||||
int len = s.length();
|
int len = s.length();
|
||||||
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* 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
|
throws NumberFormatException
|
||||||
{
|
{
|
||||||
if (s == null) {
|
if (s == null) {
|
||||||
throw new NumberFormatException("null");
|
throw new NumberFormatException("Cannot parse null string");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (radix < Character.MIN_RADIX) {
|
if (radix < Character.MIN_RADIX) {
|
||||||
@ -893,7 +893,7 @@ public final class Long extends Number
|
|||||||
public static long parseUnsignedLong(String s, int radix)
|
public static long parseUnsignedLong(String s, int radix)
|
||||||
throws NumberFormatException {
|
throws NumberFormatException {
|
||||||
if (s == null) {
|
if (s == null) {
|
||||||
throw new NumberFormatException("null");
|
throw new NumberFormatException("Cannot parse null string");
|
||||||
}
|
}
|
||||||
|
|
||||||
int len = s.length();
|
int len = s.length();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user