-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
6u29
-
x86
-
windows_7
FULL PRODUCT VERSION :
Version 1.6.0_30 and 1.6.0_29
C:\>\Java\jdk1.6.0_30\bin\java.exe -version
java version "1.6.0_30"
Java(TM) SE Runtime Environment (build 1.6.0_30-b12)
Java HotSpot(TM) 64-Bit Server VM (build 20.5-b03, mixed mode)
C:\>\Java\jdk1.6.0_29\bin\java.exe -version
java version "1.6.0_29"
Java(TM) SE Runtime Environment (build 1.6.0_29-b11)
Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
6.1.7600
A DESCRIPTION OF THE PROBLEM :
Double.parseDouble(null) throws NullPointerException instead of NumberFormatException.
This is inconsistent with the Javadoc and the behavior of Long.parseLong().
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Call Double.parseDouble() with null param.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
throws NumberFormatException
ACTUAL -
throw NullPointerException
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public static void main(String[] args) {
System.out.println(System.getProperties().toString());
System.out.println("Running Long.parseLong(null)");
try {
Long.parseLong(null);
} catch (NumberFormatException nfe){
System.out.println("Caught NumberFormatException");
} catch (NullPointerException npe){
System.out.println("Caught NullPointerException");
}
System.out.println("Running Double.parseDouble(null)");
try {
Double.parseDouble(null);
} catch (NumberFormatException nfe){
System.out.println("Caught NumberFormatException");
} catch (NullPointerException npe){
System.out.println("Caught NullPointerException");
}
}
---------- END SOURCE ----------
Version 1.6.0_30 and 1.6.0_29
C:\>\Java\jdk1.6.0_30\bin\java.exe -version
java version "1.6.0_30"
Java(TM) SE Runtime Environment (build 1.6.0_30-b12)
Java HotSpot(TM) 64-Bit Server VM (build 20.5-b03, mixed mode)
C:\>\Java\jdk1.6.0_29\bin\java.exe -version
java version "1.6.0_29"
Java(TM) SE Runtime Environment (build 1.6.0_29-b11)
Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
6.1.7600
A DESCRIPTION OF THE PROBLEM :
Double.parseDouble(null) throws NullPointerException instead of NumberFormatException.
This is inconsistent with the Javadoc and the behavior of Long.parseLong().
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Call Double.parseDouble() with null param.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
throws NumberFormatException
ACTUAL -
throw NullPointerException
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public static void main(String[] args) {
System.out.println(System.getProperties().toString());
System.out.println("Running Long.parseLong(null)");
try {
Long.parseLong(null);
} catch (NumberFormatException nfe){
System.out.println("Caught NumberFormatException");
} catch (NullPointerException npe){
System.out.println("Caught NullPointerException");
}
System.out.println("Running Double.parseDouble(null)");
try {
Double.parseDouble(null);
} catch (NumberFormatException nfe){
System.out.println("Caught NumberFormatException");
} catch (NullPointerException npe){
System.out.println("Caught NullPointerException");
}
}
---------- END SOURCE ----------
- duplicates
-
JDK-6463998 Undocumented NullPointerException from Float.parseFloat and Double.parseDouble
-
- Resolved
-