--- /dev/null 2014-07-14 16:37:22.333786882 -0700 +++ new/src/java.base/share/classes/sun/util/locale/provider/JREENLocaleDataMetaInfo.java 2014-08-22 11:18:48.892223028 -0700 @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2005, 2014, 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 + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * This class contains a map which records the locale list string for + * each resource in sun.util.resources & sun.text.resources. + * It is used to avoid loading non-existent localized resources so that + * jar files won't be opened unnecessary to look up them. + * + * @since 1.6 + */ +package sun.util.locale.provider; + +import java.util.HashMap; + +public class JREENLocaleDataMetaInfo implements LocaleDataMetaInfo { + + private static final HashMap resourceNameToLocales = + new HashMap<>(6); + + + static { + resourceNameToLocales.put("FormatData", + "en en-AU en-CA en-GB en-IE en-IN en-MT en-NZ en-PH en-SG en-US en-ZA"); + resourceNameToLocales.put("TimeZoneNames", "en en-CA en-GB en-IE"); + resourceNameToLocales.put("LocaleNames", "en en-MT en-PH en-SG"); + resourceNameToLocales.put("CurrencyNames", + "en-AU en-CA en-GB en-IE en-IN en-MT en-NZ en-PH en-SG en-US en-ZA"); + resourceNameToLocales.put("CalendarData", "en en-GB en-IE en-MT"); + resourceNameToLocales.put("AvailableLocales", + "en en-AU en-CA en-GB en-IE en-IN en-MT en-NZ en-PH en-SG en-US en-ZA"); + } + + /* + * @param resourceName the resource name + * @return the supported locale string for the passed in resource. + */ + public static String getSupportedLocaleString(String resourceName) { + String supportedLocaleString = resourceNameToLocales.get(resourceName); + return supportedLocaleString != null ? supportedLocaleString : ""; + } + + @Override + public LocaleProviderAdapter.Type getType() { + return LocaleProviderAdapter.Type.JRE; + } + + @Override + public String availableLanguageTags(String category) { + return getSupportedLocaleString(category); + } +}