summaryrefslogtreecommitdiff
path: root/libjava
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>1999-04-30 09:31:00 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>1999-04-30 09:31:00 +0000
commitd41dfd6cc95692f13ca6dde18e9717679c00595d (patch)
tree4928c712cce75c2d0d4c9cf9f6f78ef4a4052149 /libjava
parent5f00c9ab3e46684aba3272ade7a944a34a82e991 (diff)
downloadgcc-d41dfd6cc95692f13ca6dde18e9717679c00595d.tar.gz
* java/lang/StringBuffer.java (ensureCapacity): Don't resize
vector when shared. * java/util/Locale.java (Locale(String,String)): Implement in terms of 3-argument version; variant now defaults to empty string. (toString): Assume variant is not null. (equals): Assume all strings are not null. (Locale): Throw NullPointerException if any argument is null. * java/util/ResourceBundle.java (getBundle): Don't try the base name; now implicit in partialGetBundle call. (trySomeGetBundle): Search for parent bundles and call setParent as required. (partialGetBundle): Added `langStop' argument. Use `Locale.toString' to compute bundleName. (resource_cache): New static field. (partialGetBundle): Cache the returned resource bundle. Now synchronized. * gnu/gcj/text/LocaleData_en.java (contents): [collatorRule] Added missing `<'. * mauve-libgcj: Enable Collator and RuleBasedCollator. * java/text/natCollator.cc (decomposeCharacter): `base' now `const'. * Makefile.in: Rebuilt. * Makefile.am (ordinary_java_source_files): Added CollationElementIterator, CollationKey, Collator, RuleBasedCollator. (nat_source_files): Added natCollator.cc. * java/text/RuleBasedCollator.java (ceiNext): No longer static. (compare): Pass `this' to CollationElementIterator constructor. (getCollationElementIterator): Likewise. (ceiNext): Fix off-by-one error when finding initial substring. (next): Correctly mask off bits when computing return value. Fixed return values when one string is shorter than the other. * java/text/CollationElementIterator.java (collator): New field. (CollationElementIterator): Added collator argument. (next): Call ceiNext on collator object. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@26707 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava')
-rw-r--r--libjava/ChangeLog43
-rw-r--r--libjava/Makefile.am44
-rw-r--r--libjava/Makefile.in59
-rw-r--r--libjava/gnu/gcj/text/LocaleData_en.java2
-rw-r--r--libjava/java/lang/StringBuffer.java8
-rw-r--r--libjava/java/text/CollationElementIterator.java8
-rw-r--r--libjava/java/text/RuleBasedCollator.java31
-rw-r--r--libjava/java/text/natCollator.cc2
-rw-r--r--libjava/java/util/Locale.java29
-rw-r--r--libjava/java/util/ResourceBundle.java98
-rw-r--r--libjava/mauve-libgcj4
11 files changed, 215 insertions, 113 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 67160b8d692..1a0e8a5f6f6 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,46 @@
+1999-04-29 Tom Tromey <tromey@cygnus.com>
+
+ * java/lang/StringBuffer.java (ensureCapacity): Don't resize
+ vector when shared.
+
+ * java/util/Locale.java (Locale(String,String)): Implement in
+ terms of 3-argument version; variant now defaults to empty
+ string.
+ (toString): Assume variant is not null.
+ (equals): Assume all strings are not null.
+ (Locale): Throw NullPointerException if any argument is null.
+
+ * java/util/ResourceBundle.java (getBundle): Don't try the base
+ name; now implicit in partialGetBundle call.
+ (trySomeGetBundle): Search for parent bundles and call setParent
+ as required.
+ (partialGetBundle): Added `langStop' argument. Use
+ `Locale.toString' to compute bundleName.
+ (resource_cache): New static field.
+ (partialGetBundle): Cache the returned resource bundle. Now
+ synchronized.
+
+ * gnu/gcj/text/LocaleData_en.java (contents): [collatorRule] Added
+ missing `<'.
+
+ * mauve-libgcj: Enable Collator and RuleBasedCollator.
+ * java/text/natCollator.cc (decomposeCharacter): `base' now
+ `const'.
+ * Makefile.in: Rebuilt.
+ * Makefile.am (ordinary_java_source_files): Added
+ CollationElementIterator, CollationKey, Collator,
+ RuleBasedCollator.
+ (nat_source_files): Added natCollator.cc.
+ * java/text/RuleBasedCollator.java (ceiNext): No longer static.
+ (compare): Pass `this' to CollationElementIterator constructor.
+ (getCollationElementIterator): Likewise.
+ (ceiNext): Fix off-by-one error when finding initial substring.
+ (next): Correctly mask off bits when computing return value.
+ Fixed return values when one string is shorter than the other.
+ * java/text/CollationElementIterator.java (collator): New field.
+ (CollationElementIterator): Added collator argument.
+ (next): Call ceiNext on collator object.
+
1999-04-26 Tom Tromey <tromey@cygnus.com>
* natCollator.cc: New file.
diff --git a/libjava/Makefile.am b/libjava/Makefile.am
index 3e88f1973c0..1711a9ec001 100644
--- a/libjava/Makefile.am
+++ b/libjava/Makefile.am
@@ -533,6 +533,9 @@ java/security/NoSuchAlgorithmException.java \
java/text/BreakIterator.java \
java/text/CharacterIterator.java \
java/text/ChoiceFormat.java \
+java/text/CollationElementIterator.java \
+java/text/CollationKey.java \
+java/text/Collator.java \
java/text/DateFormat.java \
java/text/DateFormatSymbols.java \
java/text/DecimalFormat.java \
@@ -543,6 +546,7 @@ java/text/MessageFormat.java \
java/text/NumberFormat.java \
java/text/ParseException.java \
java/text/ParsePosition.java \
+java/text/RuleBasedCollator.java \
java/text/SimpleDateFormat.java \
java/text/StringCharacterIterator.java \
java/util/BitSet.java \
@@ -601,19 +605,35 @@ c_source_files = \
java/lang/k_cos.c java/lang/s_sin.c
## This lists all the C++ source files in subdirectories.
-nat_source_files = java/lang/natObject.cc java/lang/natClass.cc \
-java/lang/natString.cc java/lang/natDouble.cc java/lang/natRuntime.cc \
-java/lang/natSystem.cc java/lang/natThread.cc java/io/natFile.cc \
-java/io/natFileDescriptor.cc java/util/natDate.cc \
-java/util/natGregorianCalendar.cc java/lang/natFirstThread.cc \
-java/lang/natCharacter.cc java/lang/natMath.cc java/lang/natFloat.cc \
-java/lang/reflect/natField.cc java/net/natInetAddress.cc \
-java/net/natPlainSocketImpl.cc java/lang/reflect/natMethod.cc \
-java/lang/reflect/natArray.cc gnu/gcj/convert/Unicode_to_JIS.cc \
-gnu/gcj/convert/natInput_EUCJIS.cc gnu/gcj/convert/natOutput_EUCJIS.cc \
-gnu/gcj/convert/natInput_SJIS.cc gnu/gcj/convert/natOutput_SJIS.cc \
+nat_source_files = \
gnu/gcj/convert/JIS0208_to_Unicode.cc \
-gnu/gcj/convert/JIS0212_to_Unicode.cc
+gnu/gcj/convert/JIS0212_to_Unicode.cc \
+gnu/gcj/convert/Unicode_to_JIS.cc \
+gnu/gcj/convert/natInput_EUCJIS.cc \
+gnu/gcj/convert/natInput_SJIS.cc \
+gnu/gcj/convert/natOutput_EUCJIS.cc \
+gnu/gcj/convert/natOutput_SJIS.cc \
+java/io/natFile.cc \
+java/io/natFileDescriptor.cc \
+java/lang/natCharacter.cc \
+java/lang/natClass.cc \
+java/lang/natDouble.cc \
+java/lang/natFirstThread.cc \
+java/lang/natFloat.cc \
+java/lang/natMath.cc \
+java/lang/natObject.cc \
+java/lang/natRuntime.cc \
+java/lang/natString.cc \
+java/lang/natSystem.cc \
+java/lang/natThread.cc \
+java/lang/reflect/natArray.cc \
+java/lang/reflect/natField.cc \
+java/lang/reflect/natMethod.cc \
+java/net/natInetAddress.cc \
+java/net/natPlainSocketImpl.cc \
+java/text/natCollator.cc \
+java/util/natDate.cc \
+java/util/natGregorianCalendar.cc
## ################################################################
diff --git a/libjava/Makefile.in b/libjava/Makefile.in
index 6fb9cffba98..f1b093b0f3d 100644
--- a/libjava/Makefile.in
+++ b/libjava/Makefile.in
@@ -398,6 +398,9 @@ java/security/NoSuchAlgorithmException.java \
java/text/BreakIterator.java \
java/text/CharacterIterator.java \
java/text/ChoiceFormat.java \
+java/text/CollationElementIterator.java \
+java/text/CollationKey.java \
+java/text/Collator.java \
java/text/DateFormat.java \
java/text/DateFormatSymbols.java \
java/text/DecimalFormat.java \
@@ -408,6 +411,7 @@ java/text/MessageFormat.java \
java/text/NumberFormat.java \
java/text/ParseException.java \
java/text/ParsePosition.java \
+java/text/RuleBasedCollator.java \
java/text/SimpleDateFormat.java \
java/text/StringCharacterIterator.java \
java/util/BitSet.java \
@@ -466,19 +470,35 @@ c_source_files = \
java/lang/k_cos.c java/lang/s_sin.c
-nat_source_files = java/lang/natObject.cc java/lang/natClass.cc \
-java/lang/natString.cc java/lang/natDouble.cc java/lang/natRuntime.cc \
-java/lang/natSystem.cc java/lang/natThread.cc java/io/natFile.cc \
-java/io/natFileDescriptor.cc java/util/natDate.cc \
-java/util/natGregorianCalendar.cc java/lang/natFirstThread.cc \
-java/lang/natCharacter.cc java/lang/natMath.cc java/lang/natFloat.cc \
-java/lang/reflect/natField.cc java/net/natInetAddress.cc \
-java/net/natPlainSocketImpl.cc java/lang/reflect/natMethod.cc \
-java/lang/reflect/natArray.cc gnu/gcj/convert/Unicode_to_JIS.cc \
-gnu/gcj/convert/natInput_EUCJIS.cc gnu/gcj/convert/natOutput_EUCJIS.cc \
-gnu/gcj/convert/natInput_SJIS.cc gnu/gcj/convert/natOutput_SJIS.cc \
+nat_source_files = \
gnu/gcj/convert/JIS0208_to_Unicode.cc \
-gnu/gcj/convert/JIS0212_to_Unicode.cc
+gnu/gcj/convert/JIS0212_to_Unicode.cc \
+gnu/gcj/convert/Unicode_to_JIS.cc \
+gnu/gcj/convert/natInput_EUCJIS.cc \
+gnu/gcj/convert/natInput_SJIS.cc \
+gnu/gcj/convert/natOutput_EUCJIS.cc \
+gnu/gcj/convert/natOutput_SJIS.cc \
+java/io/natFile.cc \
+java/io/natFileDescriptor.cc \
+java/lang/natCharacter.cc \
+java/lang/natClass.cc \
+java/lang/natDouble.cc \
+java/lang/natFirstThread.cc \
+java/lang/natFloat.cc \
+java/lang/natMath.cc \
+java/lang/natObject.cc \
+java/lang/natRuntime.cc \
+java/lang/natString.cc \
+java/lang/natSystem.cc \
+java/lang/natThread.cc \
+java/lang/reflect/natArray.cc \
+java/lang/reflect/natField.cc \
+java/lang/reflect/natMethod.cc \
+java/net/natInetAddress.cc \
+java/net/natPlainSocketImpl.cc \
+java/text/natCollator.cc \
+java/util/natDate.cc \
+java/util/natGregorianCalendar.cc
# Work around what appears to be a GNU make bug handling MAKEFLAGS
@@ -716,12 +736,15 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/java/security/MessageDigest.P \
.deps/java/security/NoSuchAlgorithmException.P \
.deps/java/text/BreakIterator.P .deps/java/text/CharacterIterator.P \
-.deps/java/text/ChoiceFormat.P .deps/java/text/DateFormat.P \
-.deps/java/text/DateFormatSymbols.P .deps/java/text/DecimalFormat.P \
-.deps/java/text/DecimalFormatSymbols.P .deps/java/text/FieldPosition.P \
-.deps/java/text/Format.P .deps/java/text/MessageFormat.P \
-.deps/java/text/NumberFormat.P .deps/java/text/ParseException.P \
-.deps/java/text/ParsePosition.P .deps/java/text/SimpleDateFormat.P \
+.deps/java/text/ChoiceFormat.P \
+.deps/java/text/CollationElementIterator.P \
+.deps/java/text/CollationKey.P .deps/java/text/Collator.P \
+.deps/java/text/DateFormat.P .deps/java/text/DateFormatSymbols.P \
+.deps/java/text/DecimalFormat.P .deps/java/text/DecimalFormatSymbols.P \
+.deps/java/text/FieldPosition.P .deps/java/text/Format.P \
+.deps/java/text/MessageFormat.P .deps/java/text/NumberFormat.P \
+.deps/java/text/ParseException.P .deps/java/text/ParsePosition.P \
+.deps/java/text/RuleBasedCollator.P .deps/java/text/SimpleDateFormat.P \
.deps/java/text/StringCharacterIterator.P .deps/java/util/BitSet.P \
.deps/java/util/Calendar.P \
.deps/java/util/ConcurrentModificationException.P \
diff --git a/libjava/gnu/gcj/text/LocaleData_en.java b/libjava/gnu/gcj/text/LocaleData_en.java
index 1286e8af3ef..f21f7cef0ce 100644
--- a/libjava/gnu/gcj/text/LocaleData_en.java
+++ b/libjava/gnu/gcj/text/LocaleData_en.java
@@ -71,7 +71,7 @@ public final class LocaleData_en extends ListResourceBundle
// FIXME: this is nowhere near complete.
// In particular we must mark accents as ignorable,
// and probably other things as well.
- { "collatorRule", "0 < 1 < 2 < 3 < 4 < 5 < 6 < 7 < 8 < 9 < a,A < b,B < c,C < d,D < e,E < f,F < g,G < h,H < i,I < j,J < k,K < l,L < m,M < n,N < o,O < p,P < q,Q < r,R < s,S < t,T < u,U < v,V < w,W < x,X < y,Y < z,Z" }
+ { "collatorRule", "< 0 < 1 < 2 < 3 < 4 < 5 < 6 < 7 < 8 < 9 < a,A < b,B < c,C < d,D < e,E < f,F < g,G < h,H < i,I < j,J < k,K < l,L < m,M < n,N < o,O < p,P < q,Q < r,R < s,S < t,T < u,U < v,V < w,W < x,X < y,Y < z,Z" }
};
protected Object[][] getContents ()
diff --git a/libjava/java/lang/StringBuffer.java b/libjava/java/lang/StringBuffer.java
index 4127d54787f..70f78fbf8e5 100644
--- a/libjava/java/lang/StringBuffer.java
+++ b/libjava/java/lang/StringBuffer.java
@@ -98,7 +98,13 @@ public final class StringBuffer implements Serializable
{
if (shared || minimumCapacity > value.length)
{
- minimumCapacity = Math.max(minimumCapacity, value.length*2+2);
+ // We don't want to make a larger vector when `shared' is
+ // set. If we do, then setLength becomes very inefficient
+ // when repeatedly reusing a StringBuffer in a loop.
+ int max = (minimumCapacity > value.length
+ ? value.length*2+2
+ : value.length);
+ minimumCapacity = Math.max(minimumCapacity, max);
char[] nb = new char[minimumCapacity];
System.arraycopy(value, 0, nb, 0, count);
value = nb;
diff --git a/libjava/java/text/CollationElementIterator.java b/libjava/java/text/CollationElementIterator.java
index a6546294b87..15e60560189 100644
--- a/libjava/java/text/CollationElementIterator.java
+++ b/libjava/java/text/CollationElementIterator.java
@@ -27,7 +27,7 @@ public final class CollationElementIterator
{
if (index == text.length())
return NULLORDER;
- return RuleBasedCollator.ceiNext(this);
+ return collator.ceiNext(this);
}
// This one returns int while the others return short.
@@ -55,12 +55,13 @@ public final class CollationElementIterator
}
// Non-public constructor.
- CollationElementIterator (String text)
+ CollationElementIterator (String text, RuleBasedCollator collator)
{
this.text = text;
this.index = 0;
this.lookahead_set = false;
this.lookahead = 0;
+ this.collator = collator;
}
// Text over which we iterate.
@@ -72,4 +73,7 @@ public final class CollationElementIterator
// A piece of lookahead.
boolean lookahead_set;
int lookahead;
+
+ // The RuleBasedCollator which created this object.
+ RuleBasedCollator collator;
}
diff --git a/libjava/java/text/RuleBasedCollator.java b/libjava/java/text/RuleBasedCollator.java
index 18046adf9e5..fd4002b1a9f 100644
--- a/libjava/java/text/RuleBasedCollator.java
+++ b/libjava/java/text/RuleBasedCollator.java
@@ -43,7 +43,7 @@ public class RuleBasedCollator extends Collator
}
// A helper for CollationElementIterator.next().
- static int ceiNext (CollationElementIterator cei)
+ int ceiNext (CollationElementIterator cei)
{
if (cei.lookahead_set)
{
@@ -61,7 +61,7 @@ public class RuleBasedCollator extends Collator
boolean found = false;
int i;
- for (i = save; i < max; ++i)
+ for (i = save + 1; i <= max; ++i)
{
s = cei.text.substring(save, i);
if (prefixes.get(s) == null)
@@ -108,16 +108,15 @@ public class RuleBasedCollator extends Collator
switch (strength)
{
case PRIMARY:
- c |= CollationElementIterator.primaryOrder(os);
- /* Fall through. */
+ c = os & ~0xffff;
+ break;
case SECONDARY:
- c |= CollationElementIterator.secondaryOrder(os);
- /* Fall through. */
- case TERTIARY:
- c |= CollationElementIterator.tertiaryOrder(os);
+ c = os & ~0x00ff;
break;
+ case TERTIARY:
case IDENTICAL:
c = os;
+ break;
}
if (c != 0)
return c;
@@ -128,8 +127,8 @@ public class RuleBasedCollator extends Collator
{
CollationElementIterator cs, ct;
- cs = new CollationElementIterator (source);
- ct = new CollationElementIterator (target);
+ cs = new CollationElementIterator (source, this);
+ ct = new CollationElementIterator (target, this);
while (true)
{
@@ -140,9 +139,15 @@ public class RuleBasedCollator extends Collator
&& ot == CollationElementIterator.NULLORDER)
break;
else if (os == CollationElementIterator.NULLORDER)
- return 1;
+ {
+ // Source string is shorter, so return "less than".
+ return -1;
+ }
else if (ot == CollationElementIterator.NULLORDER)
- return -1;
+ {
+ // Target string is shorter, so return "greater than".
+ return 1;
+ }
if (os != ot)
return os - ot;
@@ -168,7 +173,7 @@ public class RuleBasedCollator extends Collator
int max = source.length();
for (int i = 0; i < max; ++i)
decomposeCharacter (source.charAt(i), expand);
- return new CollationElementIterator (expand.toString());
+ return new CollationElementIterator (expand.toString(), this);
}
public CollationKey getCollationKey (String source)
diff --git a/libjava/java/text/natCollator.cc b/libjava/java/text/natCollator.cc
index 7624b7c973a..378ac5c448c 100644
--- a/libjava/java/text/natCollator.cc
+++ b/libjava/java/text/natCollator.cc
@@ -30,7 +30,7 @@ java::text::Collator::decomposeCharacter (jchar c,
return;
}
- struct decomp_entry *base;
+ const struct decomp_entry *base;
int high;
if (decmp == FULL_DECOMPOSITION)
diff --git a/libjava/java/util/Locale.java b/libjava/java/util/Locale.java
index e47cd1d59d7..627841499aa 100644
--- a/libjava/java/util/Locale.java
+++ b/libjava/java/util/Locale.java
@@ -36,33 +36,34 @@ public final class Locale implements java.io.Serializable, Cloneable
public Locale (String languageCode, String countryCode)
{
- language = languageCode.toLowerCase();
- country = countryCode.toUpperCase();
- hashcode = languageCode.hashCode() ^ countryCode.hashCode();
+ this (languageCode, countryCode, "");
}
public Locale (String languageCode, String countryCode,
String variantCode)
{
- this (languageCode, countryCode);
- variant = variantCode;
- hashcode ^= variantCode.hashCode();
+ // We must explicitly check the arguments.
+ if (languageCode == null || countryCode == null
+ || variantCode == null)
+ throw new NullPointerException ();
+ language = languageCode.toLowerCase();
+ country = countryCode.toUpperCase();
+ variant = variantCode.toUpperCase();
+ hashcode = (languageCode.hashCode()
+ ^ countryCode.hashCode()
+ ^ variantCode.hashCode());
}
public Object clone ()
- {
- return (Object) new Locale (language, country, variant);
- }
+ {
+ return (Object) new Locale (language, country, variant);
+ }
public boolean equals (Object obj)
{
if (! (obj instanceof Locale))
return false;
Locale loc = (Locale) obj;
- if ((language == null && loc.language != null)
- || (country == null && loc.country != null)
- || (variant == null && loc.variant != null))
- return false;
return (language.equals(loc.language)
&& country.equals(loc.country)
&& variant.equals(loc.variant));
@@ -115,7 +116,7 @@ public final class Locale implements java.io.Serializable, Cloneable
result.append(language);
result.append('_');
result.append(country);
- if (variant != null && variant.length() > 0)
+ if (variant.length() > 0)
{
result.append('_');
result.append(variant);
diff --git a/libjava/java/util/ResourceBundle.java b/libjava/java/util/ResourceBundle.java
index ba1d3f9fdcb..05503c619e9 100644
--- a/libjava/java/util/ResourceBundle.java
+++ b/libjava/java/util/ResourceBundle.java
@@ -20,6 +20,9 @@ public abstract class ResourceBundle
{
protected ResourceBundle parent;
+ // This is used to cache resource bundles.
+ private static Hashtable resource_cache = new Hashtable ();
+
public ResourceBundle ()
{
}
@@ -65,15 +68,17 @@ public abstract class ResourceBundle
String stopHere)
{
Class rbc;
+ ResourceBundle needs_parent = null, r, result = null;
while (true)
{
try
{
rbc = Class.forName(bundleName);
+ r = null;
try
{
- return (ResourceBundle) rbc.newInstance();
+ r = (ResourceBundle) rbc.newInstance();
}
catch (IllegalAccessException ex)
{
@@ -83,45 +88,61 @@ public abstract class ResourceBundle
{
// Fall through
}
- return null;
+ if (r != null)
+ {
+ if (result == null)
+ result = r;
+ if (needs_parent != null)
+ {
+ // We've been through the loop one or more times
+ // already. Set the parent and keep going.
+ needs_parent.setParent(r);
+ }
+ needs_parent = r;
+ }
}
catch (ClassNotFoundException ex)
{
- if (bundleName.compareTo(stopHere) == 0)
- return null;
- else
- {
- int last = bundleName.lastIndexOf('_');
-
- // No more underscores?
- if (last == -1)
- return null;
+ // Fall through.
+ }
+
+ if (bundleName.equals(stopHere))
+ return result;
+ else
+ {
+ int last = bundleName.lastIndexOf('_');
- // Loop around, testing this new shorter name.
- bundleName = bundleName.substring(0, last);
- }
+ // No more underscores?
+ if (last == -1)
+ return result;
+
+ // Loop around, testing this new shorter name.
+ bundleName = bundleName.substring(0, last);
}
}
}
-
- // Search for bundles, but stop at baseName_language.
- private static final ResourceBundle partialGetBundle (String baseName,
- Locale locale)
+
+ // Search for bundles, but stop at baseName_language (if required).
+ // This is synchronized so that the cache works correctly.
+ private static final synchronized ResourceBundle
+ partialGetBundle (String baseName, Locale locale, boolean langStop)
{
ResourceBundle rb;
- String bundleName = (baseName
- + "_"
- + locale.getLanguage() + "_"
- + locale.getCountry() + "_"
- + locale.getVariant());
+ String bundleName = baseName + "_" + locale;
+
+ // Check the cache.
+ Object obj = resource_cache.get(bundleName);
+ if (obj != null)
+ return (ResourceBundle) obj;
String stopHere = (baseName
- + "_"
- + locale.getLanguage());
+ + (langStop ? ("_" + locale.getLanguage()) : ""));
rb = trySomeGetBundle(bundleName, stopHere);
+ if (rb != null)
+ resource_cache.put(bundleName, rb);
return rb;
}
@@ -138,39 +159,18 @@ public abstract class ResourceBundle
if (locale == null)
throw new NullPointerException ();
- rb = partialGetBundle(baseName, locale);
+ rb = partialGetBundle(baseName, locale, false);
if (rb != null)
return rb;
+ // Finally, try the default locale.
if (! locale.equals(Locale.getDefault()))
{
- rb = partialGetBundle(baseName, Locale.getDefault());
+ rb = partialGetBundle(baseName, Locale.getDefault(), true);
if (rb != null)
return rb;
}
- // Try just the baseName.
- try
- {
- rbc = Class.forName (baseName);
- try
- {
- return (ResourceBundle) rbc.newInstance();
- }
- catch (IllegalAccessException ex)
- {
- // Fall through.
- }
- catch (InstantiationException ex)
- {
- // Fall through.
- }
- }
- catch (ClassNotFoundException ex)
- {
- // Fall through.
- }
-
throw new MissingResourceException("can't load bundle",
baseName,
"bundle");
diff --git a/libjava/mauve-libgcj b/libjava/mauve-libgcj
index 50eb7712167..03bcb2645d6 100644
--- a/libjava/mauve-libgcj
+++ b/libjava/mauve-libgcj
@@ -22,8 +22,8 @@ java.text.StringCharacterIterator.iter
# java.text.SimpleDateFormat.getAndSet2DigitYearStart
!java.text.ACIAttribute
!java.text.AttributedCharacterIterator
-!java.text.Collator
-!java.text.RuleBasedCollator
+java.text.Collator
+java.text.RuleBasedCollator
!java.text.resources
!java.text.DateFormat
!java.util.zip