1.1 --- a/rt/emul/compact/src/main/java/java/util/Currency.java Thu Oct 03 15:40:35 2013 +0200
1.2 +++ b/rt/emul/compact/src/main/java/java/util/Currency.java Fri Oct 04 12:01:56 2013 +0200
1.3 @@ -35,14 +35,7 @@
1.4 import java.security.AccessController;
1.5 import java.security.PrivilegedAction;
1.6 import java.util.logging.Level;
1.7 -import java.util.regex.Pattern;
1.8 -import java.util.regex.Matcher;
1.9 -import java.util.spi.CurrencyNameProvider;
1.10 -import java.util.spi.LocaleServiceProvider;
1.11 -import sun.util.LocaleServiceProviderPool;
1.12 -import sun.util.logging.PlatformLogger;
1.13 -import sun.util.resources.LocaleData;
1.14 -import sun.util.resources.OpenListResourceBundle;
1.15 +import java.util.logging.Logger;
1.16
1.17
1.18 /**
1.19 @@ -227,27 +220,27 @@
1.20 }
1.21
1.22 // look for the properties file for overrides
1.23 - try {
1.24 +// try {
1.25 File propFile = new File(homeDir + File.separator +
1.26 "lib" + File.separator +
1.27 "currency.properties");
1.28 - if (propFile.exists()) {
1.29 - Properties props = new Properties();
1.30 - try (FileReader fr = new FileReader(propFile)) {
1.31 - props.load(fr);
1.32 - }
1.33 - Set<String> keys = props.stringPropertyNames();
1.34 - Pattern propertiesPattern =
1.35 - Pattern.compile("([A-Z]{3})\\s*,\\s*(\\d{3})\\s*,\\s*([0-3])");
1.36 - for (String key : keys) {
1.37 - replaceCurrencyData(propertiesPattern,
1.38 - key.toUpperCase(Locale.ROOT),
1.39 - props.getProperty(key).toUpperCase(Locale.ROOT));
1.40 - }
1.41 - }
1.42 - } catch (IOException e) {
1.43 - info("currency.properties is ignored because of an IOException", e);
1.44 - }
1.45 +// if (propFile.exists()) {
1.46 +// Properties props = new Properties();
1.47 +// try (FileReader fr = new FileReader(propFile)) {
1.48 +// props.load(fr);
1.49 +// }
1.50 +// Set<String> keys = props.stringPropertyNames();
1.51 +// Pattern propertiesPattern =
1.52 +// Pattern.compile("([A-Z]{3})\\s*,\\s*(\\d{3})\\s*,\\s*([0-3])");
1.53 +// for (String key : keys) {
1.54 +// replaceCurrencyData(propertiesPattern,
1.55 +// key.toUpperCase(Locale.ROOT),
1.56 +// props.getProperty(key).toUpperCase(Locale.ROOT));
1.57 +// }
1.58 +// }
1.59 +// } catch (IOException e) {
1.60 +// info("currency.properties is ignored because of an IOException", e);
1.61 +// }
1.62 return null;
1.63 }
1.64 });
1.65 @@ -472,6 +465,7 @@
1.66 try {
1.67 // Check whether a provider can provide an implementation that's closer
1.68 // to the requested locale than what the Java runtime itself can provide.
1.69 + /*
1.70 LocaleServiceProviderPool pool =
1.71 LocaleServiceProviderPool.getPool(CurrencyNameProvider.class);
1.72
1.73 @@ -489,8 +483,8 @@
1.74 return symbol;
1.75 }
1.76 }
1.77 -
1.78 - ResourceBundle bundle = LocaleData.getCurrencyNames(locale);
1.79 + */
1.80 + ResourceBundle bundle = null; //LocaleData.getCurrencyNames(locale);
1.81 return bundle.getString(currencyCode);
1.82 } catch (MissingResourceException e) {
1.83 // use currency code as symbol of last resort
1.84 @@ -545,31 +539,31 @@
1.85 * @since 1.7
1.86 */
1.87 public String getDisplayName(Locale locale) {
1.88 - try {
1.89 - OpenListResourceBundle bundle = LocaleData.getCurrencyNames(locale);
1.90 - String result = null;
1.91 - String bundleKey = currencyCode.toLowerCase(Locale.ROOT);
1.92 -
1.93 - // Check whether a provider can provide an implementation that's closer
1.94 - // to the requested locale than what the Java runtime itself can provide.
1.95 - LocaleServiceProviderPool pool =
1.96 - LocaleServiceProviderPool.getPool(CurrencyNameProvider.class);
1.97 - if (pool.hasProviders()) {
1.98 - result = pool.getLocalizedObject(
1.99 - CurrencyNameGetter.INSTANCE,
1.100 - locale, bundleKey, bundle, currencyCode, DISPLAYNAME);
1.101 - }
1.102 -
1.103 - if (result == null) {
1.104 - result = bundle.getString(bundleKey);
1.105 - }
1.106 -
1.107 - if (result != null) {
1.108 - return result;
1.109 - }
1.110 - } catch (MissingResourceException e) {
1.111 - // fall through
1.112 - }
1.113 +// try {
1.114 +// OpenListResourceBundle bundle = LocaleData.getCurrencyNames(locale);
1.115 +// String result = null;
1.116 +// String bundleKey = currencyCode.toLowerCase(Locale.ROOT);
1.117 +//
1.118 +// // Check whether a provider can provide an implementation that's closer
1.119 +// // to the requested locale than what the Java runtime itself can provide.
1.120 +// LocaleServiceProviderPool pool =
1.121 +// LocaleServiceProviderPool.getPool(CurrencyNameProvider.class);
1.122 +// if (pool.hasProviders()) {
1.123 +// result = pool.getLocalizedObject(
1.124 +// CurrencyNameGetter.INSTANCE,
1.125 +// locale, bundleKey, bundle, currencyCode, DISPLAYNAME);
1.126 +// }
1.127 +//
1.128 +// if (result == null) {
1.129 +// result = bundle.getString(bundleKey);
1.130 +// }
1.131 +//
1.132 +// if (result != null) {
1.133 +// return result;
1.134 +// }
1.135 +// } catch (MissingResourceException e) {
1.136 +// // fall through
1.137 +// }
1.138
1.139 // use currency code as symbol of last resort
1.140 return currencyCode;
1.141 @@ -616,7 +610,6 @@
1.142 /**
1.143 * Obtains a localized currency names from a CurrencyNameProvider
1.144 * implementation.
1.145 - */
1.146 private static class CurrencyNameGetter
1.147 implements LocaleServiceProviderPool.LocalizedObjectGetter<CurrencyNameProvider,
1.148 String> {
1.149 @@ -641,6 +634,7 @@
1.150 return null;
1.151 }
1.152 }
1.153 + */
1.154
1.155 private static int[] readIntArray(DataInputStream dis, int count) throws IOException {
1.156 int[] ret = new int[count];
1.157 @@ -679,7 +673,6 @@
1.158 * and "one-digit (0,1,2, or 3) default fraction digit".
1.159 * For example, "JPZ,392,0".
1.160 * @throws
1.161 - */
1.162 private static void replaceCurrencyData(Pattern pattern, String ctry, String curdata) {
1.163
1.164 if (ctry.length() != 2) {
1.165 @@ -727,12 +720,13 @@
1.166 }
1.167 setMainTableEntry(ctry.charAt(0), ctry.charAt(1), entry);
1.168 }
1.169 + */
1.170
1.171 private static void info(String message, Throwable t) {
1.172 - PlatformLogger logger = PlatformLogger.getLogger("java.util.Currency");
1.173 - if (logger.isLoggable(PlatformLogger.INFO)) {
1.174 + Logger logger = Logger.getLogger("java.util.Currency");
1.175 + if (logger.isLoggable(Level.INFO)) {
1.176 if (t != null) {
1.177 - logger.info(message, t);
1.178 + logger.log(Level.INFO, message, t);
1.179 } else {
1.180 logger.info(message);
1.181 }