< prev index next >

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

Print this page
rev 59374 : [mq]: 8245241

*** 1,7 **** /* ! * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 36,46 **** import java.util.ResourceBundle.Control; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.spi.LocaleServiceProvider; - import sun.util.logging.PlatformLogger; /** * An instance of this class holds a set of the third party implementations of a particular * locale sensitive service, such as {@link java.util.spi.LocaleNameProvider}. * --- 36,45 ----
*** 119,133 **** */ private LocaleServiceProviderPool (final Class<? extends LocaleServiceProvider> c) { providerClass = c; } - static void config(Class<? extends Object> caller, String message) { - PlatformLogger logger = PlatformLogger.getLogger(caller.getCanonicalName()); - logger.config(message); - } - /** * Lazy loaded set of available locales. * Loading all locales is a very long operation. */ private static class AllAvailableLocales { --- 118,127 ----
*** 280,290 **** for (LocaleServiceProvider lsp: findProviders(current, isObjectProvider)) { providersObj = getter.getObject((P)lsp, locale, key, params); if (providersObj != null) { return providersObj; } else if (isObjectProvider) { ! config(LocaleServiceProviderPool.class, "A locale sensitive service object provider returned null, " + "which should not happen. Provider: " + lsp + " Locale: " + locale); } } } --- 274,285 ---- for (LocaleServiceProvider lsp: findProviders(current, isObjectProvider)) { providersObj = getter.getObject((P)lsp, locale, key, params); if (providersObj != null) { return providersObj; } else if (isObjectProvider) { ! System.getLogger(LocaleServiceProviderPool.class.getCanonicalName()) ! .log(System.Logger.Level.INFO, "A locale sensitive service object provider returned null, " + "which should not happen. Provider: " + lsp + " Locale: " + locale); } } }
*** 339,351 **** static List<Locale> getLookupLocales(Locale locale) { // Note: We currently use the default implementation of // ResourceBundle.Control.getCandidateLocales. The result // returned by getCandidateLocales are already normalized // (no extensions) for service look up. ! List<Locale> lookupLocales = Control.getNoFallbackControl(Control.FORMAT_DEFAULT) .getCandidateLocales("", locale); - return lookupLocales; } /** * Returns an instance of Locale used for service look up. * The result Locale has no extensions except for ja_JP_JP --- 334,345 ---- static List<Locale> getLookupLocales(Locale locale) { // Note: We currently use the default implementation of // ResourceBundle.Control.getCandidateLocales. The result // returned by getCandidateLocales are already normalized // (no extensions) for service look up. ! return Control.getNoFallbackControl(Control.FORMAT_DEFAULT) .getCandidateLocales("", locale); } /** * Returns an instance of Locale used for service look up. * The result Locale has no extensions except for ja_JP_JP
*** 368,378 **** } catch (IllformedLocaleException e) { // A Locale with non-empty extensions // should have well-formed fields except // for ja_JP_JP and th_TH_TH. Therefore, // it should never enter in this catch clause. ! config(LocaleServiceProviderPool.class, "A locale(" + locale + ") has non-empty extensions, but has illformed fields."); // Fallback - script field will be lost. lookupLocale = new Locale(locale.getLanguage(), locale.getCountry(), locale.getVariant()); } --- 362,373 ---- } catch (IllformedLocaleException e) { // A Locale with non-empty extensions // should have well-formed fields except // for ja_JP_JP and th_TH_TH. Therefore, // it should never enter in this catch clause. ! System.getLogger(LocaleServiceProviderPool.class.getCanonicalName()) ! .log(System.Logger.Level.INFO, "A locale(" + locale + ") has non-empty extensions, but has illformed fields."); // Fallback - script field will be lost. lookupLocale = new Locale(locale.getLanguage(), locale.getCountry(), locale.getVariant()); }
*** 400,410 **** * @param key key string to localize, or null if the provider is not * a name provider * @param params provider specific params * @return localized object from the provider */ ! public S getObject(P lsp, Locale locale, String key, Object... params); } } --- 395,405 ---- * @param key key string to localize, or null if the provider is not * a name provider * @param params provider specific params * @return localized object from the provider */ ! S getObject(P lsp, Locale locale, String key, Object... params); } }
< prev index next >