src/share/classes/sun/util/locale/provider/LocaleServiceProviderPool.java

Print this page
rev 5994 : imported patch 8001205

@@ -152,11 +152,20 @@
             provider = lda.getLocaleServiceProvider(c);
             if (provider != null) {
                 providers.putIfAbsent(LocaleProviderAdapter.Type.HOST, provider);
             }
         }
+
+        // Add the Fallback Locale Data Adapter implementation, if needed.
+        lda =  LocaleProviderAdapter.forType(LocaleProviderAdapter.Type.FALLBACK);
+        if (lda != null) {
+            provider = lda.getLocaleServiceProvider(c);
+            if (provider != null) {
+                providers.putIfAbsent(LocaleProviderAdapter.Type.FALLBACK, provider);
     }
+        }
+    }
 
     static void config(Class<? extends Object> caller, String message) {
         PlatformLogger logger = PlatformLogger.getLogger(caller.getCanonicalName());
         logger.config(message);
     }

@@ -178,10 +187,13 @@
                 LocaleServiceProviderPool pool =
                     LocaleServiceProviderPool.getPool(c);
                 all.addAll(pool.getAvailableLocaleList());
             }
 
+            // Remove Locale.ROOT for the compatibility.
+            all.remove(Locale.ROOT);
+
             allAvailableLocales = all.toArray(new Locale[0]);
         }
 
         // No instantiation
         private AllAvailableLocales() {

@@ -206,10 +218,12 @@
      *
      * @return an array of the available locales
      */
     public Locale[] getAvailableLocales() {
         Set<Locale> locList = getAvailableLocaleList();
+        // Remove Locale.ROOT for the compatibility.
+        locList.remove(Locale.ROOT);
         Locale[] tmp = new Locale[locList.size()];
         locList.toArray(tmp);
         return tmp;
     }
 

@@ -220,13 +234,10 @@
                 Locale[] locales = lsp.getAvailableLocales();
                 for (Locale locale: locales) {
                     availableLocales.add(getLookupLocale(locale));
                 }
             }
-
-            // Remove Locale.ROOT for the compatibility.
-            availableLocales.remove(Locale.ROOT);
         }
 
         return availableLocales;
     }