Commit 81043a94 by Gary Benson Committed by Tom Tromey

re PR libgcj/21736 (MessageFormat("{0,time,medium}") fails)

2005-05-24  Gary Benson  <gbenson@redhat.com>

	PR libgcj/21736:
	* java/text/MessageFormat.java (MessageFormatElement.setLocale):
	Handle DateFormat.DEFAULT case correctly.

From-SVN: r100154
parent 93f8e21b
2005-05-24 Gary Benson <gbenson@redhat.com>
PR libgcj/21736:
* java/text/MessageFormat.java (MessageFormatElement.setLocale):
Handle DateFormat.DEFAULT case correctly.
2005-05-21 Tom Tromey <tromey@redhat.com> 2005-05-21 Tom Tromey <tromey@redhat.com>
PR libgcj/21703: PR libgcj/21703:
......
...@@ -113,6 +113,7 @@ public class MessageFormat extends Format ...@@ -113,6 +113,7 @@ public class MessageFormat extends Format
formatClass = java.util.Date.class; formatClass = java.util.Date.class;
int val = DateFormat.DEFAULT; int val = DateFormat.DEFAULT;
boolean styleIsPattern = false;
if (style == null) if (style == null)
; ;
else if (style.equals("short")) else if (style.equals("short"))
...@@ -123,13 +124,15 @@ public class MessageFormat extends Format ...@@ -123,13 +124,15 @@ public class MessageFormat extends Format
val = DateFormat.LONG; val = DateFormat.LONG;
else if (style.equals("full")) else if (style.equals("full"))
val = DateFormat.FULL; val = DateFormat.FULL;
else
styleIsPattern = true;
if (type.equals("time")) if (type.equals("time"))
format = DateFormat.getTimeInstance(val, loc); format = DateFormat.getTimeInstance(val, loc);
else else
format = DateFormat.getDateInstance(val, loc); format = DateFormat.getDateInstance(val, loc);
if (style != null && val == DateFormat.DEFAULT) if (styleIsPattern)
{ {
SimpleDateFormat sdf = (SimpleDateFormat) format; SimpleDateFormat sdf = (SimpleDateFormat) format;
sdf.applyPattern(style); sdf.applyPattern(style);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment