From 46f32b2b9096aef6888b3a1882d88467b845e5fe Mon Sep 17 00:00:00 2001
From: Mark Wielaard
Date: Wed, 16 Nov 2005 19:43:53 +0000
Subject: [PATCH] [multiple changes]
2005-11-15 Tom Tromey
- * This class represents a specific time in milliseconds since the epoch.
- * The epoch is 1970, January 1 00:00:00.0000 UTC.
- *
- *
- * The representations of the date fields are as follows:
- * Date
is intended to reflect universal time coordinate (UTC),
- * but this depends on the underlying host environment. Most operating systems
- * don't handle the leap second, which occurs about once every year or
- * so. The leap second is added to the last minute of the day on either
- * the 30th of June or the 31st of December, creating a minute 61 seconds
- * in length.
- *
- *
- *
- * Prior to JDK 1.1, this class was the sole class handling date and time
- * related functionality. However, this particular solution was not
- * amenable to internationalization. The new Calendar
- * class should now be used to handle dates and times, with Date
- * being used only for values in milliseconds since the epoch. The
- * Calendar
class, and its concrete implementations, handle
- * the interpretation of these values into minutes, hours, days, months
- * and years. The formatting and parsing of dates is left to the
- * DateFormat
class, which is able to handle the different
- * types of date format which occur in different locales.
- *
new GregorianCalendar(year+1900, month,
- * day)
instead.
- * @param year the difference between the required year and 1900.
- * @param month the month as a value between 0 and 11.
- * @param day the day as a value between 0 and 31.
- */
- public Date(int year, int month, int day)
- {
- this(year, month, day, 0, 0, 0);
- }
-
- /**
- * Creates a new Date Object representing the given time.
- *
- * @deprecated use new GregorianCalendar(year+1900, month,
- * day, hour, min)
instead.
- * @param year the difference between the required year and 1900.
- * @param month the month as a value between 0 and 11.
- * @param day the day as a value between 0 and 31.
- * @param hour the hour as a value between 0 and 23, in 24-hour
- * clock notation.
- * @param min the minute as a value between 0 and 59.
- */
- public Date(int year, int month, int day, int hour, int min)
- {
- this(year, month, day, hour, min, 0);
- }
-
- /**
- * Creates a new Date Object representing the given time.
- *
- * @deprecated use new GregorianCalendar(year+1900, month,
- * day, hour, min, sec)
instead.
- * @param year the difference between the required year and 1900.
- * @param month the month as a value between 0 and 11.
- * @param day the day as a value between 0 and 31.
- * @param hour the hour as a value between 0 and 23, in 24-hour
- * clock notation.
- * @param min the minute as a value between 0 and 59.
- * @param sec the second as a value between 0 and 61 (with 60
- * and 61 being leap seconds).
- */
- public Date(int year, int month, int day, int hour, int min, int sec)
- {
- GregorianCalendar cal =
- new GregorianCalendar(year + 1900, month, day, hour, min, sec);
- time = cal.getTimeInMillis();
- }
-
- /**
- * Creates a new Date from the given string representation. This
- * does the same as new Date(Date.parse(s))
- * @see #parse
- * @deprecated use java.text.DateFormat.parse(s)
instead.
- */
- public Date(String s)
- {
- time = parse(s);
- }
-
- /**
- * Returns a copy of this Date
object.
- *
- * @return a copy, or null if the object couldn't be
- * cloned.
- * @see Object#clone()
- */
- public Object clone()
- {
- try
- {
- return super.clone();
- }
- catch (CloneNotSupportedException ex)
- {
- return null;
- }
- }
-
- /**
- * Returns the number of milliseconds since the epoch
- * specified by the given arguments. The arguments are
- * interpreted relative to UTC rather than the local
- * time zone.
- *
- * @deprecated Use Calendar
with a UTC
- * TimeZone
instead.
- * @param year the difference between the required year and 1900.
- * @param month the month as a value between 0 and 11.
- * @param day the day as a value between 0 and 31.
- * @param hour the hour as a value between 0 and 23, in 24-hour
- * clock notation.
- * @param min the minute as a value between 0 and 59.
- * @param sec the second as a value between 0 and 61 (with 60
- * and 61 being leap seconds).
- * @return the time in milliseconds since the epoch.
- */
- public static long UTC(int year, int month, int date,
- int hrs, int min, int sec)
- {
- GregorianCalendar cal =
- new GregorianCalendar(year + 1900, month, date, hrs, min, sec);
- cal.set(Calendar.ZONE_OFFSET, 0);
- cal.set(Calendar.DST_OFFSET, 0);
- return cal.getTimeInMillis();
- }
-
- /**
- * Gets the time represented by this object.
- *
- * @return the time in milliseconds since the epoch.
- */
- public long getTime()
- {
- return time;
- }
-
- /**
- * Returns the number of minutes offset used with UTC to give the time
- * represented by this object in the current time zone. The date information
- * from this object is also used to determine whether or not daylight savings
- * time is in effect. For example, the offset for the UK would be 0 if the
- * month of the date object was January, and 1 if the month was August.
- *
- * @deprecated use
- * Calendar.get(Calendar.ZONE_OFFSET)+Calendar.get(Calendar.DST_OFFSET)
- * instead.
- * @return The time zone offset in minutes of the local time zone
- * relative to UTC. The time represented by this object is used to
- * determine if we should use daylight savings.
- */
- public int getTimezoneOffset()
- {
- Calendar cal = Calendar.getInstance();
- cal.setTimeInMillis(time);
- return - (cal.get(Calendar.ZONE_OFFSET)
- + cal.get(Calendar.DST_OFFSET)) / (60 * 1000);
- }
-
- /**
- * Sets the time which this object should represent.
- *
- * @param time the time in milliseconds since the epoch.
- */
- public void setTime(long time)
- {
- this.time = time;
- }
-
- /**
- * Tests if this date is after the specified date.
- *
- * @param when the other date
- * @return true, if the date represented by this object is
- * strictly later than the time represented by when.
- */
- public boolean after(Date when)
- {
- return time > when.time;
- }
-
- /**
- * Tests if this date is before the specified date.
- *
- * @param when the other date
- * @return true, if the date represented by when is strictly later
- * than the time represented by this object.
- */
- public boolean before(Date when)
- {
- return time < when.time;
- }
-
- /**
- * Compares two dates for equality.
- *
- * @param obj the object to compare.
- * @return true, if obj is a Date object and the time represented
- * by obj is exactly the same as the time represented by this
- * object.
- */
- public boolean equals(Object obj)
- {
- return (obj instanceof Date && time == ((Date) obj).time);
- }
-
- /**
- * Compares two dates.
- *
- * @param when the other date.
- * @return 0, if the date represented
- * by obj is exactly the same as the time represented by this
- * object, a negative if this Date is before the other Date, and
- * a positive value otherwise.
- */
- public int compareTo(Date when)
- {
- return (time < when.time) ? -1 : (time == when.time) ? 0 : 1;
- }
-
- /**
- * Compares this Date to another object. This behaves like
- * compareTo(Date)
, but it takes a generic object
- * and throws a ClassCastException
if obj is
- * not a Date
.
- *
- * @param obj the other date.
- * @return 0, if the date represented
- * by obj is exactly the same as the time represented by this
- * object, a negative if this Date is before the other Date, and
- * a positive value otherwise.
- * @exception ClassCastException if obj is not of type Date.
- */
- public int compareTo(Object obj)
- {
- return compareTo((Date) obj);
- }
-
- /**
- * Computes the hash code of this Date
as the
- * XOR of the most significant and the least significant
- * 32 bits of the 64 bit milliseconds value.
- *
- * @return the hash code.
- */
- public int hashCode()
- {
- return (int) time ^ (int) (time >>> 32);
- }
-
- /**
- * - * Returns a string representation of this date using - * the following date format: - *
- *
- * day mon dd hh:mm:ss zz yyyy
- *
where the fields used here are: - *
day
-- the day of the week
- * (Sunday through to Saturday).
- * mon
-- the month (Jan to Dec).
- * dd
-- the day of the month
- * as two decimal digits (01 to 31).
- * hh
-- the hour of the day
- * as two decimal digits in 24-hour clock notation
- * (01 to 23).
- * mm
-- the minute of the day
- * as two decimal digits (01 to 59).
- * ss
-- the second of the day
- * as two decimal digits (01 to 61).
- * zz
-- the time zone information if available.
- * The possible time zones used include the abbreviations
- * recognised by parse()
(e.g. GMT, CET, etc.)
- * and may reflect the fact that daylight savings time is in
- * effect. The empty string is used if there is no time zone
- * information.
- * yyyy
-- the year as four decimal digits.
- *
- * The DateFormat
class should now be
- * preferred over using this method.
- *
Date
object.
- *
- * @deprecated Use DateFormat.format(Date)
- * @return A locale-dependent string representation.
- * @see #parse(String)
- * @see DateFormat
- */
- public String toLocaleString()
- {
- return java.text.DateFormat.getInstance().format(this);
- }
-
- /**
- *
- * Returns a string representation of this Date
- * object using GMT rather than the local timezone.
- * The following date format is used:
- *
- * d mon yyyy hh:mm:ss GMT
- *
where the fields used here are: - *
d
-- the day of the month
- * as one or two decimal digits (1 to 31).
- * mon
-- the month (Jan to Dec).
- * yyyy
-- the year as four decimal digits.
- * hh
-- the hour of the day
- * as two decimal digits in 24-hour clock notation
- * (01 to 23).
- * mm
-- the minute of the day
- * as two decimal digits (01 to 59).
- * ss
-- the second of the day
- * as two decimal digits (01 to 61).
- * GMT
-- the literal string "GMT"
- * indicating Greenwich Mean Time as opposed to
- * the local timezone.
- *
- * Parses a String and returns the time, in milliseconds since the
- * epoch, it represents. Most syntaxes are handled, including
- * the IETF date standard "day, dd mon yyyy hh:mm:ss zz" (see
- * toString()
for definitions of these fields).
- * Standard U.S. time zone abbreviations are recognised, in
- * addition to time zone offsets in positive or negative minutes.
- * If a time zone is specified, the specified time is assumed to
- * be in UTC and the appropriate conversion is applied, following
- * parsing, to convert this to the local time zone. If no zone
- * is specified, the time is assumed to already be in the local
- * time zone.
- *
- * The method parses the string progressively from left to right.
- * At the end of the parsing process, either a time is returned
- * or an IllegalArgumentException
is thrown to signify
- * failure. The ASCII characters A-Z, a-z, 0-9, and ',', '+', '-',
- * ':' and '/' are the only characters permitted within the string,
- * besides whitespace and characters enclosed within parantheses
- * '(' and ')'.
- *
- * A sequence of consecutive digits are recognised as a number, - * and interpreted as follows: - *
Date
class is initialised.. Given a century,
- * x, the year is assumed to be within the range x - 80 to x + 19. The value
- * itself is then used as a match against the two last digits of one of these
- * years. For example, take x to be 2004. A two-digit year is assumed to fall
- * within the range x - 80 (1924) and x + 19 (2023). Thus, any intepreted value
- * between 0 and 23 is assumed to be 2000 to 2023 and values between 24 and 99
- * are taken as being 1924 to 1999. This only applies for the case of 2004.
- * With a different year, the values will be interpreted differently. 2005
- * will used 0 to 24 as 2000 to 2024 and 25 to 99 as 1925 to 1999, for example.
- * This behaviour differs from that of SimpleDateFormat
and is
- * time-dependent (a two-digit year will be interpreted differently depending
- * on the time the code is run).
- * - * A sequence of consecutive alphabetic characters is recognised as a word, - * and interpreted as follows, in a case-insentive fashion: - *
Date
object and 1900.
- *
- * @return the year minus 1900 represented by this date object.
- * @deprecated Use Calendar instead of Date, and use get(Calendar.YEAR)
- * instead. Note the 1900 difference in the year.
- * @see Calendar
- * @see #setYear(int)
- */
- public int getYear()
- {
- Calendar cal = Calendar.getInstance();
- cal.setTimeInMillis(time);
- return cal.get(Calendar.YEAR) - 1900;
- }
-
- /**
- * Sets the year to the specified year, plus 1900. The other
- * fields are only altered as required to match the same date
- * and time in the new year. Usually, this will mean that
- * the fields are not changed at all, but in the case of
- * a leap day or leap second, the fields will change in
- * relation to the existence of such an event in the new year.
- * For example, if the date specifies February the 29th, 2000,
- * then this will become March the 1st if the year is changed
- * to 2001, as 2001 is not a leap year. Similarly, a seconds
- * value of 60 or 61 may result in the seconds becoming 0 and
- * the minute increasing by 1, if the new time does not include
- * a leap second.
- *
- * @param year the year minus 1900.
- * @deprecated Use Calendar instead of Date, and use
- * set(Calendar.YEAR, year) instead. Note about the 1900
- * difference in year.
- * @see #getYear()
- * @see Calendar
- */
- public void setYear(int year)
- {
- Calendar cal = Calendar.getInstance();
- cal.setTimeInMillis(time);
- cal.set(Calendar.YEAR, 1900 + year);
- time = cal.getTimeInMillis();
- }
-
- /**
- * Returns the month represented by this Date
object,
- * as a value between 0 (January) and 11 (December).
- *
- * @return the month represented by this date object (zero based).
- * @deprecated Use Calendar instead of Date, and use get(Calendar.MONTH)
- * instead.
- * @see #setMonth(int)
- * @see Calendar
- */
- public int getMonth()
- {
- Calendar cal = Calendar.getInstance();
- cal.setTimeInMillis(time);
- return cal.get(Calendar.MONTH);
- }
-
- /**
- * Sets the month to the given value. The other
- * fields are only altered as necessary to match
- * the same date and time in the new month. In most
- * cases, the other fields won't change at all. However,
- * in the case of a shorter month or a leap second, values
- * may be adjusted. For example, if the day of the month
- * is currently 31, and the month value is changed from
- * January (0) to September (8), the date will become
- * October the 1st, as September only has 30 days. Similarly,
- * a seconds value of 60 or 61 (a leap second) may result
- * in the seconds value being reset to 0 and the minutes
- * value being incremented by 1, if the new time does
- * not include a leap second.
- *
- * @param month the month, with a zero-based index
- * from January.
- * @deprecated Use Calendar instead of Date, and use
- * set(Calendar.MONTH, month) instead.
- * @see #getMonth()
- * @see Calendar
- */
- public void setMonth(int month)
- {
- Calendar cal = Calendar.getInstance();
- cal.setTimeInMillis(time);
- cal.set(Calendar.MONTH, month);
- time = cal.getTimeInMillis();
- }
-
- /**
- * Returns the day of the month of this Date
- * object, as a value between 0 and 31.
- *
- * @return the day of month represented by this date object.
- * @deprecated Use Calendar instead of Date, and use get(Calendar.DATE)
- * instead.
- * @see Calendar
- * @see #setDate(int)
- */
- public int getDate()
- {
- Calendar cal = Calendar.getInstance();
- cal.setTimeInMillis(time);
- return cal.get(Calendar.DATE);
- }
-
- /**
- * Sets the date to the given value. The other
- * fields are only altered as necessary to match
- * the same date and time on the new day of the month. In most
- * cases, the other fields won't change at all. However,
- * in the case of a leap second or the day being out of
- * the range of the current month, values
- * may be adjusted. For example, if the day of the month
- * is currently 30 and the month is June, a new day of the
- * month value of 31 will cause the month to change to July,
- * as June only has 30 days . Similarly,
- * a seconds value of 60 or 61 (a leap second) may result
- * in the seconds value being reset to 0 and the minutes
- * value being incremented by 1, if the new time does
- * not include a leap second.
- *
- * @param date the date.
- * @deprecated Use Calendar instead of Date, and use
- * set(Calendar.DATE, date) instead.
- * @see Calendar
- * @see #getDate()
- */
- public void setDate(int date)
- {
- Calendar cal = Calendar.getInstance();
- cal.setTimeInMillis(time);
- cal.set(Calendar.DATE, date);
- time = cal.getTimeInMillis();
- }
-
- /**
- * Returns the day represented by this Date
- * object as an integer between 0 (Sunday) and 6 (Saturday).
- *
- * @return the day represented by this date object.
- * @deprecated Use Calendar instead of Date, and use get(Calendar.DAY_OF_WEEK)
- * instead.
- * @see Calendar
- */
- public int getDay()
- {
- Calendar cal = Calendar.getInstance();
- cal.setTimeInMillis(time);
- // For Calendar, Sunday is 1. For Date, Sunday is 0.
- return cal.get(Calendar.DAY_OF_WEEK) - 1;
- }
-
- /**
- * Returns the hours represented by this Date
- * object as an integer between 0 and 23.
- *
- * @return the hours represented by this date object.
- * @deprecated Use Calendar instead of Date, and use get(Calendar.HOUR_OF_DAY)
- * instead.
- * @see Calendar
- * @see #setHours(int)
- */
- public int getHours()
- {
- Calendar cal = Calendar.getInstance();
- cal.setTimeInMillis(time);
- return cal.get(Calendar.HOUR_OF_DAY);
- }
-
- /**
- * Sets the hours to the given value. The other
- * fields are only altered as necessary to match
- * the same date and time in the new hour. In most
- * cases, the other fields won't change at all. However,
- * in the case of a leap second, values
- * may be adjusted. For example,
- * a seconds value of 60 or 61 (a leap second) may result
- * in the seconds value being reset to 0 and the minutes
- * value being incremented by 1 if the new hour does
- * not contain a leap second.
- *
- * @param hours the hours.
- * @deprecated Use Calendar instead of Date, and use
- * set(Calendar.HOUR_OF_DAY, hours) instead.
- * @see Calendar
- * @see #getHours()
- */
- public void setHours(int hours)
- {
- Calendar cal = Calendar.getInstance();
- cal.setTimeInMillis(time);
- cal.set(Calendar.HOUR_OF_DAY, hours);
- time = cal.getTimeInMillis();
- }
-
- /**
- * Returns the number of minutes represented by the Date
- * object, as an integer between 0 and 59.
- *
- * @return the minutes represented by this date object.
- * @deprecated Use Calendar instead of Date, and use get(Calendar.MINUTE)
- * instead.
- * @see Calendar
- * @see #setMinutes(int)
- */
- public int getMinutes()
- {
- Calendar cal = Calendar.getInstance();
- cal.setTimeInMillis(time);
- return cal.get(Calendar.MINUTE);
- }
-
- /**
- * Sets the minutes to the given value. The other
- * fields are only altered as necessary to match
- * the same date and time in the new minute. In most
- * cases, the other fields won't change at all. However,
- * in the case of a leap second, values
- * may be adjusted. For example,
- * a seconds value of 60 or 61 (a leap second) may result
- * in the seconds value being reset to 0 and the minutes
- * value being incremented by 1 if the new minute does
- * not contain a leap second.
- *
- * @param minutes the minutes.
- * @deprecated Use Calendar instead of Date, and use
- * set(Calendar.MINUTE, minutes) instead.
- * @see Calendar
- * @see #getMinutes()
- */
- public void setMinutes(int minutes)
- {
- Calendar cal = Calendar.getInstance();
- cal.setTimeInMillis(time);
- cal.set(Calendar.MINUTE, minutes);
- time = cal.getTimeInMillis();
- }
-
- /**
- * Returns the number of seconds represented by the Date
- * object, as an integer between 0 and 61 (60 and 61 being leap seconds).
- *
- * @return the seconds represented by this date object.
- * @deprecated Use Calendar instead of Date, and use get(Calendar.SECOND)
- * instead.
- * @see Calendar
- * @see #setSeconds(int)
- */
- public int getSeconds()
- {
- Calendar cal = Calendar.getInstance();
- cal.setTimeInMillis(time);
- return cal.get(Calendar.SECOND);
- }
-
- /**
- * Sets the seconds to the given value. The other
- * fields are only altered as necessary to match
- * the same date and time in the new minute. In most
- * cases, the other fields won't change at all. However,
- * in the case of a leap second, values
- * may be adjusted. For example, setting the
- * seconds value to 60 or 61 (a leap second) may result
- * in the seconds value being reset to 0 and the minutes
- * value being incremented by 1, if the current time does
- * not contain a leap second.
- *
- * @param seconds the seconds.
- * @deprecated Use Calendar instead of Date, and use
- * set(Calendar.SECOND, seconds) instead.
- * @see Calendar
- * @see #getSeconds()
- */
- public void setSeconds(int seconds)
- {
- Calendar cal = Calendar.getInstance();
- cal.setTimeInMillis(time);
- cal.set(Calendar.SECOND, seconds);
- time = cal.getTimeInMillis();
- }
-
- /**
- * Deserializes a Date
object from an
- * input stream, setting the time (in milliseconds
- * since the epoch) to the long value read from the
- * stream.
- *
- * @param input the input stream.
- * @throws IOException if an I/O error occurs in the stream.
- * @throws ClassNotFoundException if the class of the
- * serialized object could not be found.
- */
- private void readObject(ObjectInputStream input)
- throws IOException, ClassNotFoundException
- {
- input.defaultReadObject();
- time = input.readLong();
- }
-
- /**
- * Serializes a Date
object to an output stream,
- * storing the time (in milliseconds since the epoch) as a long
- * value in the stream.
- *
- * @serialdata A long value representing the offset from the epoch
- * in milliseconds. This is the same value that is returned by the
- * method getTime().
- * @param output the output stream.
- * @throws IOException if an I/O error occurs in the stream.
- */
- private void writeObject(ObjectOutputStream output)
- throws IOException
- {
- output.defaultWriteObject();
- output.writeLong(time);
- }
-
-}
diff --git a/libjava/java/util/GregorianCalendar.java b/libjava/java/util/GregorianCalendar.java
index e7a961880cf0..dc77c2f50245 100644
--- a/libjava/java/util/GregorianCalendar.java
+++ b/libjava/java/util/GregorianCalendar.java
@@ -871,6 +871,17 @@ public class GregorianCalendar extends Calendar
areFieldsSet = isSet[ERA] = isSet[YEAR] = isSet[MONTH] = isSet[WEEK_OF_YEAR] = isSet[WEEK_OF_MONTH] = isSet[DAY_OF_MONTH] = isSet[DAY_OF_YEAR] = isSet[DAY_OF_WEEK] = isSet[DAY_OF_WEEK_IN_MONTH] = isSet[AM_PM] = isSet[HOUR] = isSet[HOUR_OF_DAY] = isSet[MINUTE] = isSet[SECOND] = isSet[MILLISECOND] = isSet[ZONE_OFFSET] = isSet[DST_OFFSET] = true;
}
+
+ /**
+ * Return a hash code for this object, following the general contract
+ * specified by {@link Object#hashCode()}.
+ * @return the hash code
+ */
+ public int hashCode()
+ {
+ int val = (int) ((gregorianCutover >>> 32) ^ (gregorianCutover & 0xffffffff));
+ return super.hashCode() ^ val;
+ }
/**
* Compares the given calendar with this. An object, o, is
@@ -893,7 +904,8 @@ public class GregorianCalendar extends Calendar
return false;
GregorianCalendar cal = (GregorianCalendar) o;
- return (cal.getTimeInMillis() == getTimeInMillis());
+ return (cal.gregorianCutover == gregorianCutover
+ && super.equals(o));
}
/**
diff --git a/libjava/java/util/ResourceBundle.java b/libjava/java/util/ResourceBundle.java
index fac3b1166076..19dd3cdf19f0 100644
--- a/libjava/java/util/ResourceBundle.java
+++ b/libjava/java/util/ResourceBundle.java
@@ -359,7 +359,7 @@ public abstract class ResourceBundle
*
* @param baseName the name of the ResourceBundle
* @param locale A locale
- * @param classloader a ClassLoader
+ * @param classLoader a ClassLoader
* @return the desired resource bundle
* @throws MissingResourceException if the resource bundle can't be found
* @throws NullPointerException if any argument is null
diff --git a/libjava/java/util/SimpleTimeZone.java b/libjava/java/util/SimpleTimeZone.java
deleted file mode 100644
index f754d22b3b47..000000000000
--- a/libjava/java/util/SimpleTimeZone.java
+++ /dev/null
@@ -1,1078 +0,0 @@
-/* java.util.SimpleTimeZone
- Copyright (C) 1998, 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath 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 for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.util;
-
-
-/**
- * This class represents a simple time zone offset and handles
- * daylight savings. It can only handle one daylight savings rule, so
- * it can't represent historical changes.
- *
- * This object is tightly bound to the Gregorian calendar. It assumes
- * a regular seven days week, and the month lengths are that of the
- * Gregorian Calendar. It can only handle daylight savings for years
- * lying in the AD era.
- *
- * @see Calendar
- * @see GregorianCalender
- * @author Jochen Hoenicke
- */
-public class SimpleTimeZone extends TimeZone
-{
- /**
- * The raw time zone offset in milliseconds to GMT, ignoring
- * daylight savings.
- * @serial
- */
- private int rawOffset;
-
- /**
- * True, if this timezone uses daylight savings, false otherwise.
- * @serial
- */
- private boolean useDaylight;
-
- /**
- * The daylight savings offset. This is a positive offset in
- * milliseconds with respect to standard time. Typically this
- * is one hour, but for some time zones this may be half an hour.
- * @serial
- * @since JDK1.1.4
- */
- private int dstSavings = 60 * 60 * 1000;
-
- /**
- * The first year, in which daylight savings rules applies.
- * @serial
- */
- private int startYear;
- private static final int DOM_MODE = 1;
- private static final int DOW_IN_MONTH_MODE = 2;
- private static final int DOW_GE_DOM_MODE = 3;
- private static final int DOW_LE_DOM_MODE = 4;
-
- /**
- * The mode of the start rule. This takes one of the following values:
- * SimpleTimeZone
with the given time offset
- * from GMT and without daylight savings.
- * @param rawOffset the time offset from GMT in milliseconds.
- * @param id The identifier of this time zone.
- */
- public SimpleTimeZone(int rawOffset, String id)
- {
- this.rawOffset = rawOffset;
- setID(id);
- useDaylight = false;
- startYear = 0;
- }
-
- /**
- * Create a SimpleTimeZone
with the given time offset
- * from GMT and with daylight savings. The start/end parameters
- * can have different meaning (replace WEEKDAY with a real day of
- * week). Only the first two meanings were supported by earlier
- * versions of jdk.
- *
- * day > 0, dayOfWeek = Calendar.WEEKDAY
day
-th
- * WEEKDAY
in the given month. day < 0, dayOfWeek = Calendar.WEEKDAY
-day
-th
- * WEEKDAY
counted from the end of the month. day > 0, dayOfWeek = 0
day
-th day of
- * the month. day > 0, dayOfWeek = -Calendar.WEEKDAY
day
-th day of the month. You must make sure that
- * this day lies in the same month. day < 0, dayOfWeek = -Calendar.WEEKDAY
-day
-th day of the month. You
- * must make sure that this day lies in the same month. setEndRule
or the result of
- * getOffset is undefined. For the parameters see the ten-argument
- * constructor above.
- *
- * @param month The month where daylight savings start, zero
- * based. You should use the constants in Calendar.
- * @param day A day of month or day of week in month.
- * @param dayOfWeek The day of week where daylight savings start.
- * @param time The time in milliseconds standard time where daylight
- * savings start.
- * @see SimpleTimeZone
- */
- public void setStartRule(int month, int day, int dayOfWeek, int time)
- {
- this.startMode = checkRule(month, day, dayOfWeek);
- this.startMonth = month;
- this.startDay = day;
- this.startDayOfWeek = Math.abs(dayOfWeek);
- if (this.startTimeMode == WALL_TIME || this.startTimeMode == STANDARD_TIME)
- this.startTime = time;
- else
- // Convert from UTC to STANDARD
- this.startTime = time + this.rawOffset;
- useDaylight = true;
- }
-
- /**
- * Sets the daylight savings start rule. You must also set the
- * end rule with setEndRule
or the result of
- * getOffset is undefined. For the parameters see the ten-argument
- * constructor above.
- *
- * Note that this API isn't incredibly well specified. It appears that the
- * after flag must override the parameters, since normally, the day and
- * dayofweek can select this. I.e., if day < 0 and dayOfWeek < 0, on or
- * before mode is chosen. But if after == true, this implementation
- * overrides the signs of the other arguments. And if dayOfWeek == 0, it
- * falls back to the behavior in the other APIs. I guess this should be
- * checked against Sun's implementation.
- *
- * @param month The month where daylight savings start, zero
- * based. You should use the constants in Calendar.
- * @param day A day of month or day of week in month.
- * @param dayOfWeek The day of week where daylight savings start.
- * @param time The time in milliseconds standard time where daylight
- * savings start.
- * @param after If true, day and dayOfWeek specify first day of week on or
- * after day, else first day of week on or before.
- * @since 1.2
- * @see SimpleTimeZone
- */
- public void setStartRule(int month, int day, int dayOfWeek, int time,
- boolean after)
- {
- // FIXME: XXX: Validate that checkRule and offset processing work with on
- // or before mode.
- this.startDay = after ? Math.abs(day) : -Math.abs(day);
- this.startDayOfWeek = after ? Math.abs(dayOfWeek) : -Math.abs(dayOfWeek);
- this.startMode = (dayOfWeek != 0)
- ? (after ? DOW_GE_DOM_MODE : DOW_LE_DOM_MODE)
- : checkRule(month, day, dayOfWeek);
- this.startDay = Math.abs(this.startDay);
- this.startDayOfWeek = Math.abs(this.startDayOfWeek);
-
- this.startMonth = month;
-
- if (this.startTimeMode == WALL_TIME || this.startTimeMode == STANDARD_TIME)
- this.startTime = time;
- else
- // Convert from UTC to STANDARD
- this.startTime = time + this.rawOffset;
- useDaylight = true;
- }
-
- /**
- * Sets the daylight savings start rule. You must also set the
- * end rule with setEndRule
or the result of
- * getOffset is undefined. For the parameters see the ten-argument
- * constructor above.
- *
- * @param month The month where daylight savings start, zero
- * based. You should use the constants in Calendar.
- * @param day A day of month or day of week in month.
- * @param time The time in milliseconds standard time where daylight
- * savings start.
- * @see SimpleTimeZone
- * @since 1.2
- */
- public void setStartRule(int month, int day, int time)
- {
- setStartRule(month, day, 0, time);
- }
-
- /**
- * Sets the daylight savings end rule. You must also set the
- * start rule with setStartRule
or the result of
- * getOffset is undefined. For the parameters see the ten-argument
- * constructor above.
- *
- * @param month The end month of daylight savings.
- * @param day A day in month, or a day of week in month.
- * @param dayOfWeek A day of week, when daylight savings ends.
- * @param time A time in millis in standard time.
- * @see #setStartRule
- */
- public void setEndRule(int month, int day, int dayOfWeek, int time)
- {
- this.endMode = checkRule(month, day, dayOfWeek);
- this.endMonth = month;
- this.endDay = day;
- this.endDayOfWeek = Math.abs(dayOfWeek);
- if (this.endTimeMode == WALL_TIME)
- this.endTime = time;
- else if (this.endTimeMode == STANDARD_TIME)
- // Convert from STANDARD to DST
- this.endTime = time + this.dstSavings;
- else
- // Convert from UTC to DST
- this.endTime = time + this.rawOffset + this.dstSavings;
- useDaylight = true;
- }
-
- /**
- * Sets the daylight savings end rule. You must also set the
- * start rule with setStartRule
or the result of
- * getOffset is undefined. For the parameters see the ten-argument
- * constructor above.
- *
- * Note that this API isn't incredibly well specified. It appears that the
- * after flag must override the parameters, since normally, the day and
- * dayofweek can select this. I.e., if day < 0 and dayOfWeek < 0, on or
- * before mode is chosen. But if after == true, this implementation
- * overrides the signs of the other arguments. And if dayOfWeek == 0, it
- * falls back to the behavior in the other APIs. I guess this should be
- * checked against Sun's implementation.
- *
- * @param month The end month of daylight savings.
- * @param day A day in month, or a day of week in month.
- * @param dayOfWeek A day of week, when daylight savings ends.
- * @param time A time in millis in standard time.
- * @param after If true, day and dayOfWeek specify first day of week on or
- * after day, else first day of week on or before.
- * @since 1.2
- * @see #setStartRule
- */
- public void setEndRule(int month, int day, int dayOfWeek, int time,
- boolean after)
- {
- // FIXME: XXX: Validate that checkRule and offset processing work with on
- // or before mode.
- this.endDay = after ? Math.abs(day) : -Math.abs(day);
- this.endDayOfWeek = after ? Math.abs(dayOfWeek) : -Math.abs(dayOfWeek);
- this.endMode = (dayOfWeek != 0)
- ? (after ? DOW_GE_DOM_MODE : DOW_LE_DOM_MODE)
- : checkRule(month, day, dayOfWeek);
- this.endDay = Math.abs(this.endDay);
- this.endDayOfWeek = Math.abs(endDayOfWeek);
-
- this.endMonth = month;
-
- if (this.endTimeMode == WALL_TIME)
- this.endTime = time;
- else if (this.endTimeMode == STANDARD_TIME)
- // Convert from STANDARD to DST
- this.endTime = time + this.dstSavings;
- else
- // Convert from UTC to DST
- this.endTime = time + this.rawOffset + this.dstSavings;
- useDaylight = true;
- }
-
- /**
- * Sets the daylight savings end rule. You must also set the
- * start rule with setStartRule
or the result of
- * getOffset is undefined. For the parameters see the ten-argument
- * constructor above.
- *
- * @param month The end month of daylight savings.
- * @param day A day in month, or a day of week in month.
- * @param dayOfWeek A day of week, when daylight savings ends.
- * @param time A time in millis in standard time.
- * @see #setStartRule
- */
- public void setEndRule(int month, int day, int time)
- {
- setEndRule(month, day, 0, time);
- }
-
- /**
- * Gets the time zone offset, for current date, modified in case of
- * daylight savings. This is the offset to add to UTC to get the local
- * time.
- *
- * In the standard JDK the results given by this method may result in
- * inaccurate results at the end of February or the beginning of March.
- * To avoid this, you should use Calendar instead:
- * offset = cal.get(Calendar.ZONE_OFFSET)
- * + cal.get(Calendar.DST_OFFSET);
- *
- * This version doesn't suffer this inaccuracy.
- *
- * The arguments don't follow the approach for setting start and end rules.
- * The day must be a positive number and dayOfWeek must be a positive value
- * from Calendar. dayOfWeek is redundant, but must match the other values
- * or an inaccurate result may be returned.
- *
- * @param era the era of the given date
- * @param year the year of the given date
- * @param month the month of the given date, 0 for January.
- * @param day the day of month
- * @param dayOfWeek the day of week; this must match the other fields.
- * @param millis the millis in the day (in local standard time)
- * @return the time zone offset in milliseconds.
- * @throws IllegalArgumentException if arguments are incorrect.
- */
- public int getOffset(int era, int year, int month, int day, int dayOfWeek,
- int millis)
- {
- int daysInMonth = getDaysInMonth(month, year);
- if (day < 1 || day > daysInMonth)
- throw new IllegalArgumentException("day out of range");
- if (dayOfWeek < Calendar.SUNDAY || dayOfWeek > Calendar.SATURDAY)
- throw new IllegalArgumentException("dayOfWeek out of range");
- if (month < Calendar.JANUARY || month > Calendar.DECEMBER)
- throw new IllegalArgumentException("month out of range:" + month);
-
- // This method is called by Calendar, so we mustn't use that class.
- int daylightSavings = 0;
- if (useDaylight && era == GregorianCalendar.AD && year >= startYear)
- {
- // This does only work for Gregorian calendars :-(
- // This is mainly because setStartYear doesn't take an era.
- boolean afterStart = ! isBefore(year, month, day, dayOfWeek, millis,
- startMode, startMonth, startDay,
- startDayOfWeek, startTime);
- boolean beforeEnd = isBefore(year, month, day, dayOfWeek,
- millis + dstSavings,
- endMode, endMonth, endDay, endDayOfWeek,
- endTime);
-
- if (startMonth < endMonth)
- // use daylight savings, if the date is after the start of
- // savings, and before the end of savings.
- daylightSavings = afterStart && beforeEnd ? dstSavings : 0;
- else
- // use daylight savings, if the date is before the end of
- // savings, or after the start of savings.
- daylightSavings = beforeEnd || afterStart ? dstSavings : 0;
- }
- return rawOffset + daylightSavings;
- }
-
- /**
- * Returns the time zone offset to GMT in milliseconds, ignoring
- * day light savings.
- * @return the time zone offset.
- */
- public int getRawOffset()
- {
- return rawOffset;
- }
-
- /**
- * Sets the standard time zone offset to GMT.
- * @param rawOffset The time offset from GMT in milliseconds.
- */
- public void setRawOffset(int rawOffset)
- {
- this.rawOffset = rawOffset;
- }
-
- /**
- * Gets the daylight savings offset. This is a positive offset in
- * milliseconds with respect to standard time. Typically this
- * is one hour, but for some time zones this may be half an our.
- * @return the daylight savings offset in milliseconds.
- *
- * @since 1.2
- */
- public int getDSTSavings()
- {
- return dstSavings;
- }
-
- /**
- * Sets the daylight savings offset. This is a positive offset in
- * milliseconds with respect to standard time.
- *
- * @param dstSavings the daylight savings offset in milliseconds.
- *
- * @since 1.2
- */
- public void setDSTSavings(int dstSavings)
- {
- if (dstSavings <= 0)
- throw new IllegalArgumentException("illegal value for dstSavings");
-
- this.dstSavings = dstSavings;
- }
-
- /**
- * Returns if this time zone uses daylight savings time.
- * @return true, if we use daylight savings time, false otherwise.
- */
- public boolean useDaylightTime()
- {
- return useDaylight;
- }
-
- /**
- * Returns the number of days in the given month.
- * Uses gregorian rules prior to 1582 (The default and earliest cutover)
- * @param month The month, zero based; use one of the Calendar constants.
- * @param year The year.
- */
- private int getDaysInMonth(int month, int year)
- {
- if (month == Calendar.FEBRUARY)
- {
- if ((year & 3) != 0)
- return 28;
-
- // Assume default Gregorian cutover,
- // all years prior to this must be Julian
- if (year < 1582)
- return 29;
-
- // Gregorian rules
- return ((year % 100) != 0 || (year % 400) == 0) ? 29 : 28;
- }
- else
- return monthArr[month];
- }
-
- /**
- * Checks if the date given in calXXXX, is before the change between
- * dst and standard time.
- * @param calYear the year of the date to check (for leap day checking).
- * @param calMonth the month of the date to check.
- * @param calDay the day of month of the date to check.
- * @param calDayOfWeek the day of week of the date to check.
- * @param calMillis the millis of day of the date to check (standard time).
- * @param mode the change mode; same semantic as startMode.
- * @param month the change month; same semantic as startMonth.
- * @param day the change day; same semantic as startDay.
- * @param dayOfWeek the change day of week;
- * @param millis the change time in millis since midnight standard time.
- * same semantic as startDayOfWeek.
- * @return true, if cal is before the change, false if cal is on
- * or after the change.
- */
- private boolean isBefore(int calYear, int calMonth, int calDayOfMonth,
- int calDayOfWeek, int calMillis, int mode,
- int month, int day, int dayOfWeek, int millis)
- {
- // This method is called by Calendar, so we mustn't use that class.
- // We have to do all calculations by hand.
- // check the months:
- // XXX - this is not correct:
- // for the DOW_GE_DOM and DOW_LE_DOM modes the change date may
- // be in a different month.
- if (calMonth != month)
- return calMonth < month;
-
- // check the day:
- switch (mode)
- {
- case DOM_MODE:
- if (calDayOfMonth != day)
- return calDayOfMonth < day;
- break;
- case DOW_IN_MONTH_MODE:
- {
- // This computes the day of month of the day of type
- // "dayOfWeek" that lies in the same (sunday based) week as cal.
- calDayOfMonth += (dayOfWeek - calDayOfWeek);
-
- // Now we convert it to 7 based number (to get a one based offset
- // after dividing by 7). If we count from the end of the
- // month, we get want a -7 based number counting the days from
- // the end:
- if (day < 0)
- calDayOfMonth -= getDaysInMonth(calMonth, calYear) + 7;
- else
- calDayOfMonth += 6;
-
- // day > 0 day < 0
- // S M T W T F S S M T W T F S
- // 7 8 9 10 11 12 -36-35-34-33-32-31
- // 13 14 15 16 17 18 19 -30-29-28-27-26-25-24
- // 20 21 22 23 24 25 26 -23-22-21-20-19-18-17
- // 27 28 29 30 31 32 33 -16-15-14-13-12-11-10
- // 34 35 36 -9 -8 -7
- // Now we calculate the day of week in month:
- int week = calDayOfMonth / 7;
-
- // day > 0 day < 0
- // S M T W T F S S M T W T F S
- // 1 1 1 1 1 1 -5 -5 -4 -4 -4 -4
- // 1 2 2 2 2 2 2 -4 -4 -4 -3 -3 -3 -3
- // 2 3 3 3 3 3 3 -3 -3 -3 -2 -2 -2 -2
- // 3 4 4 4 4 4 4 -2 -2 -2 -1 -1 -1 -1
- // 4 5 5 -1 -1 -1
- if (week != day)
- return week < day;
-
- if (calDayOfWeek != dayOfWeek)
- return calDayOfWeek < dayOfWeek;
-
- // daylight savings starts/ends on the given day.
- break;
- }
- case DOW_LE_DOM_MODE:
- // The greatest sunday before or equal December, 12
- // is the same as smallest sunday after or equal December, 6.
- day = Math.abs(day) - 6;
- case DOW_GE_DOM_MODE:
- // Calculate the day of month of the day of type
- // "dayOfWeek" that lies before (or on) the given date.
- calDayOfMonth -= (calDayOfWeek < dayOfWeek ? 7 : 0) + calDayOfWeek
- - dayOfWeek;
- if (calDayOfMonth < day)
- return true;
- if (calDayOfWeek != dayOfWeek || calDayOfMonth >= day + 7)
- return false;
-
- // now we have the same day
- break;
- }
-
- // the millis decides:
- return (calMillis < millis);
- }
-
- /**
- * Determines if the given date is in daylight savings time.
- * @return true, if it is in daylight savings time, false otherwise.
- */
- public boolean inDaylightTime(Date date)
- {
- Calendar cal = Calendar.getInstance(this);
- cal.setTime(date);
- return (cal.get(Calendar.DST_OFFSET) != 0);
- }
-
- /**
- * Generates the hashCode for the SimpleDateFormat object. It is
- * the rawOffset, possibly, if useDaylightSavings is true, xored
- * with startYear, startMonth, startDayOfWeekInMonth, ..., endTime.
- */
- public synchronized int hashCode()
- {
- return rawOffset
- ^ (useDaylight
- ? startMonth ^ startDay ^ startDayOfWeek ^ startTime ^ endMonth
- ^ endDay ^ endDayOfWeek ^ endTime : 0);
- }
-
- public synchronized boolean equals(Object o)
- {
- if (this == o)
- return true;
- if (! (o instanceof SimpleTimeZone))
- return false;
- SimpleTimeZone zone = (SimpleTimeZone) o;
- if (zone.hashCode() != hashCode() || ! getID().equals(zone.getID())
- || rawOffset != zone.rawOffset || useDaylight != zone.useDaylight)
- return false;
- if (! useDaylight)
- return true;
- return (startYear == zone.startYear && startMonth == zone.startMonth
- && startDay == zone.startDay
- && startDayOfWeek == zone.startDayOfWeek
- && startTime == zone.startTime
- && startTimeMode == zone.startTimeMode && endMonth == zone.endMonth
- && endDay == zone.endDay && endDayOfWeek == zone.endDayOfWeek
- && endTime == zone.endTime && endTimeMode == zone.endTimeMode);
- }
-
- /**
- * Test if the other time zone uses the same rule and only
- * possibly differs in ID. This implementation for this particular
- * class will return true if the other object is a SimpleTimeZone,
- * the raw offsets and useDaylight are identical and if useDaylight
- * is true, also the start and end datas are identical.
- * @return true if this zone uses the same rule.
- */
- public boolean hasSameRules(TimeZone other)
- {
- if (this == other)
- return true;
- if (! (other instanceof SimpleTimeZone))
- return false;
- SimpleTimeZone zone = (SimpleTimeZone) other;
- if (zone.hashCode() != hashCode() || rawOffset != zone.rawOffset
- || useDaylight != zone.useDaylight)
- return false;
- if (! useDaylight)
- return true;
- return (startYear == zone.startYear && startMonth == zone.startMonth
- && startDay == zone.startDay
- && startDayOfWeek == zone.startDayOfWeek
- && startTime == zone.startTime
- && startTimeMode == zone.startTimeMode && endMonth == zone.endMonth
- && endDay == zone.endDay && endDayOfWeek == zone.endDayOfWeek
- && endTime == zone.endTime && endTimeMode == zone.endTimeMode);
- }
-
- /**
- * Returns a string representation of this SimpleTimeZone object.
- * @return a string representation of this SimpleTimeZone object.
- */
- public String toString()
- {
- // the test for useDaylight is an incompatibility to jdk1.2, but
- // I think this shouldn't hurt.
- return getClass().getName() + "[" + "id=" + getID() + ",offset="
- + rawOffset + ",dstSavings=" + dstSavings + ",useDaylight="
- + useDaylight
- + (useDaylight
- ? ",startYear=" + startYear + ",startMode=" + startMode
- + ",startMonth=" + startMonth + ",startDay=" + startDay
- + ",startDayOfWeek=" + startDayOfWeek + ",startTime="
- + startTime + ",startTimeMode=" + startTimeMode + ",endMode="
- + endMode + ",endMonth=" + endMonth + ",endDay=" + endDay
- + ",endDayOfWeek=" + endDayOfWeek + ",endTime=" + endTime
- + ",endTimeMode=" + endTimeMode : "") + "]";
- }
-
- /**
- * Reads a serialized simple time zone from stream.
- * @see #writeObject
- */
- private void readObject(java.io.ObjectInputStream input)
- throws java.io.IOException, ClassNotFoundException
- {
- input.defaultReadObject();
- if (serialVersionOnStream == 0)
- {
- // initialize the new fields to default values.
- dstSavings = 60 * 60 * 1000;
- endMode = DOW_IN_MONTH_MODE;
- startMode = DOW_IN_MONTH_MODE;
- startTimeMode = WALL_TIME;
- endTimeMode = WALL_TIME;
- serialVersionOnStream = 2;
- }
- else
- {
- int length = input.readInt();
- byte[] byteArray = new byte[length];
- input.read(byteArray, 0, length);
- if (length >= 4)
- {
- // Lets hope that Sun does extensions to the serialized
- // form in a sane manner.
- startDay = byteArray[0];
- startDayOfWeek = byteArray[1];
- endDay = byteArray[2];
- endDayOfWeek = byteArray[3];
- }
- }
- }
-
- /**
- * Serializes this object to a stream. @serialdata The object is
- * first written in the old JDK 1.1 format, so that it can be read
- * by by the old classes. This means, that the
- * start/endDay(OfWeek)
-Fields are written in the
- * DOW_IN_MONTH_MODE rule, since this was the only supported rule
- * in 1.1.
- *
- * In the optional section, we write first the length of an byte
- * array as int and afterwards the byte array itself. The byte
- * array contains in this release four elements, namely the real
- * startDay, startDayOfWeek endDay, endDayOfWeek in that Order.
- * These fields are needed, because for compatibility reasons only
- * approximative values are written to the required section, as
- * described above.
- */
- private void writeObject(java.io.ObjectOutputStream output)
- throws java.io.IOException
- {
- byte[] byteArray = new byte[]
- {
- (byte) startDay, (byte) startDayOfWeek, (byte) endDay,
- (byte) endDayOfWeek
- };
-
- /* calculate the approximation for JDK 1.1 */
- switch (startMode)
- {
- case DOM_MODE:
- startDayOfWeek = Calendar.SUNDAY; // random day of week
-
- // fall through
- case DOW_GE_DOM_MODE:
- case DOW_LE_DOM_MODE:
- startDay = (startDay + 6) / 7;
- }
- switch (endMode)
- {
- case DOM_MODE:
- endDayOfWeek = Calendar.SUNDAY;
-
- // fall through
- case DOW_GE_DOM_MODE:
- case DOW_LE_DOM_MODE:
- endDay = (endDay + 6) / 7;
- }
-
- // the required part:
- output.defaultWriteObject();
- // the optional part:
- output.writeInt(byteArray.length);
- output.write(byteArray, 0, byteArray.length);
- }
-}
diff --git a/libjava/sources.am b/libjava/sources.am
index 146c67e2120b..f9b83ae6f5dd 100644
--- a/libjava/sources.am
+++ b/libjava/sources.am
@@ -3660,7 +3660,7 @@ classpath/java/util/Collections.java \
classpath/java/util/Comparator.java \
classpath/java/util/ConcurrentModificationException.java \
java/util/Currency.java \
-java/util/Date.java \
+classpath/java/util/Date.java \
classpath/java/util/Dictionary.java \
classpath/java/util/EmptyStackException.java \
classpath/java/util/Enumeration.java \
@@ -3695,7 +3695,7 @@ classpath/java/util/Random.java \
classpath/java/util/RandomAccess.java \
java/util/ResourceBundle.java \
classpath/java/util/Set.java \
-java/util/SimpleTimeZone.java \
+classpath/java/util/SimpleTimeZone.java \
classpath/java/util/SortedMap.java \
classpath/java/util/SortedSet.java \
classpath/java/util/Stack.java \
--
2.47.2