FULL PRODUCT VERSION :
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows 2000 [Version 5.00.2195]
A DESCRIPTION OF THE PROBLEM :
DecimalFormat applies pattern "#" incorrectly
This pattern implies that the number should only be passed as an Integer, however DecimalFormat also allows for decimal numbers to be parsed with this pattern.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
run code
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
true to be displayed
ACTUAL -
false is displayed
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import static java.lang.System.*;
import java.text.*;
public class Test {
public static void main(String[] args) {
out.println(new DecimalFormat("#").isParseIntegerOnly());
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Call setParseIntegerOnly(true) on the format after applying the pattern.
###@###.### 2004-12-30 10:02:44 GMT
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows 2000 [Version 5.00.2195]
A DESCRIPTION OF THE PROBLEM :
DecimalFormat applies pattern "#" incorrectly
This pattern implies that the number should only be passed as an Integer, however DecimalFormat also allows for decimal numbers to be parsed with this pattern.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
run code
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
true to be displayed
ACTUAL -
false is displayed
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import static java.lang.System.*;
import java.text.*;
public class Test {
public static void main(String[] args) {
out.println(new DecimalFormat("#").isParseIntegerOnly());
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Call setParseIntegerOnly(true) on the format after applying the pattern.
###@###.### 2004-12-30 10:02:44 GMT
- relates to
-
JDK-8352755 Misconceptions about j.text.DecimalFormat digits during parsing
-
- Open
-