Hi,
the attached patch fixes a problem when you numberformat pattern
contains the currency replacement character (/u00a4).

I suggest that this patch should be added to GCJ as well, as it fixes an
annoying issue.

Regards
Robert

ChangeLog:

2008-09-04  Robert Schuster  <[EMAIL PROTECTED]>

    * java/text/DecimalFormat.java:
    (scanFix): Use 'i + 1' when looking at following character.
    (scanNegativePattern): Dito.


Index: java/text/DecimalFormat.java
===================================================================
RCS file: /sources/classpath/classpath/java/text/DecimalFormat.java,v
retrieving revision 1.37
diff -u -r1.37 DecimalFormat.java
--- java/text/DecimalFormat.java	17 Aug 2008 22:31:56 -0000	1.37
+++ java/text/DecimalFormat.java	3 Sep 2008 23:01:41 -0000
@@ -1321,7 +1321,7 @@
             currencySymbol = this.symbols.getCurrencySymbol();
 
             // if \u00A4 is doubled, we use the international currency symbol
-            if (i < len && pattern.charAt(i + 1) == '\u00A4')
+            if ((i + 1) < len && pattern.charAt(i + 1) == '\u00A4')
               {
                 currencySymbol = this.symbols.getInternationalCurrencySymbol();
                 i++;
@@ -1345,7 +1345,7 @@
         else if (ch == '\'')
           {
             // QUOTE
-            if (i < len && pattern.charAt(i + 1) == '\'')
+            if ((i + 1) < len && pattern.charAt(i + 1) == '\'')
               {
                 // we need to add ' to the buffer 
                 buffer.append(ch);
@@ -1717,7 +1717,7 @@
         else if (ch == '\'')
           {
             // QUOTE
-            if (i < len && pattern.charAt(i + 1) == '\'')
+            if ((i + 1) < len && pattern.charAt(i + 1) == '\'')
               {
                 // we need to add ' to the buffer 
                 buffer.append(ch);

Reply via email to