]> granicus.if.org Git - icu/commitdiff
ICU-8787 merge fix for #8864
authorDragan Besevic <chonbey@hotmail.com>
Fri, 3 Feb 2012 18:40:19 +0000 (18:40 +0000)
committerDragan Besevic <chonbey@hotmail.com>
Fri, 3 Feb 2012 18:40:19 +0000 (18:40 +0000)
X-SVN-Rev: 31321

main/classes/core/src/com/ibm/icu/impl/ICUResourceTableAccess.java
main/tests/core/src/com/ibm/icu/dev/test/util/ICUResourceBundleTest.java

index 561124ec2958c80cf7cdda4beae3fea8ad861f72..5908e163938da1698a4821eb0c03e803c96eed1a 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *******************************************************************************
- * Copyright (C) 2009, International Business Machines Corporation and         *
+ * Copyright (C) 2009-2012, International Business Machines Corporation and         *
  * others. All Rights Reserved.                                                *
  *******************************************************************************
  */
@@ -31,6 +31,7 @@ public class ICUResourceTableAccess {
      */
     public static String getTableString(ICUResourceBundle bundle, String tableName,
             String subtableName, String item) {
+        String result = null;
         try {
             for (;;) {
                 // special case currency
@@ -50,7 +51,8 @@ public class ICUResourceTableAccess {
                     if (stable != null) {
                         ICUResourceBundle sbundle = lookup(stable, item);
                         if (sbundle != null) {
-                            return sbundle.getString(); // possible real exception
+                            result = sbundle.getString(); // possible real exception
+                            break;
                         }
                     }
 
@@ -65,7 +67,8 @@ public class ICUResourceTableAccess {
                         }
                         ICUResourceBundle sbundle = lookup(table, currentName);
                         if (sbundle != null) {
-                            return sbundle.getString(); // possible real exception
+                            result = sbundle.getString(); // possible real exception
+                            break;
                         }
                     }
 
@@ -93,7 +96,7 @@ public class ICUResourceTableAccess {
             // not a string.  That will throw an exception, which we catch and ignore here.
         }
 
-        return item;
+        return ((result != null && result.length() > 0) ? result : item); 
     }
 
     // utility to make the call sites in the above code cleaner
index cd01c5539259fa76ff770897a2f98e79089dd2f1..7d694abdaa2e511fef6fef4c2f3201dee37ee8a5 100644 (file)
@@ -1,6 +1,6 @@
 /**
  *******************************************************************************
- * Copyright (C) 2001-2011, International Business Machines Corporation and    *
+ * Copyright (C) 2001-2012, International Business Machines Corporation and    *
  * others. All Rights Reserved.                                                *
  *******************************************************************************
  */
@@ -690,7 +690,7 @@ public final class ICUResourceBundleTest extends TestFmwk {
                 errln("Could not get localized country for "+ locales[i]);
                 hasLocalizedCountryFor(locales[i], locales[i]);
             }
-            if(!hasLocalizedLanguageFor(locales[i], locales[i])){
+            if(!hasLocalizedLanguageFor(locales[i], locales[i]) && (locales[i].getLanguage().compareTo("nmg") != 0)){
                 errln("Could not get localized language for "+ locales[i]);
             }