Patch: FYI: Fix MessageFormat buglet

Tom Tromey tromey@redhat.com
Tue May 24 18:35:00 GMT 2005


I'm checking this in on the trunk (once slushy-ness ceases), the 4.0
branch, and Classpath.

This is the fix that Gary posted in PR 21736.  There is already a test
case in Mauve for this; this fixes 3 mauve failures.

Tom

Index: ChangeLog
from  Gary Benson  <gbenson@redhat.com>

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

Index: java/text/MessageFormat.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/text/MessageFormat.java,v
retrieving revision 1.23
diff -u -r1.23 MessageFormat.java
--- java/text/MessageFormat.java 20 Feb 2005 21:18:30 -0000 1.23
+++ java/text/MessageFormat.java 24 May 2005 17:57:38 -0000
@@ -113,6 +113,7 @@
 	  formatClass = java.util.Date.class;
 
 	  int val = DateFormat.DEFAULT;
+	  boolean styleIsPattern = false;
 	  if (style == null)
 	    ;
 	  else if (style.equals("short"))
@@ -123,13 +124,15 @@
 	    val = DateFormat.LONG;
 	  else if (style.equals("full"))
 	    val = DateFormat.FULL;
+	  else
+	    styleIsPattern = true;
 
 	  if (type.equals("time"))
 	    format = DateFormat.getTimeInstance(val, loc);
 	  else
 	    format = DateFormat.getDateInstance(val, loc);
 
-	  if (style != null && val == DateFormat.DEFAULT)
+	  if (styleIsPattern)
 	    {
 	      SimpleDateFormat sdf = (SimpleDateFormat) format;
 	      sdf.applyPattern(style);



More information about the Java-patches mailing list