diff options
author | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-07-02 19:43:06 +0000 |
---|---|---|
committer | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-07-02 19:43:06 +0000 |
commit | 340da04944ae705cc94da5628fb55298f709a361 (patch) | |
tree | f83a49525563be9ea4e280422308112655a95719 /libjava | |
parent | 617763557711795ccc8087e4c7af30832f1af171 (diff) | |
download | gcc-340da04944ae705cc94da5628fb55298f709a361.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@55191 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava')
-rw-r--r-- | libjava/ChangeLog | 10 | ||||
-rw-r--r-- | libjava/java/text/ChoiceFormat.java | 8 | ||||
-rw-r--r-- | libjava/java/text/MessageFormat.java | 11 |
3 files changed, 17 insertions, 12 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index e6d8de19192..24696fd1b87 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -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 diff --git a/libjava/java/text/ChoiceFormat.java b/libjava/java/text/ChoiceFormat.java index 710a725990e..f7bdde1e294 100644 --- a/libjava/java/text/ChoiceFormat.java +++ b/libjava/java/text/ChoiceFormat.java @@ -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; } } diff --git a/libjava/java/text/MessageFormat.java b/libjava/java/text/MessageFormat.java index d31d95b6bea..f5ee3492974 100644 --- a/libjava/java/text/MessageFormat.java +++ b/libjava/java/text/MessageFormat.java @@ -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); |