8166645: Include locales plugin throws InternalError with "*" specified
Reviewed-by: mchung
This commit is contained in:
parent
0a885c4bc8
commit
03cc993ec4
jdk
src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins
test/tools/jlink/plugins
@ -307,9 +307,10 @@ public final class IncludeLocalesPlugin implements Plugin, ResourcePrevisitor {
|
||||
|
||||
private boolean filterOutUnsupportedTags(byte[] b) {
|
||||
List<Locale> locales;
|
||||
List<String> originalTags = Arrays.asList(new String(b).split(" "));
|
||||
|
||||
try {
|
||||
locales = Arrays.asList(new String(b).split(" ")).stream()
|
||||
locales = originalTags.stream()
|
||||
.filter(tag -> !tag.isEmpty())
|
||||
.map(IncludeLocalesPlugin::tagToLocale)
|
||||
.collect(Collectors.toList());
|
||||
@ -319,6 +320,9 @@ public final class IncludeLocalesPlugin implements Plugin, ResourcePrevisitor {
|
||||
}
|
||||
|
||||
byte[] filteredBytes = filterLocales(locales).stream()
|
||||
// Make sure the filtered language tags do exist in the
|
||||
// original supported tags for compatibility codes, e.g., "iw"
|
||||
.filter(originalTags::contains)
|
||||
.collect(Collectors.joining(" "))
|
||||
.getBytes();
|
||||
|
||||
@ -331,6 +335,11 @@ public final class IncludeLocalesPlugin implements Plugin, ResourcePrevisitor {
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Filter list of locales according to the secified priorityList. Note
|
||||
* that returned list of language tags may include extra ones, such as
|
||||
* compatibility ones (e.g., "iw" -> "iw", "he").
|
||||
*/
|
||||
private List<String> filterLocales(List<Locale> locales) {
|
||||
List<String> ret =
|
||||
Locale.filter(priorityList, locales, Locale.FilteringMode.EXTENDED_FILTERING).stream()
|
||||
|
@ -92,7 +92,7 @@ public class IncludeLocalesPluginTest {
|
||||
|
||||
// Asterisk works exactly the same as above
|
||||
{
|
||||
"*",
|
||||
"--include-locales=*",
|
||||
"jdk.localedata",
|
||||
List.of(
|
||||
"/jdk.localedata/sun/text/resources/ext/FormatData_en_GB.class",
|
||||
|
Loading…
x
Reference in New Issue
Block a user