re PR libgcj/1906 (difference between gcj and jdk for MessageFormat)
Fix for PR libgcj/1906: * java/text/MessageFormat.java (setLocale): Use named class literals. (forName): Removed. (format(Object,StringBuffer,FieldPosition)): Special case if argument is an Object[]. From-SVN: r39529
This commit is contained in:
parent
1456345e53
commit
a4c6d37356
2 changed files with 26 additions and 25 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2001-02-07 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
|
Fix for PR libgcj/1906:
|
||||||
|
* java/text/MessageFormat.java (setLocale): Use named class
|
||||||
|
literals.
|
||||||
|
(forName): Removed.
|
||||||
|
(format(Object,StringBuffer,FieldPosition)): Special case if
|
||||||
|
argument is an Object[].
|
||||||
|
|
||||||
2001-02-07 Bryce McKinlay <bryce@albatross.co.nz>
|
2001-02-07 Bryce McKinlay <bryce@albatross.co.nz>
|
||||||
|
|
||||||
* java/util/Arrays.java: Removed "cmp" methods.
|
* java/util/Arrays.java: Removed "cmp" methods.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// MessageFormat.java - Localized message formatting.
|
// MessageFormat.java - Localized message formatting.
|
||||||
|
|
||||||
/* Copyright (C) 1999 Free Software Foundation
|
/* Copyright (C) 1999, 2001 Free Software Foundation
|
||||||
|
|
||||||
This file is part of libgcj.
|
This file is part of libgcj.
|
||||||
|
|
||||||
|
@ -45,19 +45,6 @@ final class MessageFormatElement
|
||||||
// Text to follow this element.
|
// Text to follow this element.
|
||||||
String trailer;
|
String trailer;
|
||||||
|
|
||||||
// FIXME: shouldn't need this.
|
|
||||||
Class forName (String name)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return Class.forName (name);
|
|
||||||
}
|
|
||||||
catch (ClassNotFoundException x)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Recompute the locale-based formatter.
|
// Recompute the locale-based formatter.
|
||||||
void setLocale (Locale loc)
|
void setLocale (Locale loc)
|
||||||
{
|
{
|
||||||
|
@ -65,9 +52,7 @@ final class MessageFormatElement
|
||||||
;
|
;
|
||||||
else if (type.equals("number"))
|
else if (type.equals("number"))
|
||||||
{
|
{
|
||||||
// FIXME: named class literal.
|
formatClass = java.lang.Number.class;
|
||||||
// formatClass = Number.class;
|
|
||||||
formatClass = forName ("java.lang.Number");
|
|
||||||
|
|
||||||
if (style == null)
|
if (style == null)
|
||||||
format = NumberFormat.getInstance(loc);
|
format = NumberFormat.getInstance(loc);
|
||||||
|
@ -98,9 +83,7 @@ final class MessageFormatElement
|
||||||
}
|
}
|
||||||
else if (type.equals("time") || type.equals("date"))
|
else if (type.equals("time") || type.equals("date"))
|
||||||
{
|
{
|
||||||
// FIXME: named class literal.
|
formatClass = java.util.Date.class;
|
||||||
// formatClass = Date.class;
|
|
||||||
formatClass = forName ("java.util.Date");
|
|
||||||
|
|
||||||
int val = DateFormat.DEFAULT;
|
int val = DateFormat.DEFAULT;
|
||||||
if (style == null)
|
if (style == null)
|
||||||
|
@ -127,9 +110,7 @@ final class MessageFormatElement
|
||||||
}
|
}
|
||||||
else if (type.equals("choice"))
|
else if (type.equals("choice"))
|
||||||
{
|
{
|
||||||
// FIXME: named class literal.
|
formatClass = java.lang.Number.class;
|
||||||
// formatClass = Number.class;
|
|
||||||
formatClass = forName ("java.lang.Number");
|
|
||||||
|
|
||||||
if (style == null)
|
if (style == null)
|
||||||
throw new
|
throw new
|
||||||
|
@ -370,8 +351,19 @@ public class MessageFormat extends Format
|
||||||
public final StringBuffer format (Object singleArg, StringBuffer appendBuf,
|
public final StringBuffer format (Object singleArg, StringBuffer appendBuf,
|
||||||
FieldPosition ignore)
|
FieldPosition ignore)
|
||||||
{
|
{
|
||||||
Object[] args = new Object[1];
|
Object[] args;
|
||||||
args[0] = singleArg;
|
|
||||||
|
if (singleArg instanceof Object[])
|
||||||
|
{
|
||||||
|
// This isn't specified in any manual, but it follows the
|
||||||
|
// JDK implementation.
|
||||||
|
args = (Object[]) singleArg;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
args = new Object[1];
|
||||||
|
args[0] = singleArg;
|
||||||
|
}
|
||||||
return format (args, appendBuf, ignore);
|
return format (args, appendBuf, ignore);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue