summaryrefslogtreecommitdiff
path: root/libjava/classpath/java/util/Calendar.java
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/classpath/java/util/Calendar.java')
-rw-r--r--libjava/classpath/java/util/Calendar.java36
1 files changed, 32 insertions, 4 deletions
diff --git a/libjava/classpath/java/util/Calendar.java b/libjava/classpath/java/util/Calendar.java
index 712296b1a2a..0449e126db8 100644
--- a/libjava/classpath/java/util/Calendar.java
+++ b/libjava/classpath/java/util/Calendar.java
@@ -39,6 +39,8 @@ exception statement from your version. */
package java.util;
+import gnu.java.lang.CPStringBuilder;
+
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
@@ -485,6 +487,28 @@ public abstract class Calendar
}
/**
+ * The set of properties for obtaining the minimum number of days in
+ * the first week.
+ */
+ private static transient final Properties properties;
+
+ /**
+ * Reads in the properties.
+ */
+ static
+ {
+ properties = new Properties();
+ try
+ {
+ properties.load(Calendar.class.getResourceAsStream("weeks.properties"));
+ }
+ catch (IOException exception)
+ {
+ System.out.println("Failed to load weeks resource: " + exception);
+ }
+ }
+
+ /**
* Constructs a new Calendar with the default time zone and the default
* locale.
*/
@@ -505,9 +529,13 @@ public abstract class Calendar
lenient = true;
String[] days = { "", "sun", "mon", "tue", "wed", "thu", "fri", "sat" };
- ResourceBundle rb = getBundle(locale);
- String min = (String) rb.getObject("minNumberOfDaysInFirstWeek");
- String first = (String) rb.getObject("firstDayOfWeek");
+ String country = locale.getCountry();
+ String min = properties.getProperty("minDays." + country);
+ if (min == null)
+ min = properties.getProperty("minDays.DEFAULT");
+ String first = properties.getProperty("firstDay." + country);
+ if (first == null)
+ first = properties.getProperty("firstDay.DEFAULT");
try
{
if (min != null)
@@ -1328,7 +1356,7 @@ public abstract class Calendar
*/
public String toString()
{
- StringBuilder sb = new StringBuilder(getClass().getName());
+ CPStringBuilder sb = new CPStringBuilder(getClass().getName());
sb.append('[');
sb.append("time=");
if (isTimeSet)