classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] Patch: FYI: Fix MessageFormat buglet


From: Tom Tromey
Subject: [cp-patches] Patch: FYI: Fix MessageFormat buglet
Date: 24 May 2005 11:57:28 -0600

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  <address@hidden>

        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);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]