Code review request for 6463998: Undocumented NullPointerExeption from Float.parseFloat and Double.parseDouble (original) (raw)
Joseph D. Darcy Joe.Darcy at Sun.COM
Wed Jul 15 20:30:13 UTC 2009
- Previous message: hg: jdk7/tl/jdk: 6857789: (reflect) Create common superclass of reflective exceptions
- Next message: Code review request for 6463998: Undocumented NullPointerExeption from Float.parseFloat and Double.parseDouble
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hello.
Please review this simple patch below to document the long-standing behavior of parseFloat and parseDouble regarding null inputs. (Yes, the various string -> value methods have inconsistent behavior with respect to null inputs; however, at this point the safest course of action is just to document the present behavior.)
Thanks,
-Joe
--- old/src/share/classes/java/lang/Double.java 2009-07-15 13:28:38.000000000 -0700 +++ new/src/share/classes/java/lang/Double.java 2009-07-15 13:28:38.000000000 -0700 @@ -529,6 +529,7 @@ * @param s the string to be parsed. * @return the {@code double} value represented by the string * argument.
* @throws NullPointerException if the argument string is null * @throws NumberFormatException if the string does not contain * a parsable {@code double}. * @see java.lang.Double#valueOf(String)
--- old/src/share/classes/java/lang/Float.java 2009-07-15 13:28:39.000000000 -0700 +++ new/src/share/classes/java/lang/Float.java 2009-07-15 13:28:39.000000000 -0700 @@ -441,6 +441,7 @@ * @param s the string to be parsed. * @return the {@code float} value represented by the string * argument.
* @throws NullPointerException if the argument string is null * @throws NumberFormatException if the string does not contain a * parsable {@code float}. * @see java.lang.Float#valueOf(String)
- Previous message: hg: jdk7/tl/jdk: 6857789: (reflect) Create common superclass of reflective exceptions
- Next message: Code review request for 6463998: Undocumented NullPointerExeption from Float.parseFloat and Double.parseDouble
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]