-
Enhancement
-
Resolution: Won't Fix
-
P4
-
None
-
17
-
generic
-
generic
A DESCRIPTION OF THE PROBLEM :
For the Long class, in one instance of the parseLong method, a NumberFormatException is thrown for a null input value, but in another instance, a NullPointerException is thrown.
https://github.com/openjdk/jdk/blob/d0f3cc92bc97aa517d622ac57d22f820fba0684b/src/java.base/share/classes/java/lang/Long.java#L684-L686
https://github.com/openjdk/jdk/blob/d0f3cc92bc97aa517d622ac57d22f820fba0684b/src/java.base/share/classes/java/lang/Long.java#L765
Please unify these methods so that they both throw NPE on a null input value. WithJDK-8261290, the message for NumberFormatException was improved to be more clear that this is a null value, not a string of "null" characters (thanks), but the NPE would be preferable here.
Please consider unifying all of the Number classes. For example:
https://github.com/openjdk/jdk/blob/d0f3cc92bc97aa517d622ac57d22f820fba0684b/src/java.base/share/classes/java/lang/Integer.java#L630
For the Long class, in one instance of the parseLong method, a NumberFormatException is thrown for a null input value, but in another instance, a NullPointerException is thrown.
https://github.com/openjdk/jdk/blob/d0f3cc92bc97aa517d622ac57d22f820fba0684b/src/java.base/share/classes/java/lang/Long.java#L684-L686
https://github.com/openjdk/jdk/blob/d0f3cc92bc97aa517d622ac57d22f820fba0684b/src/java.base/share/classes/java/lang/Long.java#L765
Please unify these methods so that they both throw NPE on a null input value. With
Please consider unifying all of the Number classes. For example:
https://github.com/openjdk/jdk/blob/d0f3cc92bc97aa517d622ac57d22f820fba0684b/src/java.base/share/classes/java/lang/Integer.java#L630
- relates to
-
JDK-6463998 Undocumented NullPointerException from Float.parseFloat and Double.parseDouble
-
- Resolved
-
-
JDK-4787924 Integer.parseInt() and Double.parseDoube() throw different exceptions on null
-
- Closed
-
-
JDK-8261290 Improve error message for NumberFormatException on null input
-
- Closed
-