Commit 1ea8e73b by Ingo Proetel Committed by Michael Koch

TimeZone.java: Initialize lazily.

2003-09-18  Ingo Proetel  <proetel@aicas.com>

	* java/util/TimeZone.java: Initialize lazily.
	* java/util/Locale.java (readManifest): Fix check for country.
	* java/util/GregorianCalendar.java: Make use of ResourceBundle better
	traceable
	* java/util/Calendar.java: Make use of ResourceBundle better
	traceable.

From-SVN: r71509
parent fc08ad28
2003-09-18 Ingo Proetel <proetel@aicas.com>
* java/util/TimeZone.java: Initialize lazily.
* java/util/Locale.java (readManifest): Fix check for country.
* java/util/GregorianCalendar.java: Make use of ResourceBundle better
traceable
* java/util/Calendar.java: Make use of ResourceBundle better
traceable.
2003-09-18 Jeroen Frijters <jeroen@frijters.net>
* java/sql/Timestamp.java
......
......@@ -361,11 +361,21 @@ public abstract class Calendar implements Serializable, Cloneable
static final long serialVersionUID = -1807547505821590642L;
/**
* The name of the resource bundle.
* The name of the resource bundle. Used only by getBundle()
*/
private static final String bundleName = "gnu.java.locale.Calendar";
/**
* get resource bundle:
* The resources should be loaded via this method only. Iff an application
* uses this method, the resourcebundle is required.
*/
private static ResourceBundle getBundle(Locale locale)
{
return ResourceBundle.getBundle(bundleName, locale);
}
/**
* Constructs a new Calendar with the default time zone and the default
* locale.
*/
......@@ -385,7 +395,7 @@ public abstract class Calendar implements Serializable, Cloneable
this.zone = zone;
lenient = true;
ResourceBundle rb = ResourceBundle.getBundle(bundleName, locale);
ResourceBundle rb = getBundle(locale);
firstDayOfWeek = ((Integer) rb.getObject("firstDayOfWeek")).intValue();
minimalDaysInFirstWeek =
......@@ -430,7 +440,7 @@ public abstract class Calendar implements Serializable, Cloneable
public static synchronized Calendar getInstance(TimeZone zone, Locale locale)
{
String calendarClassName = null;
ResourceBundle rb = ResourceBundle.getBundle(bundleName, locale);
ResourceBundle rb = getBundle(locale);
calendarClassName = rb.getString("calendarClass");
if (calendarClassName != null)
{
......@@ -461,8 +471,7 @@ public abstract class Calendar implements Serializable, Cloneable
*/
public static synchronized Locale[] getAvailableLocales()
{
ResourceBundle rb = ResourceBundle.getBundle(bundleName,
new Locale("", ""));
ResourceBundle rb = getBundle(new Locale("", ""));
return (Locale[]) rb.getObject("availableLocales");
}
......
......@@ -78,11 +78,21 @@ public class GregorianCalendar extends Calendar
static final long serialVersionUID = -8125100834729963327L;
/**
* The name of the resource bundle.
* The name of the resource bundle. Used only by getBundle()
*/
private static final String bundleName = "gnu.java.locale.Calendar";
/**
* get resource bundle:
* The resources should be loaded via this method only. Iff an application
* uses this method, the resourcebundle is required. --Fridi.
*/
private static ResourceBundle getBundle(Locale locale)
{
return ResourceBundle.getBundle(bundleName, locale);
}
/**
* Constructs a new GregorianCalender representing the current
* time, using the default time zone and the default locale.
*/
......@@ -120,7 +130,7 @@ public class GregorianCalendar extends Calendar
public GregorianCalendar(TimeZone zone, Locale locale)
{
super(zone, locale);
ResourceBundle rb = ResourceBundle.getBundle(bundleName, locale);
ResourceBundle rb = getBundle(locale);
gregorianCutover = ((Date) rb.getObject("gregorianCutOver")).getTime();
setTimeInMillis(System.currentTimeMillis());
}
......
......@@ -489,7 +489,7 @@ public final class Locale implements Serializable, Cloneable
+ "WS,YE,YT,YU,ZA,ZM,ZR,ZW")
.indexOf(country);
if (index % 3 != 0 || language.length() != 2)
if (index % 3 != 0 || country.length() != 2)
throw new MissingResourceException
("Can't find ISO3 country for " + country,
"java.util.Locale", country);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment