JDK-4838107 : DecimalFormat puts text prefix in front of the exponent number
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.text
  • Affected Version: 1.3.0,1.4.0,1.4.1
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2003-03-26
  • Updated: 2003-12-02
  • Resolved: 2003-12-02
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.
Other
5.0 b30Fixed
Related Reports
Duplicate :  
Duplicate :  
Description

Name: nt126004			Date: 03/26/2003


FULL PRODUCT VERSION :
java version "1.4.1_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_02-b06)
Java HotSpot(TM) Client VM (build 1.4.1_02-b06, mixed mode)

FULL OS VERSION :
Microsoft Windows 2000 [Version 5.00.2195]

A DESCRIPTION OF THE PROBLEM :
This pattern:
  Hook is a codfish#.#########E00

produces this output:
  Hook is a codfish2.19E-Hook is a codfish01

for 0.219

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Use this demo code, or demo code included:
http://www.supelec-rennes.fr/ren/serv/tutojava1.1/i18n/number/example-1dot1/DecimalFormatDemo.java
2. and add the pattern above like this:
 customFormat("Hook is a codfish#.#########E00", .219);

EXPECTED VERSUS ACTUAL BEHAVIOR :
  Hook is a codfish2.19E-01
  Hook is a codfish2.19E-Hook is a codfish01

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------

import java.util.*;
import java.text.*;

public class DecimalFormatDemo {

   static public void customFormat(String pattern, double value ) {
      DecimalFormat myFormatter = new DecimalFormat(pattern);
      String output = myFormatter.format(value);
      System.out.println(value + "  " + pattern + "  " + output);
   }

   static public void main(String[] args) {

      customFormat("Hook is a codfish#.#########E00", .219);

   }
}
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
attempted this, it has one less 0 on the end:
  Hook is a codfish#.#########E0

with the same result.
(Review ID: 183056) 
======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger tiger-beta FIXED IN: tiger-beta INTEGRATED IN: tiger-b30 tiger-beta
14-06-2004

EVALUATION From Java API Doc: | Negative exponents are formatted using the localized minus sign, | not the prefix and suffix from the pattern. Will be fixed in Tiger. ###@###.### 2003-03-27
27-03-2003