JDK-6609740 : [Fmt-De] format error in DecimalFormat
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.text
  • Affected Version: 5.0,6u26
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_xp,windows_vista
  • CPU: x86
  • Submitted: 2007-09-26
  • Updated: 2017-12-12
  • Resolved: 2017-05-19
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 10
10 b09Fixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Description
FULL PRODUCT VERSION :
J2SE 1.4     J2SE 1.5

ADDITIONAL OS VERSION INFORMATION :
windows XP

EXTRA RELEVANT SYSTEM CONFIGURATION :
nothing

A DESCRIPTION OF THE PROBLEM :
DecimalFormat format = new  DecimalFormat("#,##0.0#; (#)");
double number2 = -3456.349347;
System.out.println(format.format(number2));

Result expected is:  (3,456.35)
But I got :  (3,456.35

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the following code, will get wrong result:

DecimalFormat format = new  DecimalFormat("#,##0.0#; (#)");
double number2 = -3456.349347;
System.out.println(format.format(number2));

Result expected is:  (3,456.35)
But I got :  (3,456.35


REPRODUCIBILITY :
This bug can be reproduced always.