2002-07-02 Tom Tromey <tromey@redhat.com>
authorTom Tromey <tromey@redhat.com>
Tue, 2 Jul 2002 19:43:06 +0000 (19:43 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Tue, 2 Jul 2002 19:43:06 +0000 (19:43 +0000)
            David Hovemeyer  <daveho@cs.umd.edu>

* java/text/ChoiceFormat.java
(format(double,StringBuffer,FieldPosition)): Fix fencepost error
in check loop.
* java/text/MessageFormat.java
(format(Object[],StringBuffer,FieldPosition): Pass all arguments
to MessageFormat.

Co-Authored-By: David Hovemeyer <daveho@cs.umd.edu>
From-SVN: r55191

libjava/ChangeLog
libjava/java/text/ChoiceFormat.java
libjava/java/text/MessageFormat.java

index e6d8de191927742cd42377408407fd2962ff4783..24696fd1b87b0af76b268905a6a9a2e636dbde97 100644 (file)
@@ -1,3 +1,13 @@
+2002-07-02  Tom Tromey  <tromey@redhat.com>
+            David Hovemeyer  <daveho@cs.umd.edu>
+
+       * java/text/ChoiceFormat.java
+       (format(double,StringBuffer,FieldPosition)): Fix fencepost error
+       in check loop.
+       * java/text/MessageFormat.java
+       (format(Object[],StringBuffer,FieldPosition): Pass all arguments
+       to MessageFormat.
+
 2002-07-01  Tom Tromey  <tromey@redhat.com>
 
        * javax/naming/spi/NamingManager.java (getPlusPath): Don't create
index 710a725990efc9205ea8b645a7a69438081e4c53..f7bdde1e294401509eb8517b51d6f9a05b8801a1 100644 (file)
@@ -1,5 +1,5 @@
 /* ChoiceFormat.java -- Format over a range of numbers
-   Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -259,14 +259,12 @@ public class ChoiceFormat extends NumberFormat
     if (choiceLimits.length == 0)
       return appendBuf;
 
-    int index =  0;
+    int index = 0;
     if (! Double.isNaN(num) && num >= choiceLimits[0])
       {
        for (; index < choiceLimits.length - 1; ++index)
          {
-           if (choiceLimits[index] <= num
-               && index != choiceLimits.length - 2
-               && num < choiceLimits[index + 1])
+           if (choiceLimits[index] <= num && num < choiceLimits[index + 1])
              break;
          }
       }
index d31d95b6bea88758497d863b9630e223fa681eba..f5ee3492974ff9068023915dc772ba2bbd82ca1c 100644 (file)
@@ -1,5 +1,5 @@
 /* MessageFormat.java - Localized message formatting.
-   Copyright (C) 1999, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -373,17 +373,14 @@ public class MessageFormat extends Format
            if (formatter instanceof ChoiceFormat)
              {
                StringBuffer buf = new StringBuffer ();
-               // FIXME: don't actually know what is correct here.
-               // Can a sub-format refer to any argument, or just
-               // the single argument passed to it?  Must test
-               // against JDK.
                formatter.format(thisArg, buf, ignore);
                MessageFormat mf = new MessageFormat ();
                mf.setLocale(locale);
                mf.applyPattern(buf.toString());
-               formatter = mf;
+               mf.format(arguments, appendBuf, ignore);
              }
-           formatter.format(thisArg, appendBuf, ignore);
+           else
+             formatter.format(thisArg, appendBuf, ignore);
          }
 
        appendBuf.append(elements[i].trailer);