FULL PRODUCT VERSION :
java version "1.5.0_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_02-b09)
Java HotSpot(TM) Client VM (build 1.5.0_02-b09, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
This definitely occurs under Windows XP (5.1.2600) and Linux (2.4.20-8)
A DESCRIPTION OF THE PROBLEM :
The javadoc class comment for DecimalFormat states that the negative subpattern is optional, but that if it is supplied, it is used to determine the negative prefix and negative suffix.
If I use a DecimalFormat constructor that supplies a negative subpattern with no negative prefix nor negative suffix, I get a default negative prefix (-) applied to my strings, instead of no prefix as I would expect.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the supplied source code
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
23.23
23.23
ACTUAL -
-23.23
-23.23
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.text.*;
import java.math.*;
class test {
public static void main(String[] argv) throws Exception {
DecimalFormat df = new DecimalFormat("#,##0.##;#,##0.##");
System.out.println(df.format(new Double(-23.23)));
System.out.println(df.format(new BigDecimal("-23.23")));
}
}
---------- END SOURCE ----------
java version "1.5.0_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_02-b09)
Java HotSpot(TM) Client VM (build 1.5.0_02-b09, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
This definitely occurs under Windows XP (5.1.2600) and Linux (2.4.20-8)
A DESCRIPTION OF THE PROBLEM :
The javadoc class comment for DecimalFormat states that the negative subpattern is optional, but that if it is supplied, it is used to determine the negative prefix and negative suffix.
If I use a DecimalFormat constructor that supplies a negative subpattern with no negative prefix nor negative suffix, I get a default negative prefix (-) applied to my strings, instead of no prefix as I would expect.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the supplied source code
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
23.23
23.23
ACTUAL -
-23.23
-23.23
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.text.*;
import java.math.*;
class test {
public static void main(String[] argv) throws Exception {
DecimalFormat df = new DecimalFormat("#,##0.##;#,##0.##");
System.out.println(df.format(new Double(-23.23)));
System.out.println(df.format(new BigDecimal("-23.23")));
}
}
---------- END SOURCE ----------
- relates to
-
JDK-6609740 [Fmt-De] format error in DecimalFormat
- Resolved