From 9b2dc1f627391c7cb62c0c893f863d59e2c91c0c Mon Sep 17 00:00:00 2001 From: peytoia Date: Mon, 31 Aug 2009 12:55:15 +0900 Subject: [PATCH] 6851214: (tz) New Jordan rule creates a failure for SimpleTimeZone parsing post tzdata2009h Reviewed-by: okutsu --- .../classes/java/util/SimpleTimeZone.java | 4 +- test/java/util/TimeZone/ListTimeZones.java | 45 +++++++++++++++++++ 2 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 test/java/util/TimeZone/ListTimeZones.java diff --git a/src/share/classes/java/util/SimpleTimeZone.java b/src/share/classes/java/util/SimpleTimeZone.java index b0fd57de8..d97d6f59a 100644 --- a/src/share/classes/java/util/SimpleTimeZone.java +++ b/src/share/classes/java/util/SimpleTimeZone.java @@ -1372,7 +1372,7 @@ public class SimpleTimeZone extends TimeZone { throw new IllegalArgumentException( "Illegal start month " + startMonth); } - if (startTime < 0 || startTime >= millisPerDay) { + if (startTime < 0 || startTime > millisPerDay) { throw new IllegalArgumentException( "Illegal start time " + startTime); } @@ -1419,7 +1419,7 @@ public class SimpleTimeZone extends TimeZone { throw new IllegalArgumentException( "Illegal end month " + endMonth); } - if (endTime < 0 || endTime >= millisPerDay) { + if (endTime < 0 || endTime > millisPerDay) { throw new IllegalArgumentException( "Illegal end time " + endTime); } diff --git a/test/java/util/TimeZone/ListTimeZones.java b/test/java/util/TimeZone/ListTimeZones.java new file mode 100644 index 000000000..88e0e866c --- /dev/null +++ b/test/java/util/TimeZone/ListTimeZones.java @@ -0,0 +1,45 @@ +/* + * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + */ + +/** + * @test + * @bug 6851214 + * @summary Allow 24:00 as a valid end/start DST time stamp + * @run main ListTimeZones + */ + +import java.util.*; + +public class ListTimeZones{ + public static void main(String[] args){ + Date date = new Date(); + String TimeZoneIds[] = TimeZone.getAvailableIDs(); + for(int i = 0; i < TimeZoneIds.length; i++){ + TimeZone tz = TimeZone.getTimeZone(TimeZoneIds[i]); + Calendar calendar = new GregorianCalendar(tz); + String calString = calendar.toString(); + } + } +} -- GitLab