This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[PATCH] Fix TimeZone.getDefaultDisplayName
- From: Jakub Jelinek <jakub at redhat dot com>
- To: java-patches at gcc dot gnu dot org
- Date: Sat, 24 Feb 2007 11:54:01 -0500
- Subject: [PATCH] Fix TimeZone.getDefaultDisplayName
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
getDefaultDisplayName from the pre-1.4 days was only calling
getDSTSavings on SimpleTimeZone. But as TimeZone itself now defines
getDSTSavings(), we can call it always (which fixes a bug when
getDefaultDisplayName is used on gnu.java.util.ZoneInfo instance).
Ok to commit?
2007-02-24 Jakub Jelinek <jakub@redhat.com>
* java/util/TimeZone.java (getDefaultDisplayName): Don't
check if TimeZone is instanceof SimpleTimeZone.
--- libjava/classpath/java/util/TimeZone.java.jj 2007-02-20 16:48:51.000000000 +0100
+++ libjava/classpath/java/util/TimeZone.java 2007-02-24 17:47:22.000000000 +0100
@@ -1402,14 +1402,7 @@ public abstract class TimeZone implement
private String getDefaultDisplayName(boolean dst)
{
- int offset = getRawOffset();
- if (dst && this instanceof SimpleTimeZone)
- {
- // ugly, but this is a design failure of the API:
- // getDisplayName takes a dst parameter even though
- // TimeZone knows nothing about daylight saving offsets.
- offset += ((SimpleTimeZone) this).getDSTSavings();
- }
+ int offset = getRawOffset() + (dst ? getDSTSavings() : 0);
StringBuffer sb = new StringBuffer(9);
sb.append("GMT");
Jakub