Author: robertj
Date: 2006-01-14 05:14:45 -0500 (Sat, 14 Jan 2006)
New Revision: 55573
Modified:
trunk/mcs/class/corlib/System.Resources/ChangeLog
trunk/mcs/class/corlib/System.Resources/ResourceManager.cs
Log:
2006-01-13 Robert Jordan <[EMAIL PROTECTED]>
* ResourceManager.cs: Fixed GetString/GetObject's recursion
which never fall back to the invariant or neutral culture if
the key was not found in a specific culture. Fixes bug #77242.
Modified: trunk/mcs/class/corlib/System.Resources/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/System.Resources/ChangeLog 2006-01-14 10:14:01 UTC
(rev 55572)
+++ trunk/mcs/class/corlib/System.Resources/ChangeLog 2006-01-14 10:14:45 UTC
(rev 55573)
@@ -1,3 +1,9 @@
+2006-01-13 Robert Jordan <[EMAIL PROTECTED]>
+
+ * ResourceManager.cs: Fixed GetString/GetObject's recursion
+ which never fall back to the invariant or neutral culture if
+ the key was not found in a specific culture. Fixes bug #77242.
+
2005-11-19 Zoltan Varga <[EMAIL PROTECTED]>
* Win32Resources.cs: Add a new 'FileVersion' property.
Modified: trunk/mcs/class/corlib/System.Resources/ResourceManager.cs
===================================================================
--- trunk/mcs/class/corlib/System.Resources/ResourceManager.cs 2006-01-14
10:14:01 UTC (rev 55572)
+++ trunk/mcs/class/corlib/System.Resources/ResourceManager.cs 2006-01-14
10:14:45 UTC (rev 55573)
@@ -9,7 +9,7 @@
//
//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004, 2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
@@ -161,44 +161,37 @@
return(GetObject(name, null));
}
- public virtual object GetObject(string name, CultureInfo
culture)
+ public virtual object GetObject (string name, CultureInfo
culture)
{
- if(name==null) {
- throw new ArgumentNullException("name is null");
+ if (name == null) {
+ throw new ArgumentNullException("name");
}
- if(culture==null) {
- culture=CultureInfo.CurrentUICulture;
+ if (culture == null) {
+ culture = CultureInfo.CurrentUICulture;
}
- lock(this) {
- ResourceSet set=InternalGetResourceSet(culture,
true, true);
- object obj=null;
+ lock (this) {
+ while (true) {
+
+ ResourceSet set =
InternalGetResourceSet (culture, true, true);
- if(set != null) {
- obj=set.GetObject(name, ignoreCase);
- if(obj != null) {
- return(obj);
+ if (set != null) {
+ object obj =
set.GetObject(name, ignoreCase);
+ if (obj != null) {
+ return obj;
+ }
}
- }
-
- /* Try parent cultures */
- do {
- culture=culture.Parent;
+ if (culture == neutral_culture ||
+ culture ==
CultureInfo.InvariantCulture)
+ break;
- set=InternalGetResourceSet(culture,
true, true);
- if(set!=null) {
- obj=set.GetObject(name,
ignoreCase);
- if(obj != null) {
- return(obj);
- }
- }
- } while(!culture.Equals(neutral_culture) &&
-
!culture.Equals(CultureInfo.InvariantCulture));
+ culture = culture.Parent;
+ }
}
- return(null);
+ return null;
}
@@ -223,41 +216,33 @@
public virtual string GetString (string name, CultureInfo
culture)
{
if (name == null) {
- throw new ArgumentNullException ("Name is
null.");
+ throw new ArgumentNullException ("name");
}
- if(culture==null) {
- culture=CultureInfo.CurrentUICulture;
+ if(culture == null) {
+ culture = CultureInfo.CurrentUICulture;
}
- lock(this) {
- ResourceSet set=InternalGetResourceSet(culture,
true, true);
- string str=null;
+ lock (this) {
+ while (true) {
+ ResourceSet set =
InternalGetResourceSet (culture, true, true);
- if(set!=null) {
- str=set.GetString(name, ignoreCase);
- if(str!=null) {
- return(str);
+ if (set != null) {
+ string str = set.GetString
(name, ignoreCase);
+ if (str != null) {
+ return str;
+ }
}
- }
- /* Try parent cultures */
+ if (culture == neutral_culture ||
+ culture ==
CultureInfo.InvariantCulture)
+ break;
- do {
- culture=culture.Parent;
-
- set=InternalGetResourceSet(culture,
true, true);
- if(set!=null) {
- str=set.GetString(name,
ignoreCase);
- if(str!=null) {
- return(str);
- }
- }
- } while(!culture.Equals(neutral_culture) &&
-
!culture.Equals(CultureInfo.InvariantCulture));
+ culture = culture.Parent;
+ }
}
- return(null);
+ return null;
}
protected virtual string GetResourceFileName (CultureInfo
culture)
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches