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)
======================================================================