8210406: Refactor java.util.PluggableLocale:i18n shell tests to plain java tests
Reviewed-by: naoto
--- a/test/jdk/java/util/PluggableLocale/BreakIteratorProviderTest.java Thu Oct 18 09:19:29 2018 +0200
+++ b/test/jdk/java/util/PluggableLocale/BreakIteratorProviderTest.java Thu Oct 18 00:56:38 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2018, 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
@@ -20,27 +20,41 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
/*
- *
+ * @test
+ * @bug 4052440 8062588 8165804 8210406
+ * @summary BreakIteratorProvider tests
+ * @library providersrc/foobarutils
+ * providersrc/fooprovider
+ * @modules java.base/sun.util.locale.provider
+ * java.base/sun.util.resources
+ * @build com.foobar.Utils
+ * com.foo.*
+ * @run main/othervm -Djava.locale.providers=JRE,SPI BreakIteratorProviderTest
*/
-import java.text.*;
-import java.util.*;
-import sun.util.locale.provider.*;
+import java.text.BreakIterator;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Locale;
+import java.util.ResourceBundle;
+import java.util.Set;
+
+import com.foo.BreakIteratorProviderImpl;
+
+import sun.util.locale.provider.LocaleProviderAdapter;
+import sun.util.locale.provider.ResourceBundleBasedAdapter;
public class BreakIteratorProviderTest extends ProviderTest {
- com.foo.BreakIteratorProviderImpl bip = new com.foo.BreakIteratorProviderImpl();
+ BreakIteratorProviderImpl bip = new BreakIteratorProviderImpl();
List<Locale> availloc = Arrays.asList(BreakIterator.getAvailableLocales());
List<Locale> providerloc = Arrays.asList(bip.getAvailableLocales());
List<Locale> jreloc = Arrays.asList(LocaleProviderAdapter.forJRE().getAvailableLocales());
List<Locale> jreimplloc = Arrays.asList(LocaleProviderAdapter.forJRE().getBreakIteratorProvider().getAvailableLocales());
- private static final int CHARACTER_INDEX = 0;
- private static final int WORD_INDEX = 1;
- private static final int LINE_INDEX = 2;
- private static final int SENTENCE_INDEX = 3;
-
public static void main(String[] s) {
new BreakIteratorProviderTest();
}
@@ -98,4 +112,4 @@
}
}
}
-}
+}
\ No newline at end of file
--- a/test/jdk/java/util/PluggableLocale/BreakIteratorProviderTest.sh Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2007, 2016, 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.
-#
-# 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.
-#
-#
-# @test
-# @bug 4052440 8062588 8165804
-# @summary BreakIteratorProvider tests
-# @run shell ExecTest.sh foo BreakIteratorProviderTest
--- a/test/jdk/java/util/PluggableLocale/CalendarDataProviderTest.java Thu Oct 18 09:19:29 2018 +0200
+++ b/test/jdk/java/util/PluggableLocale/CalendarDataProviderTest.java Thu Oct 18 00:56:38 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, 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
@@ -20,16 +20,22 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
/*
- *
+ * @test
+ * @bug 7058207 8000986 8062588 8210406
+ * @summary CalendarDataProvider tests
+ * @library providersrc/foobarutils
+ * providersrc/barprovider
+ * @build com.foobar.Utils
+ * com.bar.*
+ * @run main/othervm -Djava.locale.providers=JRE,SPI CalendarDataProviderTest
*/
-import java.text.*;
-import java.util.*;
-import static java.util.Calendar.*;
-import sun.util.locale.provider.*;
-import sun.util.resources.*;
-import com.bar.CalendarDataProviderImpl;
+import java.util.Calendar;
+import java.util.Locale;
+
+import static java.util.Calendar.WEDNESDAY;
/**
* Test case for CalendarDataProvider.
@@ -51,7 +57,6 @@
void test() {
Locale kids = new Locale("ja", "JP", "kids"); // test provider's supported locale
Calendar kcal = Calendar.getInstance(kids);
- Calendar jcal = Calendar.getInstance(Locale.JAPAN);
// check the week parameters
checkResult("firstDayOfWeek", kcal.getFirstDayOfWeek(), WEDNESDAY);
@@ -64,4 +69,4 @@
throw new RuntimeException(s);
}
}
-}
+}
\ No newline at end of file
--- a/test/jdk/java/util/PluggableLocale/CalendarDataProviderTest.sh Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2012, 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.
-#
-# 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.
-#
-#
-# @test
-# @bug 7058207 8000986 8062588
-# @summary CalendarDataProvider tests
-# @run shell ExecTest.sh bar CalendarDataProviderTest
--- a/test/jdk/java/util/PluggableLocale/CalendarNameProviderTest.java Thu Oct 18 09:19:29 2018 +0200
+++ b/test/jdk/java/util/PluggableLocale/CalendarNameProviderTest.java Thu Oct 18 00:56:38 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, 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
@@ -20,17 +20,37 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
/*
- *
+ * @test
+ * @bug 8000986 8062588 8210406
+ * @summary CalendarNameProvider tests
+ * @library providersrc/foobarutils
+ * providersrc/barprovider
+ * @build com.foobar.Utils
+ * com.bar.*
+ * @run main/othervm -Djava.locale.providers=JRE,SPI CalendarNameProviderTest
*/
-import java.text.*;
-import java.util.*;
-import static java.util.Calendar.*;
-import sun.util.locale.provider.*;
-import sun.util.resources.*;
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
import com.bar.CalendarNameProviderImpl;
+import static java.util.Calendar.ALL_STYLES;
+import static java.util.Calendar.DAY_OF_MONTH;
+import static java.util.Calendar.DAY_OF_WEEK;
+import static java.util.Calendar.DECEMBER;
+import static java.util.Calendar.HOUR_OF_DAY;
+import static java.util.Calendar.JANUARY;
+import static java.util.Calendar.LONG_STANDALONE;
+import static java.util.Calendar.MONTH;
+import static java.util.Calendar.SATURDAY;
+import static java.util.Calendar.SHORT_STANDALONE;
+import static java.util.Calendar.SUNDAY;
+
/**
* Test case for CalendarNameProvider.
*
@@ -101,4 +121,4 @@
throw new RuntimeException(s);
}
}
-}
+}
\ No newline at end of file
--- a/test/jdk/java/util/PluggableLocale/CalendarNameProviderTest.sh Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-#
-# Copyright (c) 2012, 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.
-#
-# 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.
-#
-
-# @test
-# @bug 8000986 8062588
-# @summary CalendarNameProvider tests
-# @run shell ExecTest.sh bar CalendarNameProviderTest
--- a/test/jdk/java/util/PluggableLocale/ClasspathTest.java Thu Oct 18 09:19:29 2018 +0200
+++ b/test/jdk/java/util/PluggableLocale/ClasspathTest.java Thu Oct 18 00:56:38 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2018, 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
@@ -20,13 +20,21 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
/*
- *
+ * @test
+ * @bug 6388652 8062588 8210406
+ * @summary Checks whether providers can be loaded from classpath.
+ * @library providersrc/foobarutils
+ * providersrc/barprovider
+ * @build com.foobar.Utils
+ * com.bar.*
+ * @run main/othervm -Djava.locale.providers=JRE,SPI ClasspathTest
*/
-import java.text.*;
-import java.util.*;
-import sun.util.resources.*;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Locale;
public class ClasspathTest {
@@ -45,4 +53,4 @@
throw new RuntimeException("LSS providers were NOT loaded from the class path.");
}
}
-}
+}
\ No newline at end of file
--- a/test/jdk/java/util/PluggableLocale/ClasspathTest.sh Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2007, 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.
-#
-# 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.
-#
-#
-# @test
-# @bug 6388652 8062588
-# @summary Checks whether providers can be loaded from classpath.
-# @run shell ExecTest.sh bar ClasspathTest
--- a/test/jdk/java/util/PluggableLocale/CollatorProviderTest.java Thu Oct 18 09:19:29 2018 +0200
+++ b/test/jdk/java/util/PluggableLocale/CollatorProviderTest.java Thu Oct 18 00:56:38 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2018, 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
@@ -20,18 +20,40 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
/*
- *
+ * @test
+ * @bug 4052440 8062588 8210406
+ * @summary CollatorProvider tests
+ * @library providersrc/foobarutils
+ * providersrc/fooprovider
+ * @modules java.base/sun.util.locale.provider
+ * java.base/sun.util.resources
+ * @build com.foobar.Utils
+ * com.foo.*
+ * @run main/othervm -Djava.locale.providers=JRE,SPI CollatorProviderTest
*/
-import java.text.*;
-import java.util.*;
-import sun.util.locale.provider.*;
-import sun.util.resources.*;
+import java.text.Collator;
+import java.text.ParseException;
+import java.text.RuleBasedCollator;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+import java.util.Set;
+
+import com.foo.CollatorProviderImpl;
+
+import sun.util.locale.provider.AvailableLanguageTags;
+import sun.util.locale.provider.LocaleProviderAdapter;
+import sun.util.locale.provider.ResourceBundleBasedAdapter;
public class CollatorProviderTest extends ProviderTest {
- com.foo.CollatorProviderImpl cp = new com.foo.CollatorProviderImpl();
+ CollatorProviderImpl cp = new CollatorProviderImpl();
List<Locale> availloc = Arrays.asList(Collator.getAvailableLocales());
List<Locale> providerloc = Arrays.asList(cp.getAvailableLocales());
List<Locale> jreloc = Arrays.asList(LocaleProviderAdapter.forJRE().getAvailableLocales());
@@ -94,4 +116,4 @@
checkValidity(target, jresResult, providersResult, result, jreSupportsLocale);
}
}
-}
+}
\ No newline at end of file
--- a/test/jdk/java/util/PluggableLocale/CollatorProviderTest.sh Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2007, 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.
-#
-# 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.
-#
-#
-# @test
-# @bug 4052440 8062588
-# @summary CollatorProvider tests
-# @run shell ExecTest.sh foo CollatorProviderTest
--- a/test/jdk/java/util/PluggableLocale/CurrencyNameProviderTest.java Thu Oct 18 09:19:29 2018 +0200
+++ b/test/jdk/java/util/PluggableLocale/CurrencyNameProviderTest.java Thu Oct 18 00:56:38 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2018, 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
@@ -20,14 +20,36 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
/*
- *
+ * @test
+ * @bug 4052440 7199750 8000997 8062588 8210406
+ * @summary CurrencyNameProvider tests
+ * @library providersrc/foobarutils
+ * providersrc/barprovider
+ * @modules java.base/sun.util.locale.provider
+ * java.base/sun.util.resources
+ * @build com.foobar.Utils
+ * com.bar.*
+ * @run main/othervm -Djava.locale.providers=JRE,SPI CurrencyNameProviderTest
*/
-import java.text.*;
-import java.util.*;
-import sun.util.locale.provider.*;
-import sun.util.resources.*;
+import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Currency;
+import java.util.List;
+import java.util.Locale;
+import java.util.MissingResourceException;
+
+import com.bar.CurrencyNameProviderImpl;
+import com.bar.CurrencyNameProviderImpl2;
+
+import sun.util.locale.provider.LocaleProviderAdapter;
+import sun.util.locale.provider.ResourceBundleBasedAdapter;
+import sun.util.resources.OpenListResourceBundle;
public class CurrencyNameProviderTest extends ProviderTest {
@@ -47,8 +69,8 @@
}
void test1() {
- com.bar.CurrencyNameProviderImpl cnp = new com.bar.CurrencyNameProviderImpl();
- com.bar.CurrencyNameProviderImpl2 cnp2 = new com.bar.CurrencyNameProviderImpl2();
+ CurrencyNameProviderImpl cnp = new CurrencyNameProviderImpl();
+ CurrencyNameProviderImpl2 cnp2 = new CurrencyNameProviderImpl2();
Locale[] availloc = Locale.getAvailableLocales();
Locale[] testloc = availloc.clone();
List<Locale> jreimplloc = Arrays.asList(LocaleProviderAdapter.forJRE().getCurrencyNameProvider().getAvailableLocales());
@@ -163,4 +185,4 @@
Locale.setDefault(defloc);
}
}
-}
+}
\ No newline at end of file
--- a/test/jdk/java/util/PluggableLocale/CurrencyNameProviderTest.sh Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2007, 2012, 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.
-#
-# 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.
-#
-#
-# @test
-# @bug 4052440 7199750 8000997 8062588
-# @summary CurrencyNameProvider tests
-# @run shell ExecTest.sh bar CurrencyNameProviderTest
--- a/test/jdk/java/util/PluggableLocale/DateFormatProviderTest.java Thu Oct 18 09:19:29 2018 +0200
+++ b/test/jdk/java/util/PluggableLocale/DateFormatProviderTest.java Thu Oct 18 00:56:38 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2018, 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
@@ -20,18 +20,41 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
/*
- *
+ * @test
+ * @bug 4052440 7003643 8062588 8210406
+ * @summary DateFormatProvider tests
+ * @library providersrc/foobarutils
+ * providersrc/fooprovider
+ * @modules java.base/sun.util.locale.provider
+ * java.base/sun.util.resources
+ * @build com.foobar.Utils
+ * com.foo.*
+ * @run main/othervm -Djava.locale.providers=JRE,SPI DateFormatProviderTest
*/
-import java.text.*;
-import java.util.*;
-import sun.util.locale.provider.*;
-import sun.util.resources.*;
+import java.text.DateFormat;
+import java.text.Format;
+import java.text.MessageFormat;
+import java.text.SimpleDateFormat;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+import java.util.Set;
+
+import com.foo.DateFormatProviderImpl;
+
+import sun.util.locale.provider.LocaleProviderAdapter;
+import sun.util.locale.provider.ResourceBundleBasedAdapter;
public class DateFormatProviderTest extends ProviderTest {
- com.foo.DateFormatProviderImpl dfp = new com.foo.DateFormatProviderImpl();
+ DateFormatProviderImpl dfp = new DateFormatProviderImpl();
List<Locale> availloc = Arrays.asList(DateFormat.getAvailableLocales());
List<Locale> providerloc = Arrays.asList(dfp.getAvailableLocales());
List<Locale> jreloc = Arrays.asList(LocaleProviderAdapter.forJRE().getAvailableLocales());
@@ -181,4 +204,4 @@
}
}
}
-}
+}
\ No newline at end of file
--- a/test/jdk/java/util/PluggableLocale/DateFormatProviderTest.sh Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2007, 2010, 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.
-#
-# 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.
-#
-#
-# @test
-# @bug 4052440 7003643 8062588
-# @summary DateFormatProvider tests
-# @run shell ExecTest.sh foo DateFormatProviderTest
--- a/test/jdk/java/util/PluggableLocale/DateFormatSymbolsProviderTest.java Thu Oct 18 09:19:29 2018 +0200
+++ b/test/jdk/java/util/PluggableLocale/DateFormatSymbolsProviderTest.java Thu Oct 18 00:56:38 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2018, 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
@@ -20,18 +20,37 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
/*
- *
+ * @test
+ * @bug 4052440 7200341 8062588 8210406
+ * @summary DateFormatSymbolsProvider tests
+ * @library providersrc/foobarutils
+ * providersrc/fooprovider
+ * @modules java.base/sun.util.locale.provider
+ * java.base/sun.util.resources
+ * @build com.foobar.Utils
+ * com.foo.*
+ * @run main/othervm -Djava.locale.providers=JRE,SPI DateFormatSymbolsProviderTest
*/
-import java.text.*;
-import java.util.*;
-import sun.util.locale.provider.*;
-import sun.util.resources.*;
+import java.text.DateFormatSymbols;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+import java.util.Set;
+
+import com.foo.DateFormatSymbolsProviderImpl;
+
+import sun.util.locale.provider.LocaleProviderAdapter;
+import sun.util.locale.provider.ResourceBundleBasedAdapter;
public class DateFormatSymbolsProviderTest extends ProviderTest {
- com.foo.DateFormatSymbolsProviderImpl dfsp = new com.foo.DateFormatSymbolsProviderImpl();
+ DateFormatSymbolsProviderImpl dfsp = new DateFormatSymbolsProviderImpl();
List<Locale> availloc = Arrays.asList(DateFormatSymbols.getAvailableLocales());
List<Locale> providerloc = Arrays.asList(dfsp.getAvailableLocales());
List<Locale> jreloc = Arrays.asList(LocaleProviderAdapter.forJRE().getAvailableLocales());
@@ -137,4 +156,4 @@
}
}
}
-}
+}
\ No newline at end of file
--- a/test/jdk/java/util/PluggableLocale/DateFormatSymbolsProviderTest.sh Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2007, 2012, 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.
-#
-# 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.
-#
-#
-# @test
-# @bug 4052440 7200341 8062588
-# @summary DateFormatSymbolsProvider tests
-# @run shell ExecTest.sh foo DateFormatSymbolsProviderTest
--- a/test/jdk/java/util/PluggableLocale/DecimalFormatSymbolsProviderTest.java Thu Oct 18 09:19:29 2018 +0200
+++ b/test/jdk/java/util/PluggableLocale/DecimalFormatSymbolsProviderTest.java Thu Oct 18 00:56:38 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2018, 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
@@ -20,18 +20,33 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
/*
- *
+ * @test
+ * @bug 4052440 8062588 8210406
+ * @summary DecimalFormatSymbolsProvider tests
+ * @library providersrc/foobarutils
+ * providersrc/fooprovider
+ * @modules java.base/sun.util.locale.provider
+ * @build com.foobar.Utils
+ * com.foo.*
+ * @run main/othervm -Djava.locale.providers=JRE,SPI DecimalFormatSymbolsProviderTest
*/
-import java.text.*;
-import java.util.*;
-import sun.util.locale.provider.*;
-import sun.util.resources.*;
+import java.text.DecimalFormatSymbols;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Locale;
+import java.util.Set;
+
+import com.foo.DecimalFormatSymbolsProviderImpl;
+
+import sun.util.locale.provider.LocaleProviderAdapter;
public class DecimalFormatSymbolsProviderTest extends ProviderTest {
- com.foo.DecimalFormatSymbolsProviderImpl dfsp = new com.foo.DecimalFormatSymbolsProviderImpl();
+ DecimalFormatSymbolsProviderImpl dfsp = new DecimalFormatSymbolsProviderImpl();
List<Locale> availloc = Arrays.asList(DecimalFormatSymbols.getAvailableLocales());
List<Locale> providerloc = Arrays.asList(dfsp.getAvailableLocales());
List<Locale> jreloc = Arrays.asList(LocaleProviderAdapter.forJRE().getAvailableLocales());
@@ -92,4 +107,4 @@
}
}
}
-}
+}
\ No newline at end of file
--- a/test/jdk/java/util/PluggableLocale/DecimalFormatSymbolsProviderTest.sh Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2007, 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.
-#
-# 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.
-#
-#
-# @test
-# @bug 4052440 8062588
-# @summary DecimalFormatSymbolsProvider tests
-# @run shell ExecTest.sh foo DecimalFormatSymbolsProviderTest
--- a/test/jdk/java/util/PluggableLocale/ExecTest.sh Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,145 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2007, 2015, 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.
-#
-# 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 script is the actual launcher of each locale service provider test.
-# fooprovider.jar contains localized object providers and barprovider.jar
-# contains localized name providers. This way, we can test providers that
-# can relate to each other (such as, DateFormatSymbolsProvider and
-# TimeZoneNameProvider) separately.
-#
-# Parameters:
-# providersToTest: [foo|bar|foobar]
-# java class name: <class name>
-# java security policy file: (Optional. Installs security manager if exists)
-
-if [ "${TESTSRC}" = "" ]
-then
- echo "TESTSRC not set. Test cannot execute. Failed."
- exit 1
-fi
-echo "TESTSRC=${TESTSRC}"
-if [ "${TESTJAVA}" = "" ]
-then
- echo "TESTJAVA not set. Test cannot execute. Failed."
- exit 1
-fi
-if [ "${COMPILEJAVA}" = "" ]
-then
- COMPILEJAVA="${TESTJAVA}"
-fi
-echo "TESTJAVA=${TESTJAVA}"
-if [ "${TESTCLASSES}" = "" ]
-then
- echo "TESTCLASSES not set. Test cannot execute. Failed."
- exit 1
-fi
-echo "TESTCLASSES=${TESTCLASSES}"
-echo "CLASSPATH=${CLASSPATH}"
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
- SunOS | Linux | Darwin | AIX )
- PS=":"
- FS="/"
- ;;
- Windows* | CYGWIN* )
- PS=";"
- FS="\\"
- ;;
- * )
- echo "Unrecognized system!"
- exit 1;
- ;;
-esac
-
-case "$1" in
- "foo" )
- cp ${TESTSRC}${FS}fooprovider.jar ${TESTCLASSES}
- CLASSPATHARG=".${PS}${TESTSRC}${PS}${TESTSRC}${FS}fooprovider.jar"
- ;;
- "bar" )
- cp ${TESTSRC}${FS}barprovider.jar ${TESTCLASSES}
- CLASSPATHARG=".${PS}${TESTSRC}${PS}${TESTSRC}${FS}barprovider.jar"
- ;;
- "foobar" )
- cp ${TESTSRC}${FS}fooprovider.jar ${TESTCLASSES}
- cp ${TESTSRC}${FS}barprovider.jar ${TESTCLASSES}
- CLASSPATHARG=".${PS}${TESTSRC}${PS}${TESTSRC}${FS}fooprovider.jar${PS}${TESTSRC}${PS}${TESTSRC}${FS}barprovider.jar"
- ;;
-esac
-
-
-EXTRA_OPTS="--add-exports java.base/sun.util.locale.provider=ALL-UNNAMED \
- --add-exports java.base/sun.util.resources=ALL-UNNAMED"
-
-# compile
-cp ${TESTSRC}${FS}ProviderTest.java .
-cp ${TESTSRC}${FS}$2.java .
-COMPILE="${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} ${EXTRA_OPTS} \
- -XDignore.symbol.file -d . -classpath ${CLASSPATHARG} $2.java"
-echo ${COMPILE}
-${COMPILE}
-result=$?
-
-if [ $result -eq 0 ]
-then
- echo "Compilation of the test case was successful."
-else
- echo "Compilation of the test case failed."
- # Cleanup
- rm -f ${TESTCLASSES}${FS}$2*.class
- rm -f ${TESTCLASSES}${FS}fooprovider.jar
- rm -f ${TESTCLASSES}${FS}barprovider.jar
- exit $result
-fi
-
-# security options
-if [ "$3" != "" ]
-then
- SECURITYOPTS="-Djava.security.manager -Djava.security.policy=${TESTSRC}${FS}$3"
-fi
-
-# run
-RUNCMD="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} ${EXTRA_OPTS} ${SECURITYOPTS} -classpath ${CLASSPATHARG} -Djava.locale.providers=JRE,SPI $2 "
-
-echo ${RUNCMD}
-${RUNCMD}
-result=$?
-
-if [ $result -eq 0 ]
-then
- echo "Execution successful"
-else
- echo "Execution of the test case failed."
-fi
-
-# Cleanup
-rm -f ${TESTCLASSES}${FS}$2*.class
-rm -f ${TESTCLASSES}${FS}fooprovider.jar
-rm -f ${TESTCLASSES}${FS}barprovider.jar
-
-exit $result
--- a/test/jdk/java/util/PluggableLocale/GenericTest.java Thu Oct 18 09:19:29 2018 +0200
+++ b/test/jdk/java/util/PluggableLocale/GenericTest.java Thu Oct 18 00:56:38 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2018, 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
@@ -20,30 +20,58 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
/*
- *
+ * @test
+ * @bug 4052440 8062588 8210406
+ * @summary Generic tests for the pluggable locales feature
+ * @library providersrc/foobarutils
+ * providersrc/barprovider
+ * providersrc/fooprovider
+ * @modules java.base/sun.util.locale.provider
+ * @build com.foobar.Utils
+ * com.bar.*
+ * com.foo.*
+ * @run main/othervm -Djava.locale.providers=JRE,SPI GenericTest
*/
-import java.text.*;
-import java.util.*;
-import sun.util.locale.provider.*;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Locale;
+import java.util.Set;
+
+import com.bar.CalendarDataProviderImpl;
+import com.bar.CalendarNameProviderImpl;
+import com.bar.CurrencyNameProviderImpl;
+import com.bar.CurrencyNameProviderImpl2;
+import com.bar.GenericTimeZoneNameProviderImpl;
+import com.bar.LocaleNameProviderImpl;
+import com.bar.TimeZoneNameProviderImpl;
+import com.foo.BreakIteratorProviderImpl;
+import com.foo.CollatorProviderImpl;
+import com.foo.DateFormatProviderImpl;
+import com.foo.DateFormatSymbolsProviderImpl;
+import com.foo.DecimalFormatSymbolsProviderImpl;
+import com.foo.NumberFormatProviderImpl;
+
+import sun.util.locale.provider.LocaleProviderAdapter;
public class GenericTest {
// test providers
- com.foo.BreakIteratorProviderImpl breakIP = new com.foo.BreakIteratorProviderImpl();
- com.foo.CollatorProviderImpl collatorP = new com.foo.CollatorProviderImpl();
- com.foo.DateFormatProviderImpl dateFP = new com.foo.DateFormatProviderImpl();
- com.foo.DateFormatSymbolsProviderImpl dateFSP = new com.foo.DateFormatSymbolsProviderImpl();
- com.foo.DecimalFormatSymbolsProviderImpl decimalFSP = new com.foo.DecimalFormatSymbolsProviderImpl();
- com.foo.NumberFormatProviderImpl numberFP = new com.foo.NumberFormatProviderImpl();
- com.bar.CurrencyNameProviderImpl currencyNP = new com.bar.CurrencyNameProviderImpl();
- com.bar.CurrencyNameProviderImpl2 currencyNP2 = new com.bar.CurrencyNameProviderImpl2();
- com.bar.LocaleNameProviderImpl localeNP = new com.bar.LocaleNameProviderImpl();
- com.bar.TimeZoneNameProviderImpl tzNP = new com.bar.TimeZoneNameProviderImpl();
- com.bar.GenericTimeZoneNameProviderImpl tzGenNP = new com.bar.GenericTimeZoneNameProviderImpl();
- com.bar.CalendarDataProviderImpl calDataP = new com.bar.CalendarDataProviderImpl();
- com.bar.CalendarNameProviderImpl calNameP = new com.bar.CalendarNameProviderImpl();
+ BreakIteratorProviderImpl breakIP = new BreakIteratorProviderImpl();
+ CollatorProviderImpl collatorP = new CollatorProviderImpl();
+ DateFormatProviderImpl dateFP = new DateFormatProviderImpl();
+ DateFormatSymbolsProviderImpl dateFSP = new DateFormatSymbolsProviderImpl();
+ DecimalFormatSymbolsProviderImpl decimalFSP = new DecimalFormatSymbolsProviderImpl();
+ NumberFormatProviderImpl numberFP = new NumberFormatProviderImpl();
+ CurrencyNameProviderImpl currencyNP = new CurrencyNameProviderImpl();
+ CurrencyNameProviderImpl2 currencyNP2 = new CurrencyNameProviderImpl2();
+ LocaleNameProviderImpl localeNP = new LocaleNameProviderImpl();
+ TimeZoneNameProviderImpl tzNP = new TimeZoneNameProviderImpl();
+ GenericTimeZoneNameProviderImpl tzGenNP = new GenericTimeZoneNameProviderImpl();
+ CalendarDataProviderImpl calDataP = new CalendarDataProviderImpl();
+ CalendarNameProviderImpl calNameP = new CalendarNameProviderImpl();
public static void main(String[] s) {
new GenericTest();
@@ -108,4 +136,4 @@
s2.addAll(s1);
return s2.toString();
}
-}
+}
\ No newline at end of file
--- a/test/jdk/java/util/PluggableLocale/GenericTest.sh Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2007, 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.
-#
-# 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.
-#
-#
-# @test
-# @bug 4052440 8062588
-# @summary Generic tests for the pluggable locales feature
-# @run shell ExecTest.sh foobar GenericTest
--- a/test/jdk/java/util/PluggableLocale/LocaleNameProviderTest.java Thu Oct 18 09:19:29 2018 +0200
+++ b/test/jdk/java/util/PluggableLocale/LocaleNameProviderTest.java Thu Oct 18 00:56:38 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2018, 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
@@ -20,14 +20,30 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
/*
- *
+ * @test
+ * @bug 4052440 8000273 8062588 8210406
+ * @summary LocaleNameProvider tests
+ * @library providersrc/foobarutils
+ * providersrc/barprovider
+ * @modules java.base/sun.util.locale.provider
+ * java.base/sun.util.resources
+ * @build com.foobar.Utils
+ * com.bar.*
+ * @run main/othervm -Djava.locale.providers=JRE,SPI LocaleNameProviderTest
*/
-import java.text.*;
-import java.util.*;
-import sun.util.locale.provider.*;
-import sun.util.resources.*;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Locale;
+import java.util.MissingResourceException;
+
+import com.bar.LocaleNameProviderImpl;
+
+import sun.util.locale.provider.LocaleProviderAdapter;
+import sun.util.locale.provider.ResourceBundleBasedAdapter;
+import sun.util.resources.OpenListResourceBundle;
public class LocaleNameProviderTest extends ProviderTest {
@@ -41,7 +57,7 @@
}
void checkAvailLocValidityTest() {
- com.bar.LocaleNameProviderImpl lnp = new com.bar.LocaleNameProviderImpl();
+ LocaleNameProviderImpl lnp = new LocaleNameProviderImpl();
Locale[] availloc = Locale.getAvailableLocales();
Locale[] testloc = availloc.clone();
List<Locale> jreimplloc = Arrays.asList(LocaleProviderAdapter.forJRE().getLocaleNameProvider().getAvailableLocales());
@@ -121,10 +137,10 @@
if (YY_suffix.getVariant().equals(retVrnt)) {
System.out.println(message);
return;
-}
+ }
message = "variantFallbackTest() failed. Returned variant: "+retVrnt;
}
throw new RuntimeException(message);
}
-}
+}
\ No newline at end of file
--- a/test/jdk/java/util/PluggableLocale/LocaleNameProviderTest.sh Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2007, 2012, 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.
-#
-# 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.
-#
-#
-# @test
-# @bug 4052440 8000273 8062588
-# @summary LocaleNameProvider tests
-# @run shell ExecTest.sh bar LocaleNameProviderTest
--- a/test/jdk/java/util/PluggableLocale/NumberFormatProviderTest.java Thu Oct 18 09:19:29 2018 +0200
+++ b/test/jdk/java/util/PluggableLocale/NumberFormatProviderTest.java Thu Oct 18 00:56:38 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2018, 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
@@ -20,20 +20,38 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
/*
- *
+ * @test
+ * @bug 4052440 7003643 8062588 8210406
+ * @summary NumberFormatProvider tests
+ * @library providersrc/foobarutils
+ * providersrc/fooprovider
+ * @modules java.base/sun.util.locale.provider
+ * @build com.foobar.Utils
+ * com.foo.*
+ * @run main/othervm -Djava.locale.providers=JRE,SPI NumberFormatProviderTest
*/
-import java.text.*;
-import java.util.*;
-import sun.util.locale.provider.*;
-import sun.util.resources.*;
+import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
+import java.text.MessageFormat;
+import java.text.NumberFormat;
+import java.util.Arrays;
+import java.util.Currency;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Locale;
+import java.util.Set;
import com.foo.FooNumberFormat;
+import com.foo.NumberFormatProviderImpl;
+
+import sun.util.locale.provider.LocaleProviderAdapter;
public class NumberFormatProviderTest extends ProviderTest {
- com.foo.NumberFormatProviderImpl nfp = new com.foo.NumberFormatProviderImpl();
+ NumberFormatProviderImpl nfp = new NumberFormatProviderImpl();
List<Locale> availloc = Arrays.asList(NumberFormat.getAvailableLocales());
List<Locale> providerloc = Arrays.asList(nfp.getAvailableLocales());
List<Locale> jreloc = Arrays.asList(LocaleProviderAdapter.forJRE().getAvailableLocales());
@@ -201,4 +219,4 @@
}
}
}
-}
+}
\ No newline at end of file
--- a/test/jdk/java/util/PluggableLocale/NumberFormatProviderTest.sh Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2007, 2010, 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.
-#
-# 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.
-#
-#
-# @test
-# @bug 4052440 7003643 8062588
-# @summary NumberFormatProvider tests
-# @run shell ExecTest.sh foo NumberFormatProviderTest
--- a/test/jdk/java/util/PluggableLocale/PermissionTest.java Thu Oct 18 09:19:29 2018 +0200
+++ b/test/jdk/java/util/PluggableLocale/PermissionTest.java Thu Oct 18 00:56:38 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -20,25 +20,59 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
/*
- *
+ * @test
+ * @bug 8075545 8210406
+ * @summary Check whether RuntimePermission("localeServiceProvider") is
+ * handled correctly.
+ * @library providersrc/foobarutils
+ * providersrc/barprovider
+ * providersrc/fooprovider
+ * @build com.foobar.Utils
+ * com.bar.*
+ * com.foo.*
+ * @run main/othervm PermissionTest
+ * @run main/othervm/fail/java.security.policy=dummy.policy
+ * -Djava.security.manager
+ * -Djava.locale.providers=JRE,SPI
+ * PermissionTest
+ * @run main/othervm/java.security.policy=localeServiceProvider.policy
+ * -Djava.security.manager
+ * -Djava.locale.providers=JRE,SPI
+ * PermissionTest
*/
+
+import com.bar.CalendarDataProviderImpl;
+import com.bar.CalendarNameProviderImpl;
+import com.bar.CurrencyNameProviderImpl;
+import com.bar.CurrencyNameProviderImpl2;
+import com.bar.GenericTimeZoneNameProviderImpl;
+import com.bar.LocaleNameProviderImpl;
+import com.bar.TimeZoneNameProviderImpl;
+import com.foo.BreakIteratorProviderImpl;
+import com.foo.CollatorProviderImpl;
+import com.foo.DateFormatProviderImpl;
+import com.foo.DateFormatSymbolsProviderImpl;
+import com.foo.DecimalFormatSymbolsProviderImpl;
+import com.foo.NumberFormatProviderImpl;
+
public class PermissionTest{
// Make sure provider impls can be instantiated under a security manager.ZZ
- com.foo.BreakIteratorProviderImpl breakIP = new com.foo.BreakIteratorProviderImpl();
- com.foo.CollatorProviderImpl collatorP = new com.foo.CollatorProviderImpl();
- com.foo.DateFormatProviderImpl dateFP = new com.foo.DateFormatProviderImpl();
- com.foo.DateFormatSymbolsProviderImpl dateFSP = new com.foo.DateFormatSymbolsProviderImpl();
- com.foo.DecimalFormatSymbolsProviderImpl decimalFSP = new com.foo.DecimalFormatSymbolsProviderImpl();
- com.foo.NumberFormatProviderImpl numberFP = new com.foo.NumberFormatProviderImpl();
- com.bar.CurrencyNameProviderImpl currencyNP = new com.bar.CurrencyNameProviderImpl();
- com.bar.CurrencyNameProviderImpl2 currencyNP2 = new com.bar.CurrencyNameProviderImpl2();
- com.bar.LocaleNameProviderImpl localeNP = new com.bar.LocaleNameProviderImpl();
- com.bar.TimeZoneNameProviderImpl tzNP = new com.bar.TimeZoneNameProviderImpl();
- com.bar.GenericTimeZoneNameProviderImpl tzGenNP = new com.bar.GenericTimeZoneNameProviderImpl();
- com.bar.CalendarDataProviderImpl calDataP = new com.bar.CalendarDataProviderImpl();
- com.bar.CalendarNameProviderImpl calNameP = new com.bar.CalendarNameProviderImpl();
+ BreakIteratorProviderImpl breakIP = new BreakIteratorProviderImpl();
+ CollatorProviderImpl collatorP = new CollatorProviderImpl();
+ DateFormatProviderImpl dateFP = new DateFormatProviderImpl();
+ DateFormatSymbolsProviderImpl dateFSP = new DateFormatSymbolsProviderImpl();
+ DecimalFormatSymbolsProviderImpl decimalFSP = new DecimalFormatSymbolsProviderImpl();
+ NumberFormatProviderImpl numberFP = new NumberFormatProviderImpl();
+ CurrencyNameProviderImpl currencyNP = new CurrencyNameProviderImpl();
+ CurrencyNameProviderImpl2 currencyNP2 = new CurrencyNameProviderImpl2();
+ LocaleNameProviderImpl localeNP = new LocaleNameProviderImpl();
+ TimeZoneNameProviderImpl tzNP = new TimeZoneNameProviderImpl();
+ GenericTimeZoneNameProviderImpl tzGenNP = new GenericTimeZoneNameProviderImpl();
+ CalendarDataProviderImpl calDataP = new CalendarDataProviderImpl();
+ CalendarNameProviderImpl calNameP = new CalendarNameProviderImpl();
public static void main(String[] s) {
new PermissionTest();
--- a/test/jdk/java/util/PluggableLocale/PermissionTest.sh Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2015, 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.
-#
-# 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.
-#
-#
-# @test
-# @bug 8075545
-# @summary Check whether RuntimePermission("localeServiceProvider") is
-# handled correctly
-# @run shell ExecTest.sh foobar PermissionTest
-# @run shell/fail ExecTest.sh foobar PermissionTest dummy
-# @run shell ExecTest.sh foobar PermissionTest localeServiceProvider.policy
--- a/test/jdk/java/util/PluggableLocale/TimeZoneNameProviderTest.java Thu Oct 18 09:19:29 2018 +0200
+++ b/test/jdk/java/util/PluggableLocale/TimeZoneNameProviderTest.java Thu Oct 18 00:56:38 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2018, 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
@@ -20,19 +20,41 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
/*
- *
+ * @test
+ * @bug 4052440 8003267 8062588 8210406
+ * @summary TimeZoneNameProvider tests
+ * @library providersrc/foobarutils
+ * providersrc/barprovider
+ * @modules java.base/sun.util.locale.provider
+ * java.base/sun.util.resources
+ * @build com.foobar.Utils
+ * com.bar.*
+ * @run main/othervm -Djava.locale.providers=JRE,SPI TimeZoneNameProviderTest
*/
-import java.text.*;
+import java.text.DateFormatSymbols;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
import java.time.format.TextStyle;
-import java.util.*;
-import sun.util.locale.provider.*;
-import sun.util.resources.*;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.TimeZone;
+
+import com.bar.TimeZoneNameProviderImpl;
+
+import sun.util.locale.provider.LocaleProviderAdapter;
+import sun.util.locale.provider.ResourceBundleBasedAdapter;
+import sun.util.resources.OpenListResourceBundle;
public class TimeZoneNameProviderTest extends ProviderTest {
- com.bar.TimeZoneNameProviderImpl tznp = new com.bar.TimeZoneNameProviderImpl();
+ TimeZoneNameProviderImpl tznp = new TimeZoneNameProviderImpl();
public static void main(String[] s) {
new TimeZoneNameProviderTest();
@@ -248,4 +270,4 @@
throw new RuntimeException("Generic name fallback failed. got: "+generic);
}
}
-}
+}
\ No newline at end of file
--- a/test/jdk/java/util/PluggableLocale/TimeZoneNameProviderTest.sh Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2007, 2012, 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.
-#
-# 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.
-#
-#
-# @test
-# @bug 4052440 8003267 8062588
-# @summary TimeZoneNameProvider tests
-# @run shell ExecTest.sh bar TimeZoneNameProviderTest
Binary file test/jdk/java/util/PluggableLocale/barprovider.jar has changed
Binary file test/jdk/java/util/PluggableLocale/fooprovider.jar has changed
--- a/test/jdk/java/util/PluggableLocale/providersrc/BreakIteratorProviderImpl.java Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,140 +0,0 @@
-/*
- * Copyright (c) 2007, 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.
- *
- * 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.
- */
-/*
- *
- */
-
-package com.foo;
-
-import java.text.*;
-import java.text.spi.*;
-import java.util.*;
-import com.foobar.Utils;
-
-public class BreakIteratorProviderImpl extends BreakIteratorProvider {
-
- static Locale[] avail = {
- Locale.JAPAN,
- new Locale("ja", "JP", "osaka"),
- new Locale("ja", "JP", "kyoto"),
- new Locale("xx", "YY")};
-
- static String[] dialect = {
- "\u3067\u3059\u3002",
- "\u3084\u3002",
- "\u3069\u3059\u3002",
- "-xx-YY"
- };
-
- static enum Type {CHARACTER, LINE, SENTENCE, WORD};
-
- public Locale[] getAvailableLocales() {
- return avail;
- }
-
- public BreakIterator getCharacterInstance(Locale locale) {
- for (int i = 0; i < avail.length; i ++) {
- if (Utils.supportsLocale(avail[i], locale)) {
- return new FooBreakIterator(Type.CHARACTER, i);
- }
- }
- throw new IllegalArgumentException("locale is not supported: "+locale);
- }
-
- public BreakIterator getLineInstance(Locale locale) {
- for (int i = 0; i < avail.length; i ++) {
- if (Utils.supportsLocale(avail[i], locale)) {
- return new FooBreakIterator(Type.LINE, i);
- }
- }
- throw new IllegalArgumentException("locale is not supported: "+locale);
- }
-
- public BreakIterator getSentenceInstance(Locale locale) {
- for (int i = 0; i < avail.length; i ++) {
- if (Utils.supportsLocale(avail[i], locale)) {
- return new FooBreakIterator(Type.SENTENCE, i);
- }
- }
- throw new IllegalArgumentException("locale is not supported: "+locale);
- }
-
- public BreakIterator getWordInstance(Locale locale) {
- for (int i = 0; i < avail.length; i ++) {
- if (Utils.supportsLocale(avail[i], locale)) {
- return new FooBreakIterator(Type.WORD, i);
- }
- }
- throw new IllegalArgumentException("locale is not supported: "+locale);
- }
-
- // dummy implementation
- class FooBreakIterator extends BreakIterator {
- public FooBreakIterator(Type t, int index) {
- super();
- }
-
- public int current() {
- return 0;
- }
-
- public int first() {
- return 0;
- }
-
- public int following(int offset) {
- return 0;
- }
-
- public CharacterIterator getText() {
- return null;
- }
-
- public boolean isBoundary(int offset) {
- return true;
- }
-
- public int last() {
- return 0;
- }
-
- public int next() {
- return 0;
- }
-
- public int next(int n) {
- return 0;
- }
-
- public int preceding(int offset) {
- return 0;
- }
-
- public int previous() {
- return 0;
- }
-
- public void setText(CharacterIterator ci) {
- }
- }
-}
--- a/test/jdk/java/util/PluggableLocale/providersrc/CalendarDataProviderImpl.java Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- *
- * 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.
- */
-
-package com.bar;
-
-import com.foobar.Utils;
-import java.util.Arrays;
-import static java.util.Calendar.*;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-import java.util.spi.CalendarDataProvider;
-
-public class CalendarDataProviderImpl extends CalendarDataProvider {
- static final char FULLWIDTH_ZERO = '\uff10';
- static final Locale[] avail = {
- new Locale("ja", "JP", "kids"),
- };
-
- @Override
- public int getFirstDayOfWeek(Locale locale) {
- return WEDNESDAY;
- }
-
- @Override
- public int getMinimalDaysInFirstWeek(Locale locale) {
- return 7;
- }
-
- @Override
- public Locale[] getAvailableLocales() {
- return avail.clone();
- }
-}
--- a/test/jdk/java/util/PluggableLocale/providersrc/CalendarNameProviderImpl.java Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- *
- * 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.
- */
-
-package com.bar;
-
-import com.foobar.Utils;
-import java.util.Arrays;
-import static java.util.Calendar.*;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-import java.util.spi.CalendarNameProvider;
-
-public class CalendarNameProviderImpl extends CalendarNameProvider {
- static final char FULLWIDTH_ZERO = '\uff10';
- static final Locale[] avail = {
- new Locale("ja", "JP", "kids"),
- };
-
- @Override
- public String getDisplayName(String calendarType, int field, int value, int style, Locale locale) {
- if (calendarType == null || locale == null) {
- throw new NullPointerException();
- }
- if (!Utils.supportsLocale(Arrays.asList(avail), locale)) {
- throw new IllegalArgumentException("locale is not one of available locales: "+ locale);
- }
- if (field != MONTH) {
- return null;
- }
- return toMonthName(value + 1, style);
- }
-
- @Override
- public Map<String, Integer> getDisplayNames(String calendarType, int field, int style, Locale locale) {
- if (calendarType == null || locale == null) {
- throw new NullPointerException();
- }
- if (!Utils.supportsLocale(Arrays.asList(avail), locale)) {
- throw new IllegalArgumentException("locale is not one of available locales: " + locale);
- }
- if (field != MONTH) {
- return null;
- }
- Map<String, Integer> map = new HashMap<>();
- if (style == LONG_STANDALONE) {
- style = LONG;
- } else if (style == SHORT_STANDALONE) {
- style = SHORT;
- }
- for (int month = JANUARY; month <= DECEMBER; month++) {
- if (style == ALL_STYLES || style == LONG) {
- map.put(toMonthName(month + 1, LONG), month);
- }
- if (style == ALL_STYLES || style == SHORT) {
- map.put(toMonthName(month + 1, SHORT), month);
- }
- }
- return map;
- }
-
- @Override
- public Locale[] getAvailableLocales() {
- return avail.clone();
- }
-
- // month is 1-based.
- public static String toMonthName(int month, int style) {
- StringBuilder sb = new StringBuilder();
- if (month >= 10) {
- sb.append((char)(FULLWIDTH_ZERO + 1));
- sb.appendCodePoint((char)(FULLWIDTH_ZERO + (month % 10)));
- } else {
- sb.appendCodePoint((char)(FULLWIDTH_ZERO + month));
- }
- if (style == SHORT || style == SHORT_STANDALONE) {
- return sb.toString(); // full-width digit(s)
- }
- sb.append("\u304c\u3064"); // + "gatsu" in Hiragana
- return sb.toString();
- }
-}
--- a/test/jdk/java/util/PluggableLocale/providersrc/CollatorProviderImpl.java Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2007, 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.
- *
- * 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.
- */
-/*
- *
- */
-
-package com.foo;
-
-import java.text.*;
-import java.text.spi.*;
-import java.util.*;
-
-import com.foobar.Utils;
-
-public class CollatorProviderImpl extends CollatorProvider {
-
- static Locale[] avail = {
- Locale.JAPAN,
- new Locale("ja", "JP", "osaka"),
- new Locale("ja", "JP", "kyoto"),
- new Locale("xx", "YY", "ZZZZ")};
-
- static String[] dialect = {
- "\u3067\u3059\u3002",
- "\u3084\u3002",
- "\u3069\u3059\u3002",
- "-xx-YY-ZZZZ"
- };
-
- public Locale[] getAvailableLocales() {
- return avail;
- }
-
- public Collator getInstance(Locale locale) {
- for (int i = 0; i < avail.length; i ++) {
- if (Utils.supportsLocale(avail[i], locale)) {
- RuleBasedCollator ja = (RuleBasedCollator)Collator.getInstance(Locale.JAPANESE);
- try {
- return new RuleBasedCollator(ja.getRules()+"& Z < "+dialect[i]);
- } catch (ParseException pe) {
-System.err.println(pe+ja.getRules()+"& Z < "+dialect[i]);
- return ja;
- }
- }
- }
- throw new IllegalArgumentException("locale is not supported: "+locale);
- }
-}
--- a/test/jdk/java/util/PluggableLocale/providersrc/CurrencyNameProviderImpl.java Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2007, 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.
- *
- * 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.
- */
-/*
- *
- */
-
-package com.bar;
-
-import java.util.*;
-import java.util.spi.*;
-
-import com.foobar.Utils;
-
-public class CurrencyNameProviderImpl extends CurrencyNameProvider {
- static Locale[] avail = {new Locale("ja", "JP", "osaka"),
- new Locale("ja", "JP", "kyoto"),
- Locale.JAPAN,
- new Locale("xx")};
-
- public Locale[] getAvailableLocales() {
- return avail;
- }
-
- 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 "\u5186\u3084\u3002";
- } else if (Utils.supportsLocale(avail[1], locale)) {
- return "\u5186\u3069\u3059\u3002";
- } else if (Utils.supportsLocale(avail[2], locale)) {
- return "\u5186\u3067\u3059\u3002";
- } else if (Utils.supportsLocale(avail[3], locale)) {
- return "\u5186\u3070\u3064\u3070\u3064\u3002";
- }
- }
- 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 "\u65e5\u672c\u5186\u3084\u3002";
- } else if (Utils.supportsLocale(avail[1], locale)) {
- return "\u65e5\u672c\u5186\u3069\u3059\u3002";
- } else if (Utils.supportsLocale(avail[2], locale)) {
- return "\u65e5\u672c\u5186\u3067\u3059\u3002";
- } else if (Utils.supportsLocale(avail[3], locale)) {
- return "\u65e5\u672c\u5186\u3070\u3064\u3070\u3064\u3002";
- }
- }
- return null;
- }
-}
--- a/test/jdk/java/util/PluggableLocale/providersrc/CurrencyNameProviderImpl2.java Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- *
- * 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.
- */
-/*
- *
- */
-
-package com.bar;
-
-import java.util.*;
-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
- 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;
- }
-}
--- a/test/jdk/java/util/PluggableLocale/providersrc/DateFormatProviderImpl.java Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 2007, 2010, 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.
- *
- * 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.
- */
-/*
- *
- */
-
-package com.foo;
-
-import java.text.*;
-import java.text.spi.*;
-import java.util.*;
-
-import com.foobar.Utils;
-
-public class DateFormatProviderImpl extends DateFormatProvider {
-
- static Locale[] avail = {
- Locale.JAPAN,
- new Locale("ja", "JP", "osaka"),
- new Locale("ja", "JP", "kyoto"),
- new Locale("yy")};
-
- static String[] datePattern = {
- "yyyy'\u5e74'M'\u6708'd'\u65e5'", // full date pattern
- "yyyy/MMM/dd", // long date pattern
- "yyyy/MM/dd", // medium date pattern
- "yy/MM/dd" // short date pattern
- };
-
- static String[] timePattern = {
- "H'\u6642'mm'\u5206'ss'\u79d2' z", // full time pattern
- "H:mm:ss z", // long time pattern
- "H:mm:ss", // medium time pattern
- "H:mm" // short time pattern
- };
-
- static String[] dialect = {
- "\u3067\u3059\u3002",
- "\u3084\u3002",
- "\u3069\u3059\u3002",
- "\u308f\u3044\u308f\u3044"
- };
-
- public Locale[] getAvailableLocales() {
- return avail;
- }
-
- public DateFormat getDateInstance(int style, Locale locale) {
- for (int i = 0; i < avail.length; i ++) {
- if (Utils.supportsLocale(avail[i], locale)) {
- return new FooDateFormat(datePattern[style]+dialect[i], locale);
- }
- }
- throw new IllegalArgumentException("locale is not supported: "+locale);
- }
-
- public DateFormat getTimeInstance(int style, Locale locale) {
- for (int i = 0; i < avail.length; i ++) {
- if (Utils.supportsLocale(avail[i], locale)) {
- return new FooDateFormat(timePattern[style]+dialect[i], locale);
- }
- }
- throw new IllegalArgumentException("locale is not supported: "+locale);
- }
-
- public DateFormat getDateTimeInstance(int dateStyle, int timeStyle, Locale locale) {
- for (int i = 0; i < avail.length; i ++) {
- if (Utils.supportsLocale(avail[i], locale)) {
- return new FooDateFormat(
- datePattern[dateStyle]+" "+timePattern[timeStyle]+dialect[i], locale);
- }
- }
- throw new IllegalArgumentException("locale is not supported: "+locale);
- }
-}
--- a/test/jdk/java/util/PluggableLocale/providersrc/DateFormatSymbolsProviderImpl.java Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,230 +0,0 @@
-/*
- * Copyright (c) 2007, 2012, 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.
- *
- * 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.
- */
-/*
- *
- */
-
-package com.foo;
-
-import java.text.*;
-import java.text.spi.*;
-import java.util.*;
-
-import com.foobar.Utils;
-
-public class DateFormatSymbolsProviderImpl extends DateFormatSymbolsProvider {
-
- static Locale[] avail = {
- new Locale("ja", "JP", "osaka"),
- new Locale("ja", "JP", "kyoto"),
- Locale.JAPAN,
- new Locale("yy", "ZZ")
- };
- static List<Locale> availList = Arrays.asList(avail);
-
- static String[] dialect = {
- "\u3084\u3002",
- "\u3069\u3059\u3002",
- "\u3067\u3059\u3002",
- "-yy-ZZ"
- };
-
- static Map<Locale, FooDateFormatSymbols> symbols = new HashMap<Locale, FooDateFormatSymbols>(4);
-
- public Locale[] getAvailableLocales() {
- return avail;
- }
-
- public DateFormatSymbols getInstance(Locale locale) {
- if (!Utils.supportsLocale(availList, locale)) {
- throw new IllegalArgumentException("locale is not supported: "+locale);
- }
-
- FooDateFormatSymbols fdfs = symbols.get(locale);
- if (fdfs == null) {
- for (int index = 0; index < avail.length; index ++) {
- if (Utils.supportsLocale(avail[index], locale)) {
- fdfs = new FooDateFormatSymbols(index);
- symbols.put(locale, fdfs);
- break;
- }
- }
- }
- return fdfs;
- }
-
- class FooDateFormatSymbols extends DateFormatSymbols {
- String dialect = "";
-
- String[] eras = null;
- String[] months = null;
- String[] shortMonths = null;
- String[] weekdays = null;
- String[] shortWeekdays = null;
- String[] ampms = null;
-
- public FooDateFormatSymbols(int index) {
- super(DateFormatSymbolsProviderImpl.this.avail[index]);
- dialect = DateFormatSymbolsProviderImpl.this.dialect[index];
- }
-
- public String[] getEras() {
- if (eras == null) {
- eras = super.getEras();
- for (int i = 0; i < eras.length; i++) {
- eras[i] = eras[i]+dialect;
- }
- }
- return eras;
- }
-
- /**
- * Sets era strings. For example: "AD" and "BC".
- * @param newEras the new era strings.
- */
- public void setEras(String[] newEras) {
- eras = newEras;
- }
-
- /**
- * Gets month strings. For example: "January", "February", etc.
- * @return the month strings.
- */
- public String[] getMonths() {
- if (months == null) {
- months = super.getMonths();
- for (int i = 0; i < months.length; i++) {
- months[i] = months[i]+dialect;
- }
- }
- return months;
- }
-
- /**
- * Sets month strings. For example: "January", "February", etc.
- * @param newMonths the new month strings.
- */
- public void setMonths(String[] newMonths) {
- months = newMonths;
- }
-
- /**
- * Gets short month strings. For example: "Jan", "Feb", etc.
- * @return the short month strings.
- */
- public String[] getShortMonths() {
- if (shortMonths == null) {
- shortMonths = super.getShortMonths();
- for (int i = 0; i < shortMonths.length; i++) {
- shortMonths[i] = shortMonths[i]+dialect;
- }
- }
- return shortMonths;
- }
-
- /**
- * Sets short month strings. For example: "Jan", "Feb", etc.
- * @param newShortMonths the new short month strings.
- */
- public void setShortMonths(String[] newShortMonths) {
- shortMonths = newShortMonths;
- }
-
- /**
- * Gets weekday strings. For example: "Sunday", "Monday", etc.
- * @return the weekday strings. Use <code>Calendar.SUNDAY</code>,
- * <code>Calendar.MONDAY</code>, etc. to index the result array.
- */
- public String[] getWeekdays() {
- if (weekdays == null) {
- weekdays = super.getWeekdays();
- for (int i = 0; i < weekdays.length; i++) {
- weekdays[i] = weekdays[i]+dialect;
- }
- }
- return weekdays;
- }
-
- /**
- * Sets weekday strings. For example: "Sunday", "Monday", etc.
- * @param newWeekdays the new weekday strings. The array should
- * be indexed by <code>Calendar.SUNDAY</code>,
- * <code>Calendar.MONDAY</code>, etc.
- */
- public void setWeekdays(String[] newWeekdays) {
- weekdays = newWeekdays;
- }
-
- /**
- * Gets short weekday strings. For example: "Sun", "Mon", etc.
- * @return the short weekday strings. Use <code>Calendar.SUNDAY</code>,
- * <code>Calendar.MONDAY</code>, etc. to index the result array.
- */
- public String[] getShortWeekdays() {
- if (shortWeekdays == null) {
- shortWeekdays = super.getShortWeekdays();
- for (int i = 0; i < shortWeekdays.length; i++) {
- shortWeekdays[i] = shortWeekdays[i]+dialect;
- }
- }
- return shortWeekdays;
- }
-
- /**
- * Sets short weekday strings. For example: "Sun", "Mon", etc.
- * @param newShortWeekdays the new short weekday strings. The array should
- * be indexed by <code>Calendar.SUNDAY</code>,
- * <code>Calendar.MONDAY</code>, etc.
- */
- public void setShortWeekdays(String[] newShortWeekdays) {
- shortWeekdays = newShortWeekdays;
- }
-
- /**
- * Gets ampm strings. For example: "AM" and "PM".
- * @return the ampm strings.
- */
- public String[] getAmPmStrings() {
- if (ampms == null) {
- ampms = super.getAmPmStrings();
- for (int i = 0; i < ampms.length; i++) {
- ampms[i] = ampms[i]+dialect;
- }
- }
- return ampms;
- }
-
- /**
- * Sets ampm strings. For example: "AM" and "PM".
- * @param newAmpms the new ampm strings.
- */
- public void setAmPmStrings(String[] newAmpms) {
- ampms = newAmpms;
- }
-
- @Override
- public String[][] getZoneStrings() {
- return new String[0][0];
- }
- }
-}
--- a/test/jdk/java/util/PluggableLocale/providersrc/DecimalFormatSymbolsProviderImpl.java Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,110 +0,0 @@
-/*
- * Copyright (c) 2007, 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.
- *
- * 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.
- */
-/*
- *
- */
-
-package com.foo;
-
-import java.text.*;
-import java.text.spi.*;
-import java.util.*;
-
-import com.foobar.Utils;
-
-public class DecimalFormatSymbolsProviderImpl extends DecimalFormatSymbolsProvider {
-
- static Locale[] avail = {
- new Locale("ja", "JP", "osaka"),
- new Locale("ja", "JP", "kyoto"),
- Locale.JAPAN,
- new Locale("yy", "ZZ", "UUU")
- };
- static List<Locale> availList = Arrays.asList(avail);
-
- static String[] dialect = {
- "\u3084\u3002",
- "\u3069\u3059\u3002",
- "\u3067\u3059\u3002",
- "-yy-ZZ-UUU"
- };
-
- static HashMap<Locale, FooDecimalFormatSymbols> symbols = new HashMap<Locale, FooDecimalFormatSymbols>(4);
-
- public Locale[] getAvailableLocales() {
- return avail;
- }
-
- public DecimalFormatSymbols getInstance(Locale locale) {
- if (!Utils.supportsLocale(availList, locale)) {
- throw new IllegalArgumentException("locale is not supported: "+locale);
- }
-
- FooDecimalFormatSymbols fdfs = symbols.get(locale);
- if (fdfs == null) {
- for (int index = 0; index < avail.length; index ++) {
- if (Utils.supportsLocale(avail[index], locale)) {
- fdfs = new FooDecimalFormatSymbols(index);
- symbols.put(locale, fdfs);
- break;
- }
- }
- }
- return fdfs;
- }
-
- class FooDecimalFormatSymbols extends DecimalFormatSymbols {
- String dialect = "";
-
- String infinity = null;
- String nan = null;
-
- public FooDecimalFormatSymbols(int index) {
- super(DecimalFormatSymbolsProviderImpl.this.avail[index]);
- dialect = DecimalFormatSymbolsProviderImpl.this.dialect[index];
- }
-
- // overrides methods only returns Strings
- public String getInfinity() {
- if (infinity == null) {
- infinity = super.getInfinity() + dialect;
- }
- return infinity;
- }
-
- public void setInfinity(String infinity) {
- this.infinity = infinity;
- }
-
- public String getNaN() {
- if (nan == null) {
- nan = super.getNaN() + dialect;
- }
- return nan;
- }
-
- public void setNaN(String nan) {
- this.nan = nan;
- }
- }
-}
--- a/test/jdk/java/util/PluggableLocale/providersrc/FooDateFormat.java Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2010, 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.
- *
- * 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.
- */
-
-package com.foo;
-
-import java.text.*;
-import java.util.*;
-
-/**
- * FooDateFormat provides SimpleDateFormat methods required for the SPI testing.
- */
-public class FooDateFormat extends DateFormat {
- private SimpleDateFormat sdf;
-
- public FooDateFormat(String pattern, Locale loc) {
- sdf = new SimpleDateFormat(pattern, loc);
- }
-
- @Override
- public StringBuffer format(Date date,
- StringBuffer toAppendTo,
- FieldPosition fieldPosition) {
- return sdf.format(date, toAppendTo, fieldPosition);
- }
-
- @Override
- public Date parse(String source, ParsePosition pos) {
- return sdf.parse(source, pos);
- }
-
- @Override
- public boolean equals(Object other) {
- return other instanceof FooDateFormat
- && sdf.equals(((FooDateFormat)other).sdf);
- }
-
- @Override
- public int hashCode() {
- return sdf.hashCode();
- }
-}
--- a/test/jdk/java/util/PluggableLocale/providersrc/FooNumberFormat.java Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2010, 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.
- *
- * 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.
- */
-
-package com.foo;
-
-import java.text.*;
-
-/**
- * FooNumberFormat provides DecimalFormat methods required for the SPI testing.
- */
-public class FooNumberFormat extends NumberFormat {
- private DecimalFormat df;
-
- public FooNumberFormat(String pattern, DecimalFormatSymbols dfs) {
- df = new DecimalFormat(pattern, dfs);
- }
-
- @Override
- public StringBuffer format(double number,
- StringBuffer toAppendTo,
- FieldPosition pos) {
- return df.format(number, toAppendTo, pos);
- }
-
- @Override
- public StringBuffer format(long number,
- StringBuffer toAppendTo,
- FieldPosition pos) {
- return df.format(number, toAppendTo, pos);
- }
-
- @Override
- public Number parse(String source, ParsePosition parsePosition) {
- return df.parse(source, parsePosition);
- }
-
- @Override
- public boolean equals(Object other) {
- return other instanceof FooNumberFormat
- && df.equals(((FooNumberFormat)other).df);
- }
-
- @Override
- public int hashCode() {
- return df.hashCode();
- }
-
- // DecimalFormat specific methods required for testing
-
- public String toPattern() {
- return df.toPattern();
- }
-
- public DecimalFormatSymbols getDecimalFormatSymbols() {
- return df.getDecimalFormatSymbols();
- }
-
- public void setDecimalSeparatorAlwaysShown(boolean newValue) {
- df.setDecimalSeparatorAlwaysShown(newValue);
- }
-}
--- a/test/jdk/java/util/PluggableLocale/providersrc/GenericTimeZoneNameProviderImpl.java Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- *
- * 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.
- */
-/*
- *
- */
-
-package com.bar;
-
-import java.util.*;
-import java.util.spi.*;
-
-import com.foobar.Utils;
-
-/**
- * Implementation class for getGenericTimeZoneName which returns "Generic "+<standard name in OSAKA>.
- */
-public class GenericTimeZoneNameProviderImpl extends TimeZoneNameProviderImpl {
- static final Locale jaJPGeneric = new Locale("ja", "JP", "generic");
- static final Locale OSAKA = new Locale("ja", "JP", "osaka");
-
- static Locale[] avail = {
- jaJPGeneric
- };
-
- @Override
- public Locale[] getAvailableLocales() {
- return avail;
- }
-
- @Override
- public String getGenericDisplayName(String id, int style, Locale locale) {
- if (!jaJPGeneric.equals(locale)) {
- return null;
- }
- String std = super.getDisplayName(id, false, style, OSAKA);
- return (std != null) ? "Generic " + std : null;
- }
-}
--- a/test/jdk/java/util/PluggableLocale/providersrc/LocaleNameProviderImpl.java Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +0,0 @@
-/*
- * Copyright (c) 2007, 2012, 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.
- *
- * 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.
- */
-/*
- *
- */
-
-package com.bar;
-
-import java.text.*;
-import java.util.*;
-import java.util.spi.*;
-
-import com.foobar.Utils;
-
-public class LocaleNameProviderImpl extends LocaleNameProvider {
- static Locale[] avail = {Locale.JAPANESE,
- Locale.JAPAN,
- new Locale("ja", "JP", "osaka"),
- new Locale("ja", "JP", "kyoto"),
- new Locale("xx"),
- new Locale("yy", "YY", "YYYY")};
- static List<Locale> availList = Arrays.asList(avail);
- public Locale[] getAvailableLocales() {
- return avail;
- }
-
- @Override
- public String getDisplayLanguage(String lang, Locale target) {
- return getDisplayString(lang, target);
- }
-
- @Override
- public String getDisplayCountry(String ctry, Locale target) {
- return getDisplayString(ctry, target);
- }
-
- @Override
- public String getDisplayVariant(String vrnt, Locale target) {
- return getDisplayString(vrnt, target);
- }
-
- private String getDisplayString(String key, Locale target) {
- if (!Utils.supportsLocale(availList, target)) {
- throw new IllegalArgumentException("locale is not supported: "+target);
- }
-
- String ret = null;
-
- if (target.getLanguage().equals("yy") &&
- target.getCountry().equals("YY")) {
- String vrnt = target.getVariant();
- if (vrnt.startsWith("YYYY")) {
- switch (key) {
- case "yy":
- case "YY":
- ret = "waiwai";
- break;
-
- case "YYYY":
- if (vrnt.equals("YYYY_suffix")) {
- // for LocaleNameProviderTest.variantFallbackTest()
- throw new RuntimeException(vrnt);
- } else {
- ret = "waiwai";
- }
- break;
- }
- }
- } else {
- // resource bundle based (allows fallback)
- try {
- ResourceBundle rb = ResourceBundle.getBundle("com.bar.LocaleNames", target);
- ret = rb.getString(key);
- } catch (MissingResourceException mre) {
- }
- }
-
- return ret;
- }
- }
--- a/test/jdk/java/util/PluggableLocale/providersrc/LocaleNames.properties Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-#
-# Copyright (c) 2007, 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.
-#
-# 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.
-#
-osaka=Osaka
-kyoto=Kyoto
-xx=batsubatsu
--- a/test/jdk/java/util/PluggableLocale/providersrc/LocaleNames_ja.properties Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-#
-# Copyright (c) 2007, 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.
-#
-# 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.
-#
-ja=\u65e5\u672c\u8a9e\u3067\u3059\u3002
-JP=\u65e5\u672c\u3067\u3059\u3002
-#
-# added ones
-#
-osaka=\u5927\u962a\u3067\u3059\u3002
-kyoto=\u4eac\u90fd\u3067\u3059\u3002
-xx=\u3070\u3064\u3070\u3064\u3067\u3059\u3002
--- a/test/jdk/java/util/PluggableLocale/providersrc/LocaleNames_ja_JP_kyoto.properties Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-#
-# Copyright (c) 2007, 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.
-#
-# 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.
-#
-ja=\u65e5\u672c\u8a9e\u3069\u3059\u3002
-JP=\u65e5\u672c\u3069\u3059\u3002
-#
-osaka=\u5927\u962a\u3069\u3059\u3002
-kyoto=\u4eac\u90fd\u3069\u3059\u3002
-xx=\u307a\u3051\u307a\u3051\u3069\u3059\u3002
--- a/test/jdk/java/util/PluggableLocale/providersrc/LocaleNames_ja_JP_osaka.properties Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-#
-# Copyright (c) 2007, 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.
-#
-# 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.
-#
-ja=\u7956\u56fd\u8a9e\u3084\u3002
-JP=\u3084\u307e\u3068\u3084\u3002
-#
-osaka=\u5927\u962a\u3084\u3002
-kyoto=\u4eac\u90fd\u3084\u3002
-xx=\u307a\u3051\u307a\u3051\u3084\u3002
--- a/test/jdk/java/util/PluggableLocale/providersrc/LocaleNames_xx.properties Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-#
-# Copyright (c) 2007, 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.
-#
-# 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.
-#
-xx=batsubatsu
--- a/test/jdk/java/util/PluggableLocale/providersrc/Makefile Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-#
-#
-#
-
-DESTDIR=..
-FOODIR=foo-contents
-BARDIR=bar-contents
-
-all: $(DESTDIR)/fooprovider.jar $(DESTDIR)/barprovider.jar
-
-FOOSERVICES = \
- java.text.spi.BreakIteratorProvider \
- java.text.spi.CollatorProvider \
- java.text.spi.DateFormatProvider \
- java.text.spi.DateFormatSymbolsProvider \
- java.text.spi.DecimalFormatSymbolsProvider \
- java.text.spi.NumberFormatProvider
-
-BARSERVICES = \
- java.util.spi.CurrencyNameProvider \
- java.util.spi.TimeZoneNameProvider \
- java.util.spi.LocaleNameProvider \
- java.util.spi.CalendarDataProvider \
- java.util.spi.CalendarNameProvider
-
-FOOFILES_JAVA = \
- BreakIteratorProviderImpl.java \
- CollatorProviderImpl.java \
- DateFormatProviderImpl.java \
- DateFormatSymbolsProviderImpl.java \
- DecimalFormatSymbolsProviderImpl.java \
- NumberFormatProviderImpl.java \
- FooDateFormat.java \
- FooNumberFormat.java \
- Utils.java
-
-BARFILES_JAVA = \
- CurrencyNameProviderImpl.java \
- CurrencyNameProviderImpl2.java \
- TimeZoneNameProviderImpl.java \
- GenericTimeZoneNameProviderImpl.java \
- LocaleNameProviderImpl.java \
- CalendarDataProviderImpl.java \
- CalendarNameProviderImpl.java \
- Utils.java
-
-BARFILES_PROPERTIES = \
- LocaleNames.properties \
- LocaleNames_ja.properties \
- LocaleNames_ja_JP_osaka.properties \
- LocaleNames_ja_JP_kyoto.properties \
- LocaleNames_xx.properties
-
-$(DESTDIR)/fooprovider.jar: $(FOOSERVICES) $(FOOFILES_JAVA)
- rm -rf $(FOODIR)
- mkdir -p $(FOODIR)
- mkdir -p $(FOODIR)/META-INF
- mkdir -p $(FOODIR)/META-INF/services
- $(BINDIR)/javac -d $(FOODIR) $(FOOFILES_JAVA)
- cp $(FOOSERVICES) $(FOODIR)/META-INF/services
- rm -f $(DESTDIR)/fooprovider.jar
- $(BINDIR)/jar cvf $(DESTDIR)/fooprovider.jar -C $(FOODIR) .
-
-$(DESTDIR)/barprovider.jar: $(BARSERVICES) $(BARFILES_JAVA) $(BARFILES_PROPERTIES)
- rm -rf $(BARDIR)
- mkdir -p $(BARDIR)
- mkdir -p $(BARDIR)/META-INF
- mkdir -p $(BARDIR)/META-INF/services
- $(BINDIR)/javac -d $(BARDIR) $(BARFILES_JAVA)
- cp $(BARSERVICES) $(BARDIR)/META-INF/services
- cp $(BARFILES_PROPERTIES) $(BARDIR)/com/bar
- rm -f $(DESTDIR)/barprovider.jar
- $(BINDIR)/jar cvf $(DESTDIR)/barprovider.jar -C $(BARDIR) .
-
-clean:
- rm -rf $(BARDIR) $(FOODIR)
-
-.PHONY: all clean
--- a/test/jdk/java/util/PluggableLocale/providersrc/NumberFormatProviderImpl.java Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,156 +0,0 @@
-/*
- * Copyright (c) 2007, 2010, 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.
- *
- * 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.
- */
-/*
- *
- */
-
-package com.foo;
-
-import java.text.*;
-import java.text.spi.*;
-import java.util.*;
-
-import com.foobar.Utils;
-
-public class NumberFormatProviderImpl extends NumberFormatProvider {
-
- static Locale[] avail = {
- Locale.JAPAN,
- new Locale("ja", "JP", "osaka"),
- new Locale("ja", "JP", "kyoto"),
- new Locale("zz")};
-
- static String[] dialect = {
- "\u3067\u3059\u3002",
- "\u3084\u3002",
- "\u3069\u3059\u3002",
- "-zz"
- };
-
- static String[] patterns = {
- "#,##0.###{0};-#,##0.###{1}", // decimal pattern
- "#{0};(#){1}", // integer pattern
- "\u00A4#,##0{0};-\u00A4#,##0{1}", // currency pattern
- "#,##0%{0}" // percent pattern
- };
- // Constants used by factory methods to specify a style of format.
- static final int NUMBERSTYLE = 0;
- static final int INTEGERSTYLE = 1;
- static final int CURRENCYSTYLE = 2;
- static final int PERCENTSTYLE = 3;
-
- public Locale[] getAvailableLocales() {
- return avail;
- }
-
- public NumberFormat getCurrencyInstance(Locale locale) {
- for (int i = 0; i < avail.length; i ++) {
- if (Utils.supportsLocale(avail[i], locale)) {
- String pattern =
- MessageFormat.format(patterns[CURRENCYSTYLE],
- dialect[i],
- dialect[i]);
- FooNumberFormat nf = new FooNumberFormat(pattern,
- DecimalFormatSymbols.getInstance(locale));
- adjustForCurrencyDefaultFractionDigits(nf);
- return nf;
- }
- }
- throw new IllegalArgumentException("locale is not supported: "+locale);
- }
-
- public NumberFormat getIntegerInstance(Locale locale) {
- for (int i = 0; i < avail.length; i ++) {
- if (Utils.supportsLocale(avail[i], locale)) {
- String pattern =
- MessageFormat.format(patterns[INTEGERSTYLE],
- dialect[i],
- dialect[i]);
- FooNumberFormat nf = new FooNumberFormat(pattern,
- DecimalFormatSymbols.getInstance(locale));
- nf.setMaximumFractionDigits(0);
- nf.setDecimalSeparatorAlwaysShown(false);
- nf.setParseIntegerOnly(true);
- return nf;
- }
- }
- throw new IllegalArgumentException("locale is not supported: "+locale);
- }
-
- public NumberFormat getNumberInstance(Locale locale) {
- for (int i = 0; i < avail.length; i ++) {
- if (Utils.supportsLocale(avail[i], locale)) {
- String pattern =
- MessageFormat.format(patterns[NUMBERSTYLE],
- dialect[i],
- dialect[i]);
- return new FooNumberFormat(pattern,
- DecimalFormatSymbols.getInstance(locale));
- }
- }
- throw new IllegalArgumentException("locale is not supported: "+locale);
- }
-
- public NumberFormat getPercentInstance(Locale locale) {
- for (int i = 0; i < avail.length; i ++) {
- if (Utils.supportsLocale(avail[i], locale)) {
- String pattern =
- MessageFormat.format(patterns[PERCENTSTYLE],
- dialect[i]);
- return new FooNumberFormat(pattern,
- DecimalFormatSymbols.getInstance(locale));
- }
- }
- throw new IllegalArgumentException("locale is not supported: "+locale);
- }
-
- /**
- * Adjusts the minimum and maximum fraction digits to values that
- * are reasonable for the currency's default fraction digits.
- */
- void adjustForCurrencyDefaultFractionDigits(FooNumberFormat nf) {
- DecimalFormatSymbols dfs = nf.getDecimalFormatSymbols();
- Currency currency = dfs.getCurrency();
- if (currency == null) {
- try {
- currency = Currency.getInstance(dfs.getInternationalCurrencySymbol());
- } catch (IllegalArgumentException e) {
- }
- }
- if (currency != null) {
- int digits = currency.getDefaultFractionDigits();
- if (digits != -1) {
- int oldMinDigits = nf.getMinimumFractionDigits();
- // Common patterns are "#.##", "#.00", "#".
- // Try to adjust all of them in a reasonable way.
- if (oldMinDigits == nf.getMaximumFractionDigits()) {
- nf.setMinimumFractionDigits(digits);
- nf.setMaximumFractionDigits(digits);
- } else {
- nf.setMinimumFractionDigits(Math.min(digits, oldMinDigits));
- nf.setMaximumFractionDigits(digits);
- }
- }
- }
- }
-}
--- a/test/jdk/java/util/PluggableLocale/providersrc/TimeZoneNameProviderImpl.java Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,150 +0,0 @@
-/*
- * Copyright (c) 2007, 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.
- *
- * 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.
- */
-/*
- *
- */
-
-package com.bar;
-
-import java.util.*;
-import java.util.spi.*;
-
-import com.foobar.Utils;
-
-public class TimeZoneNameProviderImpl extends TimeZoneNameProvider {
- static Locale[] avail = {new Locale("ja", "JP", "osaka"),
- new Locale("ja", "JP", "kyoto"),
- new Locale("xx"),
- Locale.JAPAN};
-
- static String[][] zoneOsaka = {
- {"GMT",
- "\u30b0_\u30ea_\u30cb_\u30c3_\u30b8_\u6a19_\u6e96_\u6642_\u3084_\u3002",
- "G_M_T_\u3084_\u3002",
- "\u30b0_\u30ea_\u30cb_\u30c3_\u30b8_\u6a19_\u6e96_\u6642_\u3084_\u3002",
- "G_M_T_\u3084_\u3002"},
- {"JST",
- "\u3084_\u307e_\u3068_\u6a19_\u6e96_\u6642_\u3084_\u3002",
- "J_S_T_\u3084_\u3002",
- "\u3084_\u307e_\u3068_\u6a19_\u6e96_\u6642_\u3084_\u3002",
- "J_S_T_\u3084_\u3002"},
- {"America/Los_Angeles",
- "\u592a_\u5e73_\u6d0b_\u6a19_\u6e96_\u6642_\u3084_\u3002",
- "P_S_T_\u3084_\u3002",
- "\u592a_\u5e73_\u6d0b_\u590f_\u6642_\u9593_\u3084_\u3002",
- "P_D_T_\u3084_\u3002"},
- {"SystemV/PST8",
- "\u592a_\u5e73_\u6d0b_\u6a19_\u6e96_\u6642_\u3084_\u3002",
- "P_S_T_\u3084_\u3002",
- "\u592a_\u5e73_\u6d0b_\u590f_\u6642_\u9593_\u3084_\u3002",
- "P_D_T_\u3084_\u3002"},
- {"SystemV/PST8PDT",
- "\u592a_\u5e73_\u6d0b_\u6a19_\u6e96_\u6642_\u3084_\u3002",
- "P_S_T_\u3084_\u3002",
- "\u592a_\u5e73_\u6d0b_\u590f_\u6642_\u9593_\u3084_\u3002",
- "P_D_T_\u3084_\u3002"},
- {"PST8PDT",
- "\u592a_\u5e73_\u6d0b_\u6a19_\u6e96_\u6642_\u3084_\u3002",
- "P_S_T_\u3084_\u3002",
- "\u592a_\u5e73_\u6d0b_\u590f_\u6642_\u9593_\u3084_\u3002",
- "P_D_T_\u3084_\u3002"},
- };
-
- static String[][] zoneKyoto = {
- {"GMT",
- "\u30b0_\u30ea_\u30cb_\u30c3_\u30b8_\u6a19_\u6e96_\u6642_\u3069_\u3059_\u3002",
- "G_M_T_\u3069_\u3059_\u3002",
- "\u30b0_\u30ea_\u30cb_\u30c3_\u30b8_\u6a19_\u6e96_\u6642_\u3069_\u3059_\u3002",
- "G_M_T_\u3069_\u3059_\u3002"},
- {"America/Los_Angeles",
- "\u592a_\u5e73_\u6d0b_\u6a19_\u6e96_\u6642_\u3069_\u3059_\u3002",
- "P_S_T_\u3069_\u3059_\u3002",
- "\u592a_\u5e73_\u6d0b_\u590f_\u6642_\u9593_\u3069_\u3059_\u3002",
- "P_D_T_\u3069_\u3059_\u3002"},
- {"SystemV/PST8",
- "\u592a_\u5e73_\u6d0b_\u6a19_\u6e96_\u6642_\u3069_\u3059_\u3002",
- "P_S_T_\u3069_\u3059_\u3002",
- "\u592a_\u5e73_\u6d0b_\u590f_\u6642_\u9593_\u3069_\u3059_\u3002",
- "P_D_T_\u3069_\u3059_\u3002"},
- {"SystemV/PST8PDT",
- "\u592a_\u5e73_\u6d0b_\u6a19_\u6e96_\u6642_\u3069_\u3059_\u3002",
- "P_S_T_\u3069_\u3059_\u3002",
- "\u592a_\u5e73_\u6d0b_\u590f_\u6642_\u9593_\u3069_\u3059_\u3002",
- "P_D_T_\u3069_\u3059_\u3002"},
- {"PST8PDT",
- "\u592a_\u5e73_\u6d0b_\u6a19_\u6e96_\u6642_\u3069_\u3059_\u3002",
- "P_S_T_\u3069_\u3059_\u3002",
- "\u592a_\u5e73_\u6d0b_\u590f_\u6642_\u9593_\u3069_\u3059_\u3002",
- "P_D_T_\u3069_\u3059_\u3002"},
- };
-
- static String[][] zoneXX = {
- {"GMT",
- "\u30b0_\u30ea_\u30cb_\u30c3_\u30b8_\u6a19_\u6e96_\u6642\u3070\u3064\u3070\u3064\u3002",
- "G_M_T_\u3070\u3064\u3070\u3064\u3002",
- "\u30b0_\u30ea_\u30cb_\u30c3_\u30b8_\u6a19_\u6e96_\u6642\u3070\u3064\u3070\u3064\u3002",
- "G_M_T_\u3070\u3064\u3070\u3064\u3002"},
- {"America/Los_Angeles",
- "\u592a_\u5e73_\u6d0b_\u6a19_\u6e96_\u6642_\u3070\u3064\u3070\u3064\u3002",
- "P_S_T_\u3070\u3064\u3070\u3064\u3002",
- "\u592a_\u5e73_\u6d0b_\u590f_\u6642_\u9593_\u3070\u3064\u3070\u3064\u3002",
- "P_D_T_\u3070\u3064\u3070\u3064\u3002"}};
-
- static String[][] zoneJaJP = {
- {"GMT",
- "\u30b0_\u30ea_\u30cb_\u30c3_\u30b8_\u6a19_\u6e96_\u6642_\u3067_\u3059_\u3002",
- "G_M_T_\u3067_\u3059_\u3002",
- "\u30b0_\u30ea_\u30cb_\u30c3_\u30b8_\u6a19_\u6e96_\u6642_\u3067_\u3059_\u3002",
- "G_M_T_\u3067_\u3059_\u3002"},
- {"America/Los_Angeles",
- "\u30b0_\u30ea_\u30cb_\u30c3_\u30b8_\u6a19_\u6e96_\u6642_\u3067_\u3059_\u3002",
- "P_S_T_\u3067_\u3059_\u3002",
- "\u592a_\u5e73_\u6d0b_\u590f_\u6642_\u9593_\u3067_\u3059_\u3002",
- "P_D_T_\u3067_\u3059_\u3002"}};
-
- static String[][][] names = {zoneOsaka, zoneKyoto, zoneXX, zoneJaJP};
-
- public Locale[] getAvailableLocales() {
- return avail;
- }
-
- public String getDisplayName(String id, boolean dst, int style, Locale language) {
- if (!Utils.supportsLocale(Arrays.asList(avail), language)) {
- throw new IllegalArgumentException("locale is not one of available locales: "+language);
- }
-
- for (int i = 0; i < avail.length; i ++) {
- if (Utils.supportsLocale(avail[i], language)) {
- String[][] namesForALocale = names[i];
- for (int j = 0; j < namesForALocale.length; j++) {
- String[] array = namesForALocale[j];
- if (id.equals(array[0])) {
- String ret = array[(style==TimeZone.LONG?0:1)+(dst?2:0)+1];
- return ret;
- }
- }
- }
- }
- return null;
- }
-}
--- a/test/jdk/java/util/PluggableLocale/providersrc/Utils.java Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2007, 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.
- *
- * 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.
- */
-/*
- *
- */
-package com.foobar;
-import java.util.*;
-
-public class Utils {
- public static boolean supportsLocale(Locale supported, Locale requested) {
- if (supported.getLanguage() == "") {
- return true;
- } else if (supported.getLanguage() != requested.getLanguage()) {
- return false;
- }
-
- if (supported.getCountry() == "") {
- return true;
- } else if (supported.getCountry() != requested.getCountry()) {
- return false;
- }
-
- String supVar = supported.getVariant();
- String reqVar = requested.getVariant();
-
- if (supVar == "") {
- return true;
- } else {
- int underIndex;
- while ((underIndex = reqVar.lastIndexOf('_')) != (-1)) {
- reqVar = reqVar.substring(0, underIndex);
- if (supVar.equals(reqVar)) {
- return true;
- }
- }
- return supVar.equals(reqVar);
- }
- }
-
- public static boolean supportsLocale(List<Locale> supported, Locale requested) {
- for (Locale l : supported) {
- if (supportsLocale(l, requested)) {
- return true;
- }
- }
- return false;
- }
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/barprovider/META-INF/services/java.util.spi.CalendarDataProvider Thu Oct 18 00:56:38 2018 -0700
@@ -0,0 +1,7 @@
+#
+#
+#
+# fully-qualified name of the java.util.spi.CalendarDataProvider
+# implementation class
+#
+com.bar.CalendarDataProviderImpl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/barprovider/META-INF/services/java.util.spi.CalendarNameProvider Thu Oct 18 00:56:38 2018 -0700
@@ -0,0 +1,7 @@
+#
+#
+#
+# fully-qualified name of the java.util.spi.CalendarNameProvider
+# implementation class
+#
+com.bar.CalendarNameProviderImpl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/barprovider/META-INF/services/java.util.spi.CurrencyNameProvider Thu Oct 18 00:56:38 2018 -0700
@@ -0,0 +1,8 @@
+#
+#
+#
+# fully-qualified name of the java.util.spi.LocaleNameProvider
+# implementation class
+#
+com.bar.CurrencyNameProviderImpl
+com.bar.CurrencyNameProviderImpl2
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/barprovider/META-INF/services/java.util.spi.LocaleNameProvider Thu Oct 18 00:56:38 2018 -0700
@@ -0,0 +1,7 @@
+#
+#
+#
+# fully-qualified name of the java.util.spi.LocaleNameProvider
+# implementation class
+#
+com.bar.LocaleNameProviderImpl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/barprovider/META-INF/services/java.util.spi.TimeZoneNameProvider Thu Oct 18 00:56:38 2018 -0700
@@ -0,0 +1,8 @@
+#
+#
+#
+# fully-qualified name of the java.util.spi.TimeZoneNameProvider
+# implementation class
+#
+com.bar.TimeZoneNameProviderImpl
+com.bar.GenericTimeZoneNameProviderImpl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/barprovider/com/bar/CalendarDataProviderImpl.java Thu Oct 18 00:56:38 2018 -0700
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2012, 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.
+ *
+ * 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.
+ */
+
+package com.bar;
+
+import com.foobar.Utils;
+import java.util.Arrays;
+import static java.util.Calendar.*;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+import java.util.spi.CalendarDataProvider;
+
+public class CalendarDataProviderImpl extends CalendarDataProvider {
+ static final char FULLWIDTH_ZERO = '\uff10';
+ static final Locale[] avail = {
+ new Locale("ja", "JP", "kids"),
+ };
+
+ @Override
+ public int getFirstDayOfWeek(Locale locale) {
+ return WEDNESDAY;
+ }
+
+ @Override
+ public int getMinimalDaysInFirstWeek(Locale locale) {
+ return 7;
+ }
+
+ @Override
+ public Locale[] getAvailableLocales() {
+ return avail.clone();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/barprovider/com/bar/CalendarNameProviderImpl.java Thu Oct 18 00:56:38 2018 -0700
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2012, 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.
+ *
+ * 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.
+ */
+
+package com.bar;
+
+import com.foobar.Utils;
+import java.util.Arrays;
+import static java.util.Calendar.*;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+import java.util.spi.CalendarNameProvider;
+
+public class CalendarNameProviderImpl extends CalendarNameProvider {
+ static final char FULLWIDTH_ZERO = '\uff10';
+ static final Locale[] avail = {
+ new Locale("ja", "JP", "kids"),
+ };
+
+ @Override
+ public String getDisplayName(String calendarType, int field, int value, int style, Locale locale) {
+ if (calendarType == null || locale == null) {
+ throw new NullPointerException();
+ }
+ if (!Utils.supportsLocale(Arrays.asList(avail), locale)) {
+ throw new IllegalArgumentException("locale is not one of available locales: "+ locale);
+ }
+ if (field != MONTH) {
+ return null;
+ }
+ return toMonthName(value + 1, style);
+ }
+
+ @Override
+ public Map<String, Integer> getDisplayNames(String calendarType, int field, int style, Locale locale) {
+ if (calendarType == null || locale == null) {
+ throw new NullPointerException();
+ }
+ if (!Utils.supportsLocale(Arrays.asList(avail), locale)) {
+ throw new IllegalArgumentException("locale is not one of available locales: " + locale);
+ }
+ if (field != MONTH) {
+ return null;
+ }
+ Map<String, Integer> map = new HashMap<>();
+ if (style == LONG_STANDALONE) {
+ style = LONG;
+ } else if (style == SHORT_STANDALONE) {
+ style = SHORT;
+ }
+ for (int month = JANUARY; month <= DECEMBER; month++) {
+ if (style == ALL_STYLES || style == LONG) {
+ map.put(toMonthName(month + 1, LONG), month);
+ }
+ if (style == ALL_STYLES || style == SHORT) {
+ map.put(toMonthName(month + 1, SHORT), month);
+ }
+ }
+ return map;
+ }
+
+ @Override
+ public Locale[] getAvailableLocales() {
+ return avail.clone();
+ }
+
+ // month is 1-based.
+ public static String toMonthName(int month, int style) {
+ StringBuilder sb = new StringBuilder();
+ if (month >= 10) {
+ sb.append((char)(FULLWIDTH_ZERO + 1));
+ sb.appendCodePoint((char)(FULLWIDTH_ZERO + (month % 10)));
+ } else {
+ sb.appendCodePoint((char)(FULLWIDTH_ZERO + month));
+ }
+ if (style == SHORT || style == SHORT_STANDALONE) {
+ return sb.toString(); // full-width digit(s)
+ }
+ sb.append("\u304c\u3064"); // + "gatsu" in Hiragana
+ return sb.toString();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/barprovider/com/bar/CurrencyNameProviderImpl.java Thu Oct 18 00:56:38 2018 -0700
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2007, 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.
+ *
+ * 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.
+ */
+/*
+ *
+ */
+
+package com.bar;
+
+import java.util.*;
+import java.util.spi.*;
+
+import com.foobar.Utils;
+
+public class CurrencyNameProviderImpl extends CurrencyNameProvider {
+ static Locale[] avail = {new Locale("ja", "JP", "osaka"),
+ new Locale("ja", "JP", "kyoto"),
+ Locale.JAPAN,
+ new Locale("xx")};
+
+ public Locale[] getAvailableLocales() {
+ return avail;
+ }
+
+ 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 "\u5186\u3084\u3002";
+ } else if (Utils.supportsLocale(avail[1], locale)) {
+ return "\u5186\u3069\u3059\u3002";
+ } else if (Utils.supportsLocale(avail[2], locale)) {
+ return "\u5186\u3067\u3059\u3002";
+ } else if (Utils.supportsLocale(avail[3], locale)) {
+ return "\u5186\u3070\u3064\u3070\u3064\u3002";
+ }
+ }
+ 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 "\u65e5\u672c\u5186\u3084\u3002";
+ } else if (Utils.supportsLocale(avail[1], locale)) {
+ return "\u65e5\u672c\u5186\u3069\u3059\u3002";
+ } else if (Utils.supportsLocale(avail[2], locale)) {
+ return "\u65e5\u672c\u5186\u3067\u3059\u3002";
+ } else if (Utils.supportsLocale(avail[3], locale)) {
+ return "\u65e5\u672c\u5186\u3070\u3064\u3070\u3064\u3002";
+ }
+ }
+ return null;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/barprovider/com/bar/CurrencyNameProviderImpl2.java Thu Oct 18 00:56:38 2018 -0700
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2012, 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.
+ *
+ * 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.
+ */
+/*
+ *
+ */
+
+package com.bar;
+
+import java.util.*;
+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
+ 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;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/barprovider/com/bar/GenericTimeZoneNameProviderImpl.java Thu Oct 18 00:56:38 2018 -0700
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2012, 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.
+ *
+ * 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.
+ */
+/*
+ *
+ */
+
+package com.bar;
+
+import java.util.*;
+import java.util.spi.*;
+
+import com.foobar.Utils;
+
+/**
+ * Implementation class for getGenericTimeZoneName which returns "Generic "+<standard name in OSAKA>.
+ */
+public class GenericTimeZoneNameProviderImpl extends TimeZoneNameProviderImpl {
+ static final Locale jaJPGeneric = new Locale("ja", "JP", "generic");
+ static final Locale OSAKA = new Locale("ja", "JP", "osaka");
+
+ static Locale[] avail = {
+ jaJPGeneric
+ };
+
+ @Override
+ public Locale[] getAvailableLocales() {
+ return avail;
+ }
+
+ @Override
+ public String getGenericDisplayName(String id, int style, Locale locale) {
+ if (!jaJPGeneric.equals(locale)) {
+ return null;
+ }
+ String std = super.getDisplayName(id, false, style, OSAKA);
+ return (std != null) ? "Generic " + std : null;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/barprovider/com/bar/LocaleNameProviderImpl.java Thu Oct 18 00:56:38 2018 -0700
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2007, 2012, 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.
+ *
+ * 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.
+ */
+/*
+ *
+ */
+
+package com.bar;
+
+import java.text.*;
+import java.util.*;
+import java.util.spi.*;
+
+import com.foobar.Utils;
+
+public class LocaleNameProviderImpl extends LocaleNameProvider {
+ static Locale[] avail = {Locale.JAPANESE,
+ Locale.JAPAN,
+ new Locale("ja", "JP", "osaka"),
+ new Locale("ja", "JP", "kyoto"),
+ new Locale("xx"),
+ new Locale("yy", "YY", "YYYY")};
+ static List<Locale> availList = Arrays.asList(avail);
+ public Locale[] getAvailableLocales() {
+ return avail;
+ }
+
+ @Override
+ public String getDisplayLanguage(String lang, Locale target) {
+ return getDisplayString(lang, target);
+ }
+
+ @Override
+ public String getDisplayCountry(String ctry, Locale target) {
+ return getDisplayString(ctry, target);
+ }
+
+ @Override
+ public String getDisplayVariant(String vrnt, Locale target) {
+ return getDisplayString(vrnt, target);
+ }
+
+ private String getDisplayString(String key, Locale target) {
+ if (!Utils.supportsLocale(availList, target)) {
+ throw new IllegalArgumentException("locale is not supported: "+target);
+ }
+
+ String ret = null;
+
+ if (target.getLanguage().equals("yy") &&
+ target.getCountry().equals("YY")) {
+ String vrnt = target.getVariant();
+ if (vrnt.startsWith("YYYY")) {
+ switch (key) {
+ case "yy":
+ case "YY":
+ ret = "waiwai";
+ break;
+
+ case "YYYY":
+ if (vrnt.equals("YYYY_suffix")) {
+ // for LocaleNameProviderTest.variantFallbackTest()
+ throw new RuntimeException(vrnt);
+ } else {
+ ret = "waiwai";
+ }
+ break;
+ }
+ }
+ } else {
+ // resource bundle based (allows fallback)
+ try {
+ ResourceBundle rb = ResourceBundle.getBundle("com.bar.LocaleNames", target);
+ ret = rb.getString(key);
+ } catch (MissingResourceException mre) {
+ }
+ }
+
+ return ret;
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/barprovider/com/bar/LocaleNames.properties Thu Oct 18 00:56:38 2018 -0700
@@ -0,0 +1,25 @@
+#
+# Copyright (c) 2007, 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.
+#
+# 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.
+#
+osaka=Osaka
+kyoto=Kyoto
+xx=batsubatsu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/barprovider/com/bar/LocaleNames_ja.properties Thu Oct 18 00:56:38 2018 -0700
@@ -0,0 +1,30 @@
+#
+# Copyright (c) 2007, 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.
+#
+# 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.
+#
+ja=\u65e5\u672c\u8a9e\u3067\u3059\u3002
+JP=\u65e5\u672c\u3067\u3059\u3002
+#
+# added ones
+#
+osaka=\u5927\u962a\u3067\u3059\u3002
+kyoto=\u4eac\u90fd\u3067\u3059\u3002
+xx=\u3070\u3064\u3070\u3064\u3067\u3059\u3002
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/barprovider/com/bar/LocaleNames_ja_JP_kyoto.properties Thu Oct 18 00:56:38 2018 -0700
@@ -0,0 +1,28 @@
+#
+# Copyright (c) 2007, 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.
+#
+# 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.
+#
+ja=\u65e5\u672c\u8a9e\u3069\u3059\u3002
+JP=\u65e5\u672c\u3069\u3059\u3002
+#
+osaka=\u5927\u962a\u3069\u3059\u3002
+kyoto=\u4eac\u90fd\u3069\u3059\u3002
+xx=\u307a\u3051\u307a\u3051\u3069\u3059\u3002
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/barprovider/com/bar/LocaleNames_ja_JP_osaka.properties Thu Oct 18 00:56:38 2018 -0700
@@ -0,0 +1,28 @@
+#
+# Copyright (c) 2007, 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.
+#
+# 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.
+#
+ja=\u7956\u56fd\u8a9e\u3084\u3002
+JP=\u3084\u307e\u3068\u3084\u3002
+#
+osaka=\u5927\u962a\u3084\u3002
+kyoto=\u4eac\u90fd\u3084\u3002
+xx=\u307a\u3051\u307a\u3051\u3084\u3002
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/barprovider/com/bar/LocaleNames_xx.properties Thu Oct 18 00:56:38 2018 -0700
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2007, 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.
+#
+# 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.
+#
+xx=batsubatsu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/barprovider/com/bar/TimeZoneNameProviderImpl.java Thu Oct 18 00:56:38 2018 -0700
@@ -0,0 +1,150 @@
+/*
+ * Copyright (c) 2007, 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.
+ *
+ * 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.
+ */
+/*
+ *
+ */
+
+package com.bar;
+
+import java.util.*;
+import java.util.spi.*;
+
+import com.foobar.Utils;
+
+public class TimeZoneNameProviderImpl extends TimeZoneNameProvider {
+ static Locale[] avail = {new Locale("ja", "JP", "osaka"),
+ new Locale("ja", "JP", "kyoto"),
+ new Locale("xx"),
+ Locale.JAPAN};
+
+ static String[][] zoneOsaka = {
+ {"GMT",
+ "\u30b0_\u30ea_\u30cb_\u30c3_\u30b8_\u6a19_\u6e96_\u6642_\u3084_\u3002",
+ "G_M_T_\u3084_\u3002",
+ "\u30b0_\u30ea_\u30cb_\u30c3_\u30b8_\u6a19_\u6e96_\u6642_\u3084_\u3002",
+ "G_M_T_\u3084_\u3002"},
+ {"JST",
+ "\u3084_\u307e_\u3068_\u6a19_\u6e96_\u6642_\u3084_\u3002",
+ "J_S_T_\u3084_\u3002",
+ "\u3084_\u307e_\u3068_\u6a19_\u6e96_\u6642_\u3084_\u3002",
+ "J_S_T_\u3084_\u3002"},
+ {"America/Los_Angeles",
+ "\u592a_\u5e73_\u6d0b_\u6a19_\u6e96_\u6642_\u3084_\u3002",
+ "P_S_T_\u3084_\u3002",
+ "\u592a_\u5e73_\u6d0b_\u590f_\u6642_\u9593_\u3084_\u3002",
+ "P_D_T_\u3084_\u3002"},
+ {"SystemV/PST8",
+ "\u592a_\u5e73_\u6d0b_\u6a19_\u6e96_\u6642_\u3084_\u3002",
+ "P_S_T_\u3084_\u3002",
+ "\u592a_\u5e73_\u6d0b_\u590f_\u6642_\u9593_\u3084_\u3002",
+ "P_D_T_\u3084_\u3002"},
+ {"SystemV/PST8PDT",
+ "\u592a_\u5e73_\u6d0b_\u6a19_\u6e96_\u6642_\u3084_\u3002",
+ "P_S_T_\u3084_\u3002",
+ "\u592a_\u5e73_\u6d0b_\u590f_\u6642_\u9593_\u3084_\u3002",
+ "P_D_T_\u3084_\u3002"},
+ {"PST8PDT",
+ "\u592a_\u5e73_\u6d0b_\u6a19_\u6e96_\u6642_\u3084_\u3002",
+ "P_S_T_\u3084_\u3002",
+ "\u592a_\u5e73_\u6d0b_\u590f_\u6642_\u9593_\u3084_\u3002",
+ "P_D_T_\u3084_\u3002"},
+ };
+
+ static String[][] zoneKyoto = {
+ {"GMT",
+ "\u30b0_\u30ea_\u30cb_\u30c3_\u30b8_\u6a19_\u6e96_\u6642_\u3069_\u3059_\u3002",
+ "G_M_T_\u3069_\u3059_\u3002",
+ "\u30b0_\u30ea_\u30cb_\u30c3_\u30b8_\u6a19_\u6e96_\u6642_\u3069_\u3059_\u3002",
+ "G_M_T_\u3069_\u3059_\u3002"},
+ {"America/Los_Angeles",
+ "\u592a_\u5e73_\u6d0b_\u6a19_\u6e96_\u6642_\u3069_\u3059_\u3002",
+ "P_S_T_\u3069_\u3059_\u3002",
+ "\u592a_\u5e73_\u6d0b_\u590f_\u6642_\u9593_\u3069_\u3059_\u3002",
+ "P_D_T_\u3069_\u3059_\u3002"},
+ {"SystemV/PST8",
+ "\u592a_\u5e73_\u6d0b_\u6a19_\u6e96_\u6642_\u3069_\u3059_\u3002",
+ "P_S_T_\u3069_\u3059_\u3002",
+ "\u592a_\u5e73_\u6d0b_\u590f_\u6642_\u9593_\u3069_\u3059_\u3002",
+ "P_D_T_\u3069_\u3059_\u3002"},
+ {"SystemV/PST8PDT",
+ "\u592a_\u5e73_\u6d0b_\u6a19_\u6e96_\u6642_\u3069_\u3059_\u3002",
+ "P_S_T_\u3069_\u3059_\u3002",
+ "\u592a_\u5e73_\u6d0b_\u590f_\u6642_\u9593_\u3069_\u3059_\u3002",
+ "P_D_T_\u3069_\u3059_\u3002"},
+ {"PST8PDT",
+ "\u592a_\u5e73_\u6d0b_\u6a19_\u6e96_\u6642_\u3069_\u3059_\u3002",
+ "P_S_T_\u3069_\u3059_\u3002",
+ "\u592a_\u5e73_\u6d0b_\u590f_\u6642_\u9593_\u3069_\u3059_\u3002",
+ "P_D_T_\u3069_\u3059_\u3002"},
+ };
+
+ static String[][] zoneXX = {
+ {"GMT",
+ "\u30b0_\u30ea_\u30cb_\u30c3_\u30b8_\u6a19_\u6e96_\u6642\u3070\u3064\u3070\u3064\u3002",
+ "G_M_T_\u3070\u3064\u3070\u3064\u3002",
+ "\u30b0_\u30ea_\u30cb_\u30c3_\u30b8_\u6a19_\u6e96_\u6642\u3070\u3064\u3070\u3064\u3002",
+ "G_M_T_\u3070\u3064\u3070\u3064\u3002"},
+ {"America/Los_Angeles",
+ "\u592a_\u5e73_\u6d0b_\u6a19_\u6e96_\u6642_\u3070\u3064\u3070\u3064\u3002",
+ "P_S_T_\u3070\u3064\u3070\u3064\u3002",
+ "\u592a_\u5e73_\u6d0b_\u590f_\u6642_\u9593_\u3070\u3064\u3070\u3064\u3002",
+ "P_D_T_\u3070\u3064\u3070\u3064\u3002"}};
+
+ static String[][] zoneJaJP = {
+ {"GMT",
+ "\u30b0_\u30ea_\u30cb_\u30c3_\u30b8_\u6a19_\u6e96_\u6642_\u3067_\u3059_\u3002",
+ "G_M_T_\u3067_\u3059_\u3002",
+ "\u30b0_\u30ea_\u30cb_\u30c3_\u30b8_\u6a19_\u6e96_\u6642_\u3067_\u3059_\u3002",
+ "G_M_T_\u3067_\u3059_\u3002"},
+ {"America/Los_Angeles",
+ "\u30b0_\u30ea_\u30cb_\u30c3_\u30b8_\u6a19_\u6e96_\u6642_\u3067_\u3059_\u3002",
+ "P_S_T_\u3067_\u3059_\u3002",
+ "\u592a_\u5e73_\u6d0b_\u590f_\u6642_\u9593_\u3067_\u3059_\u3002",
+ "P_D_T_\u3067_\u3059_\u3002"}};
+
+ static String[][][] names = {zoneOsaka, zoneKyoto, zoneXX, zoneJaJP};
+
+ public Locale[] getAvailableLocales() {
+ return avail;
+ }
+
+ public String getDisplayName(String id, boolean dst, int style, Locale language) {
+ if (!Utils.supportsLocale(Arrays.asList(avail), language)) {
+ throw new IllegalArgumentException("locale is not one of available locales: "+language);
+ }
+
+ for (int i = 0; i < avail.length; i ++) {
+ if (Utils.supportsLocale(avail[i], language)) {
+ String[][] namesForALocale = names[i];
+ for (int j = 0; j < namesForALocale.length; j++) {
+ String[] array = namesForALocale[j];
+ if (id.equals(array[0])) {
+ String ret = array[(style==TimeZone.LONG?0:1)+(dst?2:0)+1];
+ return ret;
+ }
+ }
+ }
+ }
+ return null;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/foobarutils/com/foobar/Utils.java Thu Oct 18 00:56:38 2018 -0700
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2007, 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.
+ *
+ * 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.
+ */
+/*
+ *
+ */
+package com.foobar;
+import java.util.*;
+
+public class Utils {
+ public static boolean supportsLocale(Locale supported, Locale requested) {
+ if (supported.getLanguage() == "") {
+ return true;
+ } else if (supported.getLanguage() != requested.getLanguage()) {
+ return false;
+ }
+
+ if (supported.getCountry() == "") {
+ return true;
+ } else if (supported.getCountry() != requested.getCountry()) {
+ return false;
+ }
+
+ String supVar = supported.getVariant();
+ String reqVar = requested.getVariant();
+
+ if (supVar == "") {
+ return true;
+ } else {
+ int underIndex;
+ while ((underIndex = reqVar.lastIndexOf('_')) != (-1)) {
+ reqVar = reqVar.substring(0, underIndex);
+ if (supVar.equals(reqVar)) {
+ return true;
+ }
+ }
+ return supVar.equals(reqVar);
+ }
+ }
+
+ public static boolean supportsLocale(List<Locale> supported, Locale requested) {
+ for (Locale l : supported) {
+ if (supportsLocale(l, requested)) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/fooprovider/META-INF/services/java.text.spi.BreakIteratorProvider Thu Oct 18 00:56:38 2018 -0700
@@ -0,0 +1,7 @@
+#
+#
+#
+# fully-qualified name of the java.text.spi.BreakIteratorProvider
+# implementation class
+#
+com.foo.BreakIteratorProviderImpl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/fooprovider/META-INF/services/java.text.spi.CollatorProvider Thu Oct 18 00:56:38 2018 -0700
@@ -0,0 +1,7 @@
+#
+#
+#
+# fully-qualified name of the java.text.spi.CollatorProvider
+# implementation class
+#
+com.foo.CollatorProviderImpl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/fooprovider/META-INF/services/java.text.spi.DateFormatProvider Thu Oct 18 00:56:38 2018 -0700
@@ -0,0 +1,7 @@
+#
+#
+#
+# fully-qualified name of the java.text.spi.DateFormatProvider
+# implementation class
+#
+com.foo.DateFormatProviderImpl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/fooprovider/META-INF/services/java.text.spi.DateFormatSymbolsProvider Thu Oct 18 00:56:38 2018 -0700
@@ -0,0 +1,7 @@
+#
+#
+#
+# fully-qualified name of the java.text.spi.DateFormatProvider
+# implementation class
+#
+com.foo.DateFormatSymbolsProviderImpl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/fooprovider/META-INF/services/java.text.spi.DecimalFormatSymbolsProvider Thu Oct 18 00:56:38 2018 -0700
@@ -0,0 +1,7 @@
+#
+#
+#
+# fully-qualified name of the java.text.spi.DecimalFormatProvider
+# implementation class
+#
+com.foo.DecimalFormatSymbolsProviderImpl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/fooprovider/META-INF/services/java.text.spi.NumberFormatProvider Thu Oct 18 00:56:38 2018 -0700
@@ -0,0 +1,7 @@
+#
+#
+#
+# fully-qualified name of the java.text.spi.NumberFormatProvider
+# implementation class
+#
+com.foo.NumberFormatProviderImpl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/fooprovider/com/foo/BreakIteratorProviderImpl.java Thu Oct 18 00:56:38 2018 -0700
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2007, 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.
+ *
+ * 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.
+ */
+/*
+ *
+ */
+
+package com.foo;
+
+import java.text.*;
+import java.text.spi.*;
+import java.util.*;
+import com.foobar.Utils;
+
+public class BreakIteratorProviderImpl extends BreakIteratorProvider {
+
+ static Locale[] avail = {
+ Locale.JAPAN,
+ new Locale("ja", "JP", "osaka"),
+ new Locale("ja", "JP", "kyoto"),
+ new Locale("xx", "YY")};
+
+ static String[] dialect = {
+ "\u3067\u3059\u3002",
+ "\u3084\u3002",
+ "\u3069\u3059\u3002",
+ "-xx-YY"
+ };
+
+ static enum Type {CHARACTER, LINE, SENTENCE, WORD};
+
+ public Locale[] getAvailableLocales() {
+ return avail;
+ }
+
+ public BreakIterator getCharacterInstance(Locale locale) {
+ for (int i = 0; i < avail.length; i ++) {
+ if (Utils.supportsLocale(avail[i], locale)) {
+ return new FooBreakIterator(Type.CHARACTER, i);
+ }
+ }
+ throw new IllegalArgumentException("locale is not supported: "+locale);
+ }
+
+ public BreakIterator getLineInstance(Locale locale) {
+ for (int i = 0; i < avail.length; i ++) {
+ if (Utils.supportsLocale(avail[i], locale)) {
+ return new FooBreakIterator(Type.LINE, i);
+ }
+ }
+ throw new IllegalArgumentException("locale is not supported: "+locale);
+ }
+
+ public BreakIterator getSentenceInstance(Locale locale) {
+ for (int i = 0; i < avail.length; i ++) {
+ if (Utils.supportsLocale(avail[i], locale)) {
+ return new FooBreakIterator(Type.SENTENCE, i);
+ }
+ }
+ throw new IllegalArgumentException("locale is not supported: "+locale);
+ }
+
+ public BreakIterator getWordInstance(Locale locale) {
+ for (int i = 0; i < avail.length; i ++) {
+ if (Utils.supportsLocale(avail[i], locale)) {
+ return new FooBreakIterator(Type.WORD, i);
+ }
+ }
+ throw new IllegalArgumentException("locale is not supported: "+locale);
+ }
+
+ // dummy implementation
+ class FooBreakIterator extends BreakIterator {
+ public FooBreakIterator(Type t, int index) {
+ super();
+ }
+
+ public int current() {
+ return 0;
+ }
+
+ public int first() {
+ return 0;
+ }
+
+ public int following(int offset) {
+ return 0;
+ }
+
+ public CharacterIterator getText() {
+ return null;
+ }
+
+ public boolean isBoundary(int offset) {
+ return true;
+ }
+
+ public int last() {
+ return 0;
+ }
+
+ public int next() {
+ return 0;
+ }
+
+ public int next(int n) {
+ return 0;
+ }
+
+ public int preceding(int offset) {
+ return 0;
+ }
+
+ public int previous() {
+ return 0;
+ }
+
+ public void setText(CharacterIterator ci) {
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/fooprovider/com/foo/CollatorProviderImpl.java Thu Oct 18 00:56:38 2018 -0700
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2007, 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.
+ *
+ * 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.
+ */
+/*
+ *
+ */
+
+package com.foo;
+
+import java.text.*;
+import java.text.spi.*;
+import java.util.*;
+
+import com.foobar.Utils;
+
+public class CollatorProviderImpl extends CollatorProvider {
+
+ static Locale[] avail = {
+ Locale.JAPAN,
+ new Locale("ja", "JP", "osaka"),
+ new Locale("ja", "JP", "kyoto"),
+ new Locale("xx", "YY", "ZZZZ")};
+
+ static String[] dialect = {
+ "\u3067\u3059\u3002",
+ "\u3084\u3002",
+ "\u3069\u3059\u3002",
+ "-xx-YY-ZZZZ"
+ };
+
+ public Locale[] getAvailableLocales() {
+ return avail;
+ }
+
+ public Collator getInstance(Locale locale) {
+ for (int i = 0; i < avail.length; i ++) {
+ if (Utils.supportsLocale(avail[i], locale)) {
+ RuleBasedCollator ja = (RuleBasedCollator)Collator.getInstance(Locale.JAPANESE);
+ try {
+ return new RuleBasedCollator(ja.getRules()+"& Z < "+dialect[i]);
+ } catch (ParseException pe) {
+System.err.println(pe+ja.getRules()+"& Z < "+dialect[i]);
+ return ja;
+ }
+ }
+ }
+ throw new IllegalArgumentException("locale is not supported: "+locale);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/fooprovider/com/foo/DateFormatProviderImpl.java Thu Oct 18 00:56:38 2018 -0700
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2007, 2010, 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.
+ *
+ * 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.
+ */
+/*
+ *
+ */
+
+package com.foo;
+
+import java.text.*;
+import java.text.spi.*;
+import java.util.*;
+
+import com.foobar.Utils;
+
+public class DateFormatProviderImpl extends DateFormatProvider {
+
+ static Locale[] avail = {
+ Locale.JAPAN,
+ new Locale("ja", "JP", "osaka"),
+ new Locale("ja", "JP", "kyoto"),
+ new Locale("yy")};
+
+ static String[] datePattern = {
+ "yyyy'\u5e74'M'\u6708'd'\u65e5'", // full date pattern
+ "yyyy/MMM/dd", // long date pattern
+ "yyyy/MM/dd", // medium date pattern
+ "yy/MM/dd" // short date pattern
+ };
+
+ static String[] timePattern = {
+ "H'\u6642'mm'\u5206'ss'\u79d2' z", // full time pattern
+ "H:mm:ss z", // long time pattern
+ "H:mm:ss", // medium time pattern
+ "H:mm" // short time pattern
+ };
+
+ static String[] dialect = {
+ "\u3067\u3059\u3002",
+ "\u3084\u3002",
+ "\u3069\u3059\u3002",
+ "\u308f\u3044\u308f\u3044"
+ };
+
+ public Locale[] getAvailableLocales() {
+ return avail;
+ }
+
+ public DateFormat getDateInstance(int style, Locale locale) {
+ for (int i = 0; i < avail.length; i ++) {
+ if (Utils.supportsLocale(avail[i], locale)) {
+ return new FooDateFormat(datePattern[style]+dialect[i], locale);
+ }
+ }
+ throw new IllegalArgumentException("locale is not supported: "+locale);
+ }
+
+ public DateFormat getTimeInstance(int style, Locale locale) {
+ for (int i = 0; i < avail.length; i ++) {
+ if (Utils.supportsLocale(avail[i], locale)) {
+ return new FooDateFormat(timePattern[style]+dialect[i], locale);
+ }
+ }
+ throw new IllegalArgumentException("locale is not supported: "+locale);
+ }
+
+ public DateFormat getDateTimeInstance(int dateStyle, int timeStyle, Locale locale) {
+ for (int i = 0; i < avail.length; i ++) {
+ if (Utils.supportsLocale(avail[i], locale)) {
+ return new FooDateFormat(
+ datePattern[dateStyle]+" "+timePattern[timeStyle]+dialect[i], locale);
+ }
+ }
+ throw new IllegalArgumentException("locale is not supported: "+locale);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/fooprovider/com/foo/DateFormatSymbolsProviderImpl.java Thu Oct 18 00:56:38 2018 -0700
@@ -0,0 +1,230 @@
+/*
+ * Copyright (c) 2007, 2012, 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.
+ *
+ * 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.
+ */
+/*
+ *
+ */
+
+package com.foo;
+
+import java.text.*;
+import java.text.spi.*;
+import java.util.*;
+
+import com.foobar.Utils;
+
+public class DateFormatSymbolsProviderImpl extends DateFormatSymbolsProvider {
+
+ static Locale[] avail = {
+ new Locale("ja", "JP", "osaka"),
+ new Locale("ja", "JP", "kyoto"),
+ Locale.JAPAN,
+ new Locale("yy", "ZZ")
+ };
+ static List<Locale> availList = Arrays.asList(avail);
+
+ static String[] dialect = {
+ "\u3084\u3002",
+ "\u3069\u3059\u3002",
+ "\u3067\u3059\u3002",
+ "-yy-ZZ"
+ };
+
+ static Map<Locale, FooDateFormatSymbols> symbols = new HashMap<Locale, FooDateFormatSymbols>(4);
+
+ public Locale[] getAvailableLocales() {
+ return avail;
+ }
+
+ public DateFormatSymbols getInstance(Locale locale) {
+ if (!Utils.supportsLocale(availList, locale)) {
+ throw new IllegalArgumentException("locale is not supported: "+locale);
+ }
+
+ FooDateFormatSymbols fdfs = symbols.get(locale);
+ if (fdfs == null) {
+ for (int index = 0; index < avail.length; index ++) {
+ if (Utils.supportsLocale(avail[index], locale)) {
+ fdfs = new FooDateFormatSymbols(index);
+ symbols.put(locale, fdfs);
+ break;
+ }
+ }
+ }
+ return fdfs;
+ }
+
+ class FooDateFormatSymbols extends DateFormatSymbols {
+ String dialect = "";
+
+ String[] eras = null;
+ String[] months = null;
+ String[] shortMonths = null;
+ String[] weekdays = null;
+ String[] shortWeekdays = null;
+ String[] ampms = null;
+
+ public FooDateFormatSymbols(int index) {
+ super(DateFormatSymbolsProviderImpl.this.avail[index]);
+ dialect = DateFormatSymbolsProviderImpl.this.dialect[index];
+ }
+
+ public String[] getEras() {
+ if (eras == null) {
+ eras = super.getEras();
+ for (int i = 0; i < eras.length; i++) {
+ eras[i] = eras[i]+dialect;
+ }
+ }
+ return eras;
+ }
+
+ /**
+ * Sets era strings. For example: "AD" and "BC".
+ * @param newEras the new era strings.
+ */
+ public void setEras(String[] newEras) {
+ eras = newEras;
+ }
+
+ /**
+ * Gets month strings. For example: "January", "February", etc.
+ * @return the month strings.
+ */
+ public String[] getMonths() {
+ if (months == null) {
+ months = super.getMonths();
+ for (int i = 0; i < months.length; i++) {
+ months[i] = months[i]+dialect;
+ }
+ }
+ return months;
+ }
+
+ /**
+ * Sets month strings. For example: "January", "February", etc.
+ * @param newMonths the new month strings.
+ */
+ public void setMonths(String[] newMonths) {
+ months = newMonths;
+ }
+
+ /**
+ * Gets short month strings. For example: "Jan", "Feb", etc.
+ * @return the short month strings.
+ */
+ public String[] getShortMonths() {
+ if (shortMonths == null) {
+ shortMonths = super.getShortMonths();
+ for (int i = 0; i < shortMonths.length; i++) {
+ shortMonths[i] = shortMonths[i]+dialect;
+ }
+ }
+ return shortMonths;
+ }
+
+ /**
+ * Sets short month strings. For example: "Jan", "Feb", etc.
+ * @param newShortMonths the new short month strings.
+ */
+ public void setShortMonths(String[] newShortMonths) {
+ shortMonths = newShortMonths;
+ }
+
+ /**
+ * Gets weekday strings. For example: "Sunday", "Monday", etc.
+ * @return the weekday strings. Use <code>Calendar.SUNDAY</code>,
+ * <code>Calendar.MONDAY</code>, etc. to index the result array.
+ */
+ public String[] getWeekdays() {
+ if (weekdays == null) {
+ weekdays = super.getWeekdays();
+ for (int i = 0; i < weekdays.length; i++) {
+ weekdays[i] = weekdays[i]+dialect;
+ }
+ }
+ return weekdays;
+ }
+
+ /**
+ * Sets weekday strings. For example: "Sunday", "Monday", etc.
+ * @param newWeekdays the new weekday strings. The array should
+ * be indexed by <code>Calendar.SUNDAY</code>,
+ * <code>Calendar.MONDAY</code>, etc.
+ */
+ public void setWeekdays(String[] newWeekdays) {
+ weekdays = newWeekdays;
+ }
+
+ /**
+ * Gets short weekday strings. For example: "Sun", "Mon", etc.
+ * @return the short weekday strings. Use <code>Calendar.SUNDAY</code>,
+ * <code>Calendar.MONDAY</code>, etc. to index the result array.
+ */
+ public String[] getShortWeekdays() {
+ if (shortWeekdays == null) {
+ shortWeekdays = super.getShortWeekdays();
+ for (int i = 0; i < shortWeekdays.length; i++) {
+ shortWeekdays[i] = shortWeekdays[i]+dialect;
+ }
+ }
+ return shortWeekdays;
+ }
+
+ /**
+ * Sets short weekday strings. For example: "Sun", "Mon", etc.
+ * @param newShortWeekdays the new short weekday strings. The array should
+ * be indexed by <code>Calendar.SUNDAY</code>,
+ * <code>Calendar.MONDAY</code>, etc.
+ */
+ public void setShortWeekdays(String[] newShortWeekdays) {
+ shortWeekdays = newShortWeekdays;
+ }
+
+ /**
+ * Gets ampm strings. For example: "AM" and "PM".
+ * @return the ampm strings.
+ */
+ public String[] getAmPmStrings() {
+ if (ampms == null) {
+ ampms = super.getAmPmStrings();
+ for (int i = 0; i < ampms.length; i++) {
+ ampms[i] = ampms[i]+dialect;
+ }
+ }
+ return ampms;
+ }
+
+ /**
+ * Sets ampm strings. For example: "AM" and "PM".
+ * @param newAmpms the new ampm strings.
+ */
+ public void setAmPmStrings(String[] newAmpms) {
+ ampms = newAmpms;
+ }
+
+ @Override
+ public String[][] getZoneStrings() {
+ return new String[0][0];
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/fooprovider/com/foo/DecimalFormatSymbolsProviderImpl.java Thu Oct 18 00:56:38 2018 -0700
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2007, 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.
+ *
+ * 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.
+ */
+/*
+ *
+ */
+
+package com.foo;
+
+import java.text.*;
+import java.text.spi.*;
+import java.util.*;
+
+import com.foobar.Utils;
+
+public class DecimalFormatSymbolsProviderImpl extends DecimalFormatSymbolsProvider {
+
+ static Locale[] avail = {
+ new Locale("ja", "JP", "osaka"),
+ new Locale("ja", "JP", "kyoto"),
+ Locale.JAPAN,
+ new Locale("yy", "ZZ", "UUU")
+ };
+ static List<Locale> availList = Arrays.asList(avail);
+
+ static String[] dialect = {
+ "\u3084\u3002",
+ "\u3069\u3059\u3002",
+ "\u3067\u3059\u3002",
+ "-yy-ZZ-UUU"
+ };
+
+ static HashMap<Locale, FooDecimalFormatSymbols> symbols = new HashMap<Locale, FooDecimalFormatSymbols>(4);
+
+ public Locale[] getAvailableLocales() {
+ return avail;
+ }
+
+ public DecimalFormatSymbols getInstance(Locale locale) {
+ if (!Utils.supportsLocale(availList, locale)) {
+ throw new IllegalArgumentException("locale is not supported: "+locale);
+ }
+
+ FooDecimalFormatSymbols fdfs = symbols.get(locale);
+ if (fdfs == null) {
+ for (int index = 0; index < avail.length; index ++) {
+ if (Utils.supportsLocale(avail[index], locale)) {
+ fdfs = new FooDecimalFormatSymbols(index);
+ symbols.put(locale, fdfs);
+ break;
+ }
+ }
+ }
+ return fdfs;
+ }
+
+ class FooDecimalFormatSymbols extends DecimalFormatSymbols {
+ String dialect = "";
+
+ String infinity = null;
+ String nan = null;
+
+ public FooDecimalFormatSymbols(int index) {
+ super(DecimalFormatSymbolsProviderImpl.this.avail[index]);
+ dialect = DecimalFormatSymbolsProviderImpl.this.dialect[index];
+ }
+
+ // overrides methods only returns Strings
+ public String getInfinity() {
+ if (infinity == null) {
+ infinity = super.getInfinity() + dialect;
+ }
+ return infinity;
+ }
+
+ public void setInfinity(String infinity) {
+ this.infinity = infinity;
+ }
+
+ public String getNaN() {
+ if (nan == null) {
+ nan = super.getNaN() + dialect;
+ }
+ return nan;
+ }
+
+ public void setNaN(String nan) {
+ this.nan = nan;
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/fooprovider/com/foo/FooDateFormat.java Thu Oct 18 00:56:38 2018 -0700
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2010, 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.
+ *
+ * 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.
+ */
+
+package com.foo;
+
+import java.text.*;
+import java.util.*;
+
+/**
+ * FooDateFormat provides SimpleDateFormat methods required for the SPI testing.
+ */
+public class FooDateFormat extends DateFormat {
+ private SimpleDateFormat sdf;
+
+ public FooDateFormat(String pattern, Locale loc) {
+ sdf = new SimpleDateFormat(pattern, loc);
+ }
+
+ @Override
+ public StringBuffer format(Date date,
+ StringBuffer toAppendTo,
+ FieldPosition fieldPosition) {
+ return sdf.format(date, toAppendTo, fieldPosition);
+ }
+
+ @Override
+ public Date parse(String source, ParsePosition pos) {
+ return sdf.parse(source, pos);
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ return other instanceof FooDateFormat
+ && sdf.equals(((FooDateFormat)other).sdf);
+ }
+
+ @Override
+ public int hashCode() {
+ return sdf.hashCode();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/fooprovider/com/foo/FooNumberFormat.java Thu Oct 18 00:56:38 2018 -0700
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2010, 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.
+ *
+ * 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.
+ */
+
+package com.foo;
+
+import java.text.*;
+
+/**
+ * FooNumberFormat provides DecimalFormat methods required for the SPI testing.
+ */
+public class FooNumberFormat extends NumberFormat {
+ private DecimalFormat df;
+
+ public FooNumberFormat(String pattern, DecimalFormatSymbols dfs) {
+ df = new DecimalFormat(pattern, dfs);
+ }
+
+ @Override
+ public StringBuffer format(double number,
+ StringBuffer toAppendTo,
+ FieldPosition pos) {
+ return df.format(number, toAppendTo, pos);
+ }
+
+ @Override
+ public StringBuffer format(long number,
+ StringBuffer toAppendTo,
+ FieldPosition pos) {
+ return df.format(number, toAppendTo, pos);
+ }
+
+ @Override
+ public Number parse(String source, ParsePosition parsePosition) {
+ return df.parse(source, parsePosition);
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ return other instanceof FooNumberFormat
+ && df.equals(((FooNumberFormat)other).df);
+ }
+
+ @Override
+ public int hashCode() {
+ return df.hashCode();
+ }
+
+ // DecimalFormat specific methods required for testing
+
+ public String toPattern() {
+ return df.toPattern();
+ }
+
+ public DecimalFormatSymbols getDecimalFormatSymbols() {
+ return df.getDecimalFormatSymbols();
+ }
+
+ public void setDecimalSeparatorAlwaysShown(boolean newValue) {
+ df.setDecimalSeparatorAlwaysShown(newValue);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/fooprovider/com/foo/NumberFormatProviderImpl.java Thu Oct 18 00:56:38 2018 -0700
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2007, 2010, 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.
+ *
+ * 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.
+ */
+/*
+ *
+ */
+
+package com.foo;
+
+import java.text.*;
+import java.text.spi.*;
+import java.util.*;
+
+import com.foobar.Utils;
+
+public class NumberFormatProviderImpl extends NumberFormatProvider {
+
+ static Locale[] avail = {
+ Locale.JAPAN,
+ new Locale("ja", "JP", "osaka"),
+ new Locale("ja", "JP", "kyoto"),
+ new Locale("zz")};
+
+ static String[] dialect = {
+ "\u3067\u3059\u3002",
+ "\u3084\u3002",
+ "\u3069\u3059\u3002",
+ "-zz"
+ };
+
+ static String[] patterns = {
+ "#,##0.###{0};-#,##0.###{1}", // decimal pattern
+ "#{0};(#){1}", // integer pattern
+ "\u00A4#,##0{0};-\u00A4#,##0{1}", // currency pattern
+ "#,##0%{0}" // percent pattern
+ };
+ // Constants used by factory methods to specify a style of format.
+ static final int NUMBERSTYLE = 0;
+ static final int INTEGERSTYLE = 1;
+ static final int CURRENCYSTYLE = 2;
+ static final int PERCENTSTYLE = 3;
+
+ public Locale[] getAvailableLocales() {
+ return avail;
+ }
+
+ public NumberFormat getCurrencyInstance(Locale locale) {
+ for (int i = 0; i < avail.length; i ++) {
+ if (Utils.supportsLocale(avail[i], locale)) {
+ String pattern =
+ MessageFormat.format(patterns[CURRENCYSTYLE],
+ dialect[i],
+ dialect[i]);
+ FooNumberFormat nf = new FooNumberFormat(pattern,
+ DecimalFormatSymbols.getInstance(locale));
+ adjustForCurrencyDefaultFractionDigits(nf);
+ return nf;
+ }
+ }
+ throw new IllegalArgumentException("locale is not supported: "+locale);
+ }
+
+ public NumberFormat getIntegerInstance(Locale locale) {
+ for (int i = 0; i < avail.length; i ++) {
+ if (Utils.supportsLocale(avail[i], locale)) {
+ String pattern =
+ MessageFormat.format(patterns[INTEGERSTYLE],
+ dialect[i],
+ dialect[i]);
+ FooNumberFormat nf = new FooNumberFormat(pattern,
+ DecimalFormatSymbols.getInstance(locale));
+ nf.setMaximumFractionDigits(0);
+ nf.setDecimalSeparatorAlwaysShown(false);
+ nf.setParseIntegerOnly(true);
+ return nf;
+ }
+ }
+ throw new IllegalArgumentException("locale is not supported: "+locale);
+ }
+
+ public NumberFormat getNumberInstance(Locale locale) {
+ for (int i = 0; i < avail.length; i ++) {
+ if (Utils.supportsLocale(avail[i], locale)) {
+ String pattern =
+ MessageFormat.format(patterns[NUMBERSTYLE],
+ dialect[i],
+ dialect[i]);
+ return new FooNumberFormat(pattern,
+ DecimalFormatSymbols.getInstance(locale));
+ }
+ }
+ throw new IllegalArgumentException("locale is not supported: "+locale);
+ }
+
+ public NumberFormat getPercentInstance(Locale locale) {
+ for (int i = 0; i < avail.length; i ++) {
+ if (Utils.supportsLocale(avail[i], locale)) {
+ String pattern =
+ MessageFormat.format(patterns[PERCENTSTYLE],
+ dialect[i]);
+ return new FooNumberFormat(pattern,
+ DecimalFormatSymbols.getInstance(locale));
+ }
+ }
+ throw new IllegalArgumentException("locale is not supported: "+locale);
+ }
+
+ /**
+ * Adjusts the minimum and maximum fraction digits to values that
+ * are reasonable for the currency's default fraction digits.
+ */
+ void adjustForCurrencyDefaultFractionDigits(FooNumberFormat nf) {
+ DecimalFormatSymbols dfs = nf.getDecimalFormatSymbols();
+ Currency currency = dfs.getCurrency();
+ if (currency == null) {
+ try {
+ currency = Currency.getInstance(dfs.getInternationalCurrencySymbol());
+ } catch (IllegalArgumentException e) {
+ }
+ }
+ if (currency != null) {
+ int digits = currency.getDefaultFractionDigits();
+ if (digits != -1) {
+ int oldMinDigits = nf.getMinimumFractionDigits();
+ // Common patterns are "#.##", "#.00", "#".
+ // Try to adjust all of them in a reasonable way.
+ if (oldMinDigits == nf.getMaximumFractionDigits()) {
+ nf.setMinimumFractionDigits(digits);
+ nf.setMaximumFractionDigits(digits);
+ } else {
+ nf.setMinimumFractionDigits(Math.min(digits, oldMinDigits));
+ nf.setMaximumFractionDigits(digits);
+ }
+ }
+ }
+ }
+}
--- a/test/jdk/java/util/PluggableLocale/providersrc/java.text.spi.BreakIteratorProvider Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-#
-#
-#
-# fully-qualified name of the java.text.spi.BreakIteratorProvider
-# implementation class
-#
-com.foo.BreakIteratorProviderImpl
--- a/test/jdk/java/util/PluggableLocale/providersrc/java.text.spi.CollatorProvider Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-#
-#
-#
-# fully-qualified name of the java.text.spi.CollatorProvider
-# implementation class
-#
-com.foo.CollatorProviderImpl
--- a/test/jdk/java/util/PluggableLocale/providersrc/java.text.spi.DateFormatProvider Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-#
-#
-#
-# fully-qualified name of the java.text.spi.DateFormatProvider
-# implementation class
-#
-com.foo.DateFormatProviderImpl
--- a/test/jdk/java/util/PluggableLocale/providersrc/java.text.spi.DateFormatSymbolsProvider Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-#
-#
-#
-# fully-qualified name of the java.text.spi.DateFormatProvider
-# implementation class
-#
-com.foo.DateFormatSymbolsProviderImpl
--- a/test/jdk/java/util/PluggableLocale/providersrc/java.text.spi.DecimalFormatSymbolsProvider Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-#
-#
-#
-# fully-qualified name of the java.text.spi.DecimalFormatProvider
-# implementation class
-#
-com.foo.DecimalFormatSymbolsProviderImpl
--- a/test/jdk/java/util/PluggableLocale/providersrc/java.text.spi.NumberFormatProvider Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-#
-#
-#
-# fully-qualified name of the java.text.spi.NumberFormatProvider
-# implementation class
-#
-com.foo.NumberFormatProviderImpl
--- a/test/jdk/java/util/PluggableLocale/providersrc/java.util.spi.CalendarDataProvider Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-#
-#
-#
-# fully-qualified name of the java.util.spi.CalendarDataProvider
-# implementation class
-#
-com.bar.CalendarDataProviderImpl
--- a/test/jdk/java/util/PluggableLocale/providersrc/java.util.spi.CalendarNameProvider Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-#
-#
-#
-# fully-qualified name of the java.util.spi.CalendarNameProvider
-# implementation class
-#
-com.bar.CalendarNameProviderImpl
--- a/test/jdk/java/util/PluggableLocale/providersrc/java.util.spi.CurrencyNameProvider Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-#
-#
-#
-# fully-qualified name of the java.util.spi.LocaleNameProvider
-# implementation class
-#
-com.bar.CurrencyNameProviderImpl
-com.bar.CurrencyNameProviderImpl2
--- a/test/jdk/java/util/PluggableLocale/providersrc/java.util.spi.LocaleNameProvider Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-#
-#
-#
-# fully-qualified name of the java.util.spi.LocaleNameProvider
-# implementation class
-#
-com.bar.LocaleNameProviderImpl
--- a/test/jdk/java/util/PluggableLocale/providersrc/java.util.spi.TimeZoneNameProvider Thu Oct 18 09:19:29 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-#
-#
-#
-# fully-qualified name of the java.util.spi.TimeZoneNameProvider
-# implementation class
-#
-com.bar.TimeZoneNameProviderImpl
-com.bar.GenericTimeZoneNameProviderImpl