8165605: Thai resources in jdk.localedata cause split package issue with java.base
authornaoto
Mon, 12 Sep 2016 09:38:32 -0700
changeset 40813 dd5aa9c67561
parent 40812 dc3755b63ade
child 40814 f105fad88cb6
8165605: Thai resources in jdk.localedata cause split package issue with java.base Reviewed-by: mchung, erikj
jdk/make/gendata/GendataBreakIterator.gmk
jdk/src/java.base/share/classes/sun/text/resources/BreakIteratorRulesProvider.java
jdk/src/java.base/share/classes/sun/util/locale/provider/BreakDictionary.java
jdk/src/java.base/share/classes/sun/util/locale/provider/RuleBasedBreakIterator.java
jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/IncludeLocalesPlugin.java
jdk/src/jdk.localedata/share/classes/sun/text/resources/ext/thai_dict
jdk/src/jdk.localedata/share/classes/sun/text/resources/thai_dict
jdk/test/tools/jlink/plugins/IncludeLocalesPluginTest.java
--- a/jdk/make/gendata/GendataBreakIterator.gmk	Mon Sep 12 17:45:55 2016 +0200
+++ b/jdk/make/gendata/GendataBreakIterator.gmk	Mon Sep 12 09:38:32 2016 -0700
@@ -81,7 +81,7 @@
 
 # output
 BASE_DATA_PKG_DIR := $(JDK_OUTPUTDIR)/modules/java.base/sun/text/resources
-LD_DATA_PKG_DIR := $(JDK_OUTPUTDIR)/modules/jdk.localedata/sun/text/resources
+LD_DATA_PKG_DIR := $(JDK_OUTPUTDIR)/modules/jdk.localedata/sun/text/resources/ext
 BIFILES := $(BASE_DATA_PKG_DIR)/CharacterBreakIteratorData \
     $(BASE_DATA_PKG_DIR)/WordBreakIteratorData \
     $(BASE_DATA_PKG_DIR)/LineBreakIteratorData \
--- a/jdk/src/java.base/share/classes/sun/text/resources/BreakIteratorRulesProvider.java	Mon Sep 12 17:45:55 2016 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * 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.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.text.resources;
-
-import java.util.spi.ResourceBundleProvider;
-
-/**
- * An interface for the internal locale data provider for which {@code ResourceBundle}
- * searches.
- */
-public interface BreakIteratorRulesProvider extends ResourceBundleProvider {
-}
--- a/jdk/src/java.base/share/classes/sun/util/locale/provider/BreakDictionary.java	Mon Sep 12 17:45:55 2016 +0200
+++ b/jdk/src/java.base/share/classes/sun/util/locale/provider/BreakDictionary.java	Mon Sep 12 09:38:32 2016 -0700
@@ -149,7 +149,10 @@
         BufferedInputStream in;
         try {
             PrivilegedExceptionAction<BufferedInputStream> pa = () -> {
-                InputStream is = module.getResourceAsStream("sun/text/resources/" + dictionaryName);
+                String pathName = "jdk.localedata".equals(module.getName()) ?
+                     "sun/text/resources/ext/" :
+                     "sun/text/resources/";
+                InputStream is = module.getResourceAsStream(pathName + dictionaryName);
                 if (is == null) {
                     // Try to load the file with "java.base" module instance. Assumption
                     // here is that the fall back data files to be read should reside in
--- a/jdk/src/java.base/share/classes/sun/util/locale/provider/RuleBasedBreakIterator.java	Mon Sep 12 17:45:55 2016 +0200
+++ b/jdk/src/java.base/share/classes/sun/util/locale/provider/RuleBasedBreakIterator.java	Mon Sep 12 09:38:32 2016 -0700
@@ -444,7 +444,10 @@
         BufferedInputStream is;
         try {
             PrivilegedExceptionAction<BufferedInputStream> pa = () -> {
-                InputStream in = module.getResourceAsStream("sun/text/resources/" + datafile);
+                String pathName = "jdk.localedata".equals(module.getName()) ?
+                     "sun/text/resources/ext/" :
+                     "sun/text/resources/";
+                InputStream in = module.getResourceAsStream(pathName + datafile);
                 if (in == null) {
                     // Try to load the file with "java.base" module instance. Assumption
                     // here is that the fall back data files to be read should reside in
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/IncludeLocalesPlugin.java	Mon Sep 12 17:45:55 2016 +0200
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/IncludeLocalesPlugin.java	Mon Sep 12 09:38:32 2016 -0700
@@ -264,8 +264,8 @@
 
         // Add Thai BreakIterator related data files
         if (tag.equals("th")) {
-            files.add(".+sun/text/resources/thai_dict");
-            files.add(".+sun/text/resources/[^_]+BreakIteratorData_th");
+            files.add(".+sun/text/resources/ext/thai_dict");
+            files.add(".+sun/text/resources/ext/[^_]+BreakIteratorData_th");
         }
 
         // Add Taiwan resource bundles for Hong Kong
Binary file jdk/src/jdk.localedata/share/classes/sun/text/resources/ext/thai_dict has changed
Binary file jdk/src/jdk.localedata/share/classes/sun/text/resources/thai_dict has changed
--- a/jdk/test/tools/jlink/plugins/IncludeLocalesPluginTest.java	Mon Sep 12 17:45:55 2016 +0200
+++ b/jdk/test/tools/jlink/plugins/IncludeLocalesPluginTest.java	Mon Sep 12 09:38:32 2016 -0700
@@ -126,11 +126,10 @@
                 "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_es_419.class",
                 "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_es_AR.class"),
             List.of(
-                "/jdk.localedata/sun/text/resources/LineBreakIteratorData_th",
-                "/jdk.localedata/sun/text/resources/thai_dict",
-                "/jdk.localedata/sun/text/resources/WordBreakIteratorData_th",
+                "/jdk.localedata/sun/text/resources/ext/LineBreakIteratorData_th",
+                "/jdk.localedata/sun/text/resources/ext/thai_dict",
+                "/jdk.localedata/sun/text/resources/ext/WordBreakIteratorData_th",
                 "/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class",
-                "/jdk.localedata/sun/text/resources/ext/BreakIteratorRules_th.class",
                 "/jdk.localedata/sun/text/resources/ext/FormatData_ja.class",
                 "/jdk.localedata/sun/text/resources/ext/FormatData_th.class",
                 "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ja.class",
@@ -165,11 +164,10 @@
                 "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_001.class",
                 "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ja.class"),
             List.of(
-                "/jdk.localedata/sun/text/resources/LineBreakIteratorData_th",
-                "/jdk.localedata/sun/text/resources/thai_dict",
-                "/jdk.localedata/sun/text/resources/WordBreakIteratorData_th",
+                "/jdk.localedata/sun/text/resources/ext/LineBreakIteratorData_th",
+                "/jdk.localedata/sun/text/resources/ext/thai_dict",
+                "/jdk.localedata/sun/text/resources/ext/WordBreakIteratorData_th",
                 "/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class",
-                "/jdk.localedata/sun/text/resources/ext/BreakIteratorRules_th.class",
                 "/jdk.localedata/sun/text/resources/ext/FormatData_th.class",
                 "/jdk.localedata/sun/text/resources/ext/FormatData_zh.class",
                 "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_th.class",
@@ -206,11 +204,10 @@
                 "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_150.class",
                 "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_en_AT.class"),
             List.of(
-                "/jdk.localedata/sun/text/resources/LineBreakIteratorData_th",
-                "/jdk.localedata/sun/text/resources/thai_dict",
-                "/jdk.localedata/sun/text/resources/WordBreakIteratorData_th",
+                "/jdk.localedata/sun/text/resources/ext/LineBreakIteratorData_th",
+                "/jdk.localedata/sun/text/resources/ext/thai_dict",
+                "/jdk.localedata/sun/text/resources/ext/WordBreakIteratorData_th",
                 "/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class",
-                "/jdk.localedata/sun/text/resources/ext/BreakIteratorRules_th.class",
                 "/jdk.localedata/sun/text/resources/ext/FormatData_en_GB.class",
                 "/jdk.localedata/sun/text/resources/ext/FormatData_ja.class",
                 "/jdk.localedata/sun/text/resources/ext/FormatData_th.class",
@@ -235,11 +232,10 @@
                 "/jdk.localedata/sun/util/resources/cldr/ext/CalendarData_kok_IN.class",
                 "/jdk.localedata/sun/util/resources/cldr/ext/CalendarData_pa_Guru_IN.class"),
             List.of(
-                "/jdk.localedata/sun/text/resources/LineBreakIteratorData_th",
-                "/jdk.localedata/sun/text/resources/thai_dict",
-                "/jdk.localedata/sun/text/resources/WordBreakIteratorData_th",
+                "/jdk.localedata/sun/text/resources/ext/LineBreakIteratorData_th",
+                "/jdk.localedata/sun/text/resources/ext/thai_dict",
+                "/jdk.localedata/sun/text/resources/ext/WordBreakIteratorData_th",
                 "/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class",
-                "/jdk.localedata/sun/text/resources/ext/BreakIteratorRules_th.class",
                 "/jdk.localedata/sun/text/resources/ext/FormatData_en_GB.class",
                 "/jdk.localedata/sun/text/resources/ext/FormatData_ja.class",
                 "/jdk.localedata/sun/text/resources/ext/FormatData_th.class",
@@ -261,11 +257,10 @@
             "--include-locales=th",
             "jdk.localedata",
             List.of(
-                "/jdk.localedata/sun/text/resources/LineBreakIteratorData_th",
-                "/jdk.localedata/sun/text/resources/thai_dict",
-                "/jdk.localedata/sun/text/resources/WordBreakIteratorData_th",
+                "/jdk.localedata/sun/text/resources/ext/LineBreakIteratorData_th",
+                "/jdk.localedata/sun/text/resources/ext/thai_dict",
+                "/jdk.localedata/sun/text/resources/ext/WordBreakIteratorData_th",
                 "/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class",
-                "/jdk.localedata/sun/text/resources/ext/BreakIteratorRules_th.class",
                 "/jdk.localedata/sun/text/resources/ext/FormatData_th.class"),
             List.of(
                 "/jdk.localedata/sun/text/resources/ext/FormatData_en_GB.class",
@@ -290,11 +285,10 @@
                 "/jdk.localedata/sun/text/resources/ext/FormatData_zh_TW.class",
                 "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_zh.class"),
             List.of(
-                "/jdk.localedata/sun/text/resources/LineBreakIteratorData_th",
-                "/jdk.localedata/sun/text/resources/thai_dict",
-                "/jdk.localedata/sun/text/resources/WordBreakIteratorData_th",
+                "/jdk.localedata/sun/text/resources/ext/LineBreakIteratorData_th",
+                "/jdk.localedata/sun/text/resources/ext/thai_dict",
+                "/jdk.localedata/sun/text/resources/ext/WordBreakIteratorData_th",
                 "/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class",
-                "/jdk.localedata/sun/text/resources/ext/BreakIteratorRules_th.class",
                 "/jdk.localedata/sun/text/resources/ext/FormatData_en_GB.class",
                 "/jdk.localedata/sun/text/resources/ext/FormatData_ja.class",
                 "/jdk.localedata/sun/text/resources/ext/FormatData_th.class",
@@ -318,11 +312,10 @@
                 "/jdk.localedata/sun/text/resources/ext/FormatData_zh_SG.class",
                 "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_zh.class"),
             List.of(
-                "/jdk.localedata/sun/text/resources/LineBreakIteratorData_th",
-                "/jdk.localedata/sun/text/resources/thai_dict",
-                "/jdk.localedata/sun/text/resources/WordBreakIteratorData_th",
+                "/jdk.localedata/sun/text/resources/ext/LineBreakIteratorData_th",
+                "/jdk.localedata/sun/text/resources/ext/thai_dict",
+                "/jdk.localedata/sun/text/resources/ext/WordBreakIteratorData_th",
                 "/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class",
-                "/jdk.localedata/sun/text/resources/ext/BreakIteratorRules_th.class",
                 "/jdk.localedata/sun/text/resources/ext/FormatData_en_GB.class",
                 "/jdk.localedata/sun/text/resources/ext/FormatData_ja.class",
                 "/jdk.localedata/sun/text/resources/ext/FormatData_th.class",
@@ -346,11 +339,10 @@
                 "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_nb.class",
                 "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_nn.class"),
             List.of(
-                "/jdk.localedata/sun/text/resources/LineBreakIteratorData_th",
-                "/jdk.localedata/sun/text/resources/thai_dict",
-                "/jdk.localedata/sun/text/resources/WordBreakIteratorData_th",
+                "/jdk.localedata/sun/text/resources/ext/LineBreakIteratorData_th",
+                "/jdk.localedata/sun/text/resources/ext/thai_dict",
+                "/jdk.localedata/sun/text/resources/ext/WordBreakIteratorData_th",
                 "/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class",
-                "/jdk.localedata/sun/text/resources/ext/BreakIteratorRules_th.class",
                 "/jdk.localedata/sun/text/resources/ext/FormatData_en_GB.class",
                 "/jdk.localedata/sun/text/resources/ext/FormatData_ja.class",
                 "/jdk.localedata/sun/text/resources/ext/FormatData_th.class",
@@ -376,11 +368,10 @@
                 "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_iw.class",
                 "/jdk.localedata/sun/text/resources/cldr/ext/FormatData_ji.class"),
             List.of(
-                "/jdk.localedata/sun/text/resources/LineBreakIteratorData_th",
-                "/jdk.localedata/sun/text/resources/thai_dict",
-                "/jdk.localedata/sun/text/resources/WordBreakIteratorData_th",
+                "/jdk.localedata/sun/text/resources/ext/LineBreakIteratorData_th",
+                "/jdk.localedata/sun/text/resources/ext/thai_dict",
+                "/jdk.localedata/sun/text/resources/ext/WordBreakIteratorData_th",
                 "/jdk.localedata/sun/text/resources/ext/BreakIteratorInfo_th.class",
-                "/jdk.localedata/sun/text/resources/ext/BreakIteratorRules_th.class",
                 "/jdk.localedata/sun/text/resources/ext/FormatData_en_GB.class",
                 "/jdk.localedata/sun/text/resources/ext/FormatData_ja.class",
                 "/jdk.localedata/sun/text/resources/ext/FormatData_th.class",