From 1ea8e73b809603d2c182b20899ca7824bd0d0209 Mon Sep 17 00:00:00 2001 From: Ingo Proetel Date: Thu, 18 Sep 2003 06:34:00 +0000 Subject: TimeZone.java: Initialize lazily. 2003-09-18 Ingo Proetel * 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 --- libjava/java/util/Calendar.java | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'libjava/java/util/Calendar.java') diff --git a/libjava/java/util/Calendar.java b/libjava/java/util/Calendar.java index 9a4e21f69de..271d1d163c6 100644 --- a/libjava/java/util/Calendar.java +++ b/libjava/java/util/Calendar.java @@ -361,10 +361,20 @@ 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"); } -- cgit v1.2.1