aboutsummaryrefslogtreecommitdiff
path: root/libjava
diff options
context:
space:
mode:
authorBryce McKinlay <bryce@albatross.co.nz>1999-09-22 04:41:26 +0000
committerBryce McKinlay <bryce@gcc.gnu.org>1999-09-22 05:41:26 +0100
commit5ab00e275b539136f48c62b2363936e92d4272c0 (patch)
tree57703937fd6e5e454ca527734ee854ed01054636 /libjava
parent00ec6daa3ca775bae5983d6df8d3085726f6c4b0 (diff)
downloadgcc-5ab00e275b539136f48c62b2363936e92d4272c0.zip
gcc-5ab00e275b539136f48c62b2363936e92d4272c0.tar.gz
gcc-5ab00e275b539136f48c62b2363936e92d4272c0.tar.bz2
MessageFormat.java (MessageFormat(String)): Set the default locale.
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
Diffstat (limited to 'libjava')
-rw-r--r--libjava/ChangeLog6
-rw-r--r--libjava/java/text/MessageFormat.java1
-rw-r--r--libjava/java/text/NumberFormat.java6
3 files changed, 12 insertions, 1 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index f054dbe..703d194 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -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
diff --git a/libjava/java/text/MessageFormat.java b/libjava/java/text/MessageFormat.java
index 8b42235..891a0c3 100644
--- a/libjava/java/text/MessageFormat.java
+++ b/libjava/java/text/MessageFormat.java
@@ -400,6 +400,7 @@ public class MessageFormat extends Format
public MessageFormat (String pattern)
{
+ locale = Locale.getDefault();
applyPattern (pattern);
}
diff --git a/libjava/java/text/NumberFormat.java b/libjava/java/text/NumberFormat.java
index 6ee79b3..a3f7f95 100644
--- a/libjava/java/text/NumberFormat.java
+++ b/libjava/java/text/NumberFormat.java
@@ -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,