test/java/util/PluggableLocale/providersrc/CurrencyNameProviderImpl2.java
Print this page
rev 6116 : imported patch 7199750
*** 30,40 ****
import java.util.spi.*;
import com.foobar.Utils;
public class CurrencyNameProviderImpl2 extends CurrencyNameProvider {
! static Locale[] avail = {new Locale("ja", "JP", "tokyo")};
public Locale[] getAvailableLocales() {
return avail;
}
@Override
--- 30,41 ----
import java.util.spi.*;
import com.foobar.Utils;
public class CurrencyNameProviderImpl2 extends CurrencyNameProvider {
! static Locale[] avail = {new Locale("ja", "JP", "tokyo"),
! new Locale("ja", "JP", "osaka"), };
public Locale[] getAvailableLocales() {
return avail;
}
@Override
*** 41,63 ****
public String getSymbol(String c, Locale locale) {
if (!Utils.supportsLocale(Arrays.asList(avail), locale)) {
throw new IllegalArgumentException("locale is not supported: "+locale);
}
! if (c.equals("JPY") && Utils.supportsLocale(avail[0], locale)) {
return "JPY-tokyo";
}
return null;
}
@Override
public String getDisplayName(String c, Locale locale) {
if (!Utils.supportsLocale(Arrays.asList(avail), locale)) {
throw new IllegalArgumentException("locale is not supported: "+locale);
}
! if (c.equals("JPY") && Utils.supportsLocale(avail[0], locale)) {
return "JPY-tokyo";
}
return null;
}
}
--- 42,72 ----
public String getSymbol(String c, Locale locale) {
if (!Utils.supportsLocale(Arrays.asList(avail), locale)) {
throw new IllegalArgumentException("locale is not supported: "+locale);
}
! 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;
}
@Override
public String getDisplayName(String c, Locale locale) {
if (!Utils.supportsLocale(Arrays.asList(avail), locale)) {
throw new IllegalArgumentException("locale is not supported: "+locale);
}
! 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;
}
}