re PR libgcj/21736 (MessageFormat("{0,time,medium}") fails)
authorGary Benson <gbenson@redhat.com>
Wed, 25 May 2005 15:25:38 +0000 (15:25 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Wed, 25 May 2005 15:25:38 +0000 (15:25 +0000)
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

libjava/ChangeLog
libjava/java/text/MessageFormat.java

index 4d1cfb95b9a045874c6f20e53028247723af14bc..be3a5351fd5727347fda01ca0dfe9d88a3d0b2ea 100644 (file)
@@ -1,3 +1,9 @@
+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>
 
        PR libgcj/21703:
index 6c1b0508bdaa98948f52322c94e962933d15d1e1..4a24afd1f44ba4f3632925014905f2d00927d35e 100644 (file)
@@ -113,6 +113,7 @@ public class MessageFormat extends Format
          formatClass = java.util.Date.class;
 
          int val = DateFormat.DEFAULT;
+         boolean styleIsPattern = false;
          if (style == null)
            ;
          else if (style.equals("short"))
@@ -123,13 +124,15 @@ public class MessageFormat extends Format
            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);