-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.0.2
-
sparc
-
solaris_2.4
Method Double.valueOf(String s) where s should be string representation of floating-point value Floating value is described in spec is as follows
[Sign] Digits . [Digits] [ExponentPart] or
[Sign] . Digits [ExponentPart]
Check out attached TestDouble.java should thow NumberFormatException.
---------------------8<--------------- TestDouble.java -----------------------
public class TestDouble {
public static void main(String[] argv) {
try {
Double d = Double.valueOf("0");
System.out.println("Failed Result:" + d.toString());
d = Double.valueOf("1234");
System.out.println("Failed Result:" + d.toString());
}
catch (Exception e) {
System.out.println(e);
}
}
}
[Sign] Digits . [Digits] [ExponentPart] or
[Sign] . Digits [ExponentPart]
Check out attached TestDouble.java should thow NumberFormatException.
---------------------8<--------------- TestDouble.java -----------------------
public class TestDouble {
public static void main(String[] argv) {
try {
Double d = Double.valueOf("0");
System.out.println("Failed Result:" + d.toString());
d = Double.valueOf("1234");
System.out.println("Failed Result:" + d.toString());
}
catch (Exception e) {
System.out.println(e);
}
}
}
- duplicates
-
JDK-4023281 Conversion of string to double or float should tolerate trailing d, D, f or F
-
- Closed
-