Hi,

This fixes one more mauve regression. Depending on the exact exit
condition of the loop in parse() the position was set at the last
character of the number or at the character right after the number. This
patch makes sure we increment the index always and then sets the index
to after the last character actually parsed/examined.

2006-12-01  Mark Wielaard  <[EMAIL PROTECTED]>

    * java/text/DecimalFormat.java (parse): Always increment
    parsing index and adjust pos result.

Committed,

Mark

diff -u -r1.30 DecimalFormat.java
--- java/text/DecimalFormat.java        1 Dec 2006 22:30:57 -0000       1.30
+++ java/text/DecimalFormat.java        2 Dec 2006 00:48:30 -0000
@@ -660,11 +660,11 @@
     int len = str.length();
     if (len < stop) stop = len;

-    char ch;
-    int i = 0;
-    for (i = start; i < stop; i++)
+    int i = start;
+    while (i < stop)
       {
-        ch = str.charAt(i);
+        char ch = str.charAt(i);
+        i++;

         if (ch >= zero && ch <= (zero + 9))
           {
@@ -749,7 +749,7 @@

     if (isNegative) number.insert(0, '-');

-    pos.setIndex(i);
+    pos.setIndex(i - 1);

     // now we handle the return type
     BigDecimal bigDecimal = new BigDecimal(number.toString());

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to