[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Bug Report: unexpected IllegalArgumentException from java.text.DecimalFo
From: |
Ito Kazumitsu |
Subject: |
Bug Report: unexpected IllegalArgumentException from java.text.DecimalFormat |
Date: |
Thu, 23 Oct 2003 00:38:14 +0900 |
User-agent: |
EMH/1.10.0 SEMI/1.13.7 (Awazu) FLIM/1.13.2 (Kasanui) Emacs/21.2 (i386-unknown-freebsd4.7) MULE/5.0 (SAKAKI) |
The attached program gives the following result:
bash-2.05b$ java TestDecimalFormat
0.00% java.lang.IllegalArgumentException: unexpected special character - index:
4
Which is not the case with Sun's JDK.
In the kaffe world, I applied the following patch:
--- java/text/DecimalFormat.java.orig Thu Aug 28 00:44:12 2003
+++ java/text/DecimalFormat.java Wed Oct 22 17:57:28 2003
@@ -205,6 +205,8 @@
}
else if (c != syms.getExponential()
&& c != syms.getPatternSeparator()
+ && c != syms.getPercent()
+ && c != syms.getPerMill()
&& patChars.indexOf(c) != -1)
throw new IllegalArgumentException ("unexpected special " +
"character - index: " +
index);
And the program for this case follows:
import java.text.DecimalFormat;
public class TestDecimalFormat {
public static void main(String[] args) {
String[] formats = new String[] {
"0",
"0.00",
"#,##0",
"#,##0.00",
"$#,##0;($#,##0)",
"$#,##0;($#,##0)",
"$#,##0.00;($#,##0.00)",
"$#,##0.00;($#,##0.00)",
"0%",
"0.00%",
"0.00E00",
"#,##0;(#,##0)",
"#,##0;(#,##0)",
"#,##0.00;(#,##0.00)",
"#,##0.00;(#,##0.00)",
"#,##0;(#,##0)",
"$#,##0;($#,##0)",
"#,##0.00;(#,##0.00)",
"$#,##0.00;($#,##0.00)",
"##0.0E0" };
for(int i=0; i < formats.length; i++) {
try {
DecimalFormat d = new DecimalFormat(formats[i]);
}
catch (Exception e) {
System.err.println(formats[i] + " " + e);
}
}
}
}
- Bug Report: unexpected IllegalArgumentException from java.text.DecimalFormat,
Ito Kazumitsu <=