MessageFormat.java (MessageFormat(String)): Set the default locale.
authorBryce McKinlay <bryce@albatross.co.nz>
Wed, 22 Sep 1999 04:41:26 +0000 (04:41 +0000)
committerBryce McKinlay <bryce@gcc.gnu.org>
Wed, 22 Sep 1999 04:41:26 +0000 (05:41 +0100)
1999-09-16  Bryce McKinlay  <bryce@albatross.co.nz>
* java/text/MessageFormat.java (MessageFormat(String)): Set the
default locale.
* java/text/NumberFormat.java: Check that object is a Number. If
not, throw IllegialArgumentException.

From-SVN: r29574

libjava/ChangeLog
libjava/java/text/MessageFormat.java
libjava/java/text/NumberFormat.java

index f054dbee2e129230286f7a6e5ccccf0fd76cfd21..703d19495e5506c1a2b1817ad638bb3f5714c5e4 100644 (file)
@@ -1,3 +1,9 @@
+1999-09-16  Bryce McKinlay  <bryce@albatross.co.nz>
+       * java/text/MessageFormat.java (MessageFormat(String)): Set the
+       default locale.
+       * java/text/NumberFormat.java: Check that object is a Number. If
+       not, throw IllegialArgumentException.
+
 1999-09-21  Tom Tromey  <tromey@cygnus.com>
 
        * gnu/gcj/convert/Output_UTF8.java (write): Don't exit loop unless
index 8b42235796610f4b496a533a837a44ffc2e5249b..891a0c3e3d86023014484fa2c2f500007070f77c 100644 (file)
@@ -400,6 +400,7 @@ public class MessageFormat extends Format
 
   public MessageFormat (String pattern)
     {
+      locale = Locale.getDefault();
       applyPattern (pattern);
     }
 
index 6ee79b3b546b830a37f71b0284d7bb7ff1f57b98..a3f7f95294c40155a4e895cdf65c05c2079ae2c4 100644 (file)
@@ -37,7 +37,11 @@ public abstract class NumberFormat extends Format implements Cloneable
   public final StringBuffer format (Object obj, StringBuffer sbuf,
                                    FieldPosition pos)
     {
-      return format(((Number) obj).doubleValue(), sbuf, pos);
+      if (obj instanceof Number)
+        return format(((Number) obj).doubleValue(), sbuf, pos);
+      else
+        throw new IllegalArgumentException 
+          ("Cannot format given Object as a Number");
     }
 
   public abstract StringBuffer format (double number,