Hi,

I think this is a bug of java/text/DecimalFormat.java:

When the following program is run,

import java.text.DecimalFormat;
public class N {
    public static void main(String[] args) throws Exception {
       DecimalFormat nf = new DecimalFormat("#,##0X");
       System.out.println(nf.parse("1"));
       System.out.println(nf.parse("1Y"));
    }
}

Sun's JDK throws java.text.ParseException, but GNU Classpath's
java.text.DecimalFormat gives wrong results:

$ kaffe N
1
1

Here is my patch.  In order to test this, I have updated the mauve test
of gnu/testlet/java/text/DecimalFormat/parse.java.

ChangeLog:
2005-03-01  Ito Kazumitsu  <[EMAIL PROTECTED]>

        * java/text/DecimalFormat.java (parse):
        Check whether the positive suffix matches the pattern. 

Patch:
######
--- java/text/DecimalFormat.java.orig   Thu Jan  6 08:43:11 2005
+++ java/text/DecimalFormat.java        Tue Mar  1 18:08:36 2005
@@ -989,6 +989,11 @@
        pos.setErrorIndex(index);
        return null;
       }
+    else if (! got_pos_suf)
+      {
+       pos.setErrorIndex(index);
+       return null;
+      }
 
     String suffix = is_neg ? ns : positiveSuffix;
     long parsedMultiplier = 1;
######


_______________________________________________
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to