提交 e8364968 编写于 作者: N naoto

7199750: Loading sequence of service provider is changed

Reviewed-by: okutsu
上级 60ba0fdd
......@@ -91,7 +91,7 @@ public class SPILocaleProviderAdapter extends AuxLocaleProviderAdapter {
IllegalAccessException e) {
LocaleServiceProviderPool.config(SPILocaleProviderAdapter.class, e.toString());
return null;
}
}
}
((Delegate)delegate).addImpl(provider);
......@@ -112,7 +112,7 @@ public class SPILocaleProviderAdapter extends AuxLocaleProviderAdapter {
interface Delegate<P extends LocaleServiceProvider> {
public void addImpl(P impl);
public P getImpl(Locale locale);
}
}
/*
* Obtain the real SPI implementation, using locale fallback
......@@ -137,7 +137,7 @@ public class SPILocaleProviderAdapter extends AuxLocaleProviderAdapter {
@Override
public void addImpl(BreakIteratorProvider impl) {
for (Locale l : impl.getAvailableLocales()) {
map.put(l, impl);
map.putIfAbsent(l, impl);
}
}
......@@ -192,7 +192,7 @@ public class SPILocaleProviderAdapter extends AuxLocaleProviderAdapter {
@Override
public void addImpl(CollatorProvider impl) {
for (Locale l : impl.getAvailableLocales()) {
map.put(l, impl);
map.putIfAbsent(l, impl);
}
}
......@@ -226,7 +226,7 @@ public class SPILocaleProviderAdapter extends AuxLocaleProviderAdapter {
@Override
public void addImpl(DateFormatProvider impl) {
for (Locale l : impl.getAvailableLocales()) {
map.put(l, impl);
map.putIfAbsent(l, impl);
}
}
......@@ -274,7 +274,7 @@ public class SPILocaleProviderAdapter extends AuxLocaleProviderAdapter {
@Override
public void addImpl(DateFormatSymbolsProvider impl) {
for (Locale l : impl.getAvailableLocales()) {
map.put(l, impl);
map.putIfAbsent(l, impl);
}
}
......@@ -308,7 +308,7 @@ public class SPILocaleProviderAdapter extends AuxLocaleProviderAdapter {
@Override
public void addImpl(DecimalFormatSymbolsProvider impl) {
for (Locale l : impl.getAvailableLocales()) {
map.put(l, impl);
map.putIfAbsent(l, impl);
}
}
......@@ -342,7 +342,7 @@ public class SPILocaleProviderAdapter extends AuxLocaleProviderAdapter {
@Override
public void addImpl(NumberFormatProvider impl) {
for (Locale l : impl.getAvailableLocales()) {
map.put(l, impl);
map.putIfAbsent(l, impl);
}
}
......@@ -397,7 +397,7 @@ public class SPILocaleProviderAdapter extends AuxLocaleProviderAdapter {
@Override
public void addImpl(CalendarDataProvider impl) {
for (Locale l : impl.getAvailableLocales()) {
map.put(l, impl);
map.putIfAbsent(l, impl);
}
}
......@@ -438,7 +438,7 @@ public class SPILocaleProviderAdapter extends AuxLocaleProviderAdapter {
@Override
public void addImpl(CalendarNameProvider impl) {
for (Locale l : impl.getAvailableLocales()) {
map.put(l, impl);
map.putIfAbsent(l, impl);
}
}
......@@ -483,7 +483,7 @@ public class SPILocaleProviderAdapter extends AuxLocaleProviderAdapter {
@Override
public void addImpl(CurrencyNameProvider impl) {
for (Locale l : impl.getAvailableLocales()) {
map.put(l, impl);
map.putIfAbsent(l, impl);
}
}
......@@ -524,7 +524,7 @@ public class SPILocaleProviderAdapter extends AuxLocaleProviderAdapter {
@Override
public void addImpl(LocaleNameProvider impl) {
for (Locale l : impl.getAvailableLocales()) {
map.put(l, impl);
map.putIfAbsent(l, impl);
}
}
......@@ -579,7 +579,7 @@ public class SPILocaleProviderAdapter extends AuxLocaleProviderAdapter {
@Override
public void addImpl(TimeZoneNameProvider impl) {
for (Locale l : impl.getAvailableLocales()) {
map.put(l, impl);
map.putIfAbsent(l, impl);
}
}
......
......@@ -23,6 +23,6 @@
#!/bin/sh
#
# @test
# @bug 4052440 8000997
# @bug 4052440 7199750 8000997
# @summary CurrencyNameProvider tests
# @run shell ExecTest.sh bar CurrencyNameProviderTest true
......@@ -32,7 +32,8 @@ import java.util.spi.*;
import com.foobar.Utils;
public class CurrencyNameProviderImpl2 extends CurrencyNameProvider {
static Locale[] avail = {new Locale("ja", "JP", "tokyo")};
static Locale[] avail = {new Locale("ja", "JP", "tokyo"),
new Locale("ja", "JP", "osaka"), };
public Locale[] getAvailableLocales() {
return avail;
}
......@@ -43,8 +44,12 @@ public class CurrencyNameProviderImpl2 extends CurrencyNameProvider {
throw new IllegalArgumentException("locale is not supported: "+locale);
}
if (c.equals("JPY") && Utils.supportsLocale(avail[0], locale)) {
return "JPY-tokyo";
if (c.equals("JPY")) {
if (Utils.supportsLocale(avail[0], locale)) {
return "JPY-tokyo";
} else if (Utils.supportsLocale(avail[1], locale)) {
return "JPY-osaka";
}
}
return null;
}
......@@ -55,8 +60,12 @@ public class CurrencyNameProviderImpl2 extends CurrencyNameProvider {
throw new IllegalArgumentException("locale is not supported: "+locale);
}
if (c.equals("JPY") && Utils.supportsLocale(avail[0], locale)) {
return "JPY-tokyo";
if (c.equals("JPY")) {
if (Utils.supportsLocale(avail[0], locale)) {
return "JPY-tokyo";
} else if (Utils.supportsLocale(avail[1], locale)) {
return "JPY-osaka";
}
}
return null;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册