--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImageFileCreator.java Tue Mar 29 12:43:15 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImageFileCreator.java Tue Mar 29 17:06:33 2016 -0700
@@ -46,6 +46,7 @@
import jdk.tools.jlink.internal.Archive.Entry.EntryType;
import jdk.tools.jlink.internal.PoolImpl.CompressedModuleData;
import jdk.tools.jlink.plugin.ExecutableImage;
+import jdk.tools.jlink.plugin.PluginException;
import jdk.tools.jlink.plugin.Pool;
import jdk.tools.jlink.plugin.Pool.ModuleData;
import jdk.tools.jlink.plugin.Pool.ModuleDataType;
@@ -183,6 +184,8 @@
PoolImpl resultResources;
try {
resultResources = pluginSupport.visitResources(allContent);
+ } catch (PluginException pe) {
+ throw pe;
} catch (Exception ex) {
throw new IOException(ex);
}
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/IncludeLocalesPlugin.java Tue Mar 29 12:43:15 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/IncludeLocalesPlugin.java Tue Mar 29 17:06:33 2016 -0700
@@ -92,6 +92,7 @@
"*sun/text/resources/cldr/ext/[^\\/]+_%%.class," +
"*sun/util/resources/cldr/ext/[^\\/]+_%%.class,";
private Predicate<String> predicate;
+ private String userParam;
private List<Locale.LanguageRange> priorityList;
private List<Locale> available;
private List<String> filtered;
@@ -155,13 +156,17 @@
@Override
public void configure(Map<String, String> config) {
- try {
- priorityList = Arrays.stream(config.get(NAME).split(","))
- .map(Locale.LanguageRange::new)
- .collect(Collectors.toList());
- } catch (IllegalArgumentException iae) {
- throw new PluginException(iae.getLocalizedMessage());
- }
+ userParam = config.get(NAME);
+ priorityList = Arrays.stream(userParam.split(","))
+ .map(s -> {
+ try {
+ return new Locale.LanguageRange(s);
+ } catch (IllegalArgumentException iae) {
+ throw new PluginException(String.format(
+ PluginsResourceBundle.getMessage(NAME + ".invalidtag"), s));
+ }
+ })
+ .collect(Collectors.toList());
}
@Override
@@ -191,7 +196,8 @@
filtered = filterLocales(available);
if (filtered.isEmpty()) {
- throw new PluginException(PluginsResourceBundle.getMessage(NAME + ".nomatchinglocales"));
+ throw new PluginException(
+ String.format(PluginsResourceBundle.getMessage(NAME + ".nomatchinglocales"), userParam));
}
try {
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins.properties Tue Mar 29 12:43:15 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins.properties Tue Mar 29 17:06:33 2016 -0700
@@ -20,7 +20,7 @@
Level 1: ZIP\n\
Level 2: both.\n\
An optional filter can be specified to list the pattern of files to be filtered.\n\
-Use ^ for negation. eg: *Exception.class,*Error.class,^/java.base/java/lang/*
+Use ^ for negation. e.g.: *Exception.class,*Error.class,^/java.base/java/lang/*
compact-cp.argument=<resource paths>
@@ -32,17 +32,17 @@
copy-files.description=\
If files to copy are not absolute path, JDK home dir is used.\n\
-eg: jrt-fs.jar,LICENSE,/home/me/myfile.txt=somewehere/conf.txt
+e.g.: jrt-fs.jar,LICENSE,/home/me/myfile.txt=somewehere/conf.txt
exclude-files.argument=<files to exclude | files of excluded files>
exclude-files.description=\
-Specify files to exclude. eg: *.diz, /java.base/native/client/*
+Specify files to exclude. e.g.: *.diz, /java.base/native/client/*
exclude-resources.argument=<resources to exclude | file of excluded resources>
exclude-resources.description=\
-Specify resources to exclude. eg: *.jcov, */META-INF/*
+Specify resources to exclude. e.g.: *.jcov, */META-INF/*
installed-modules.description=Fast loading of module descriptors (always enabled)
@@ -51,7 +51,7 @@
sort-resources.argument=<paths in priority order | file with resource paths>
sort-resources.description=\
-Sort resources. eg: */modules-info.class,/java-base/java/lang/*
+Sort resources. e.g.: */modules-info.class,/java-base/java/lang/*
strip-debug.description=\
Strip debug information from the output image
@@ -73,13 +73,16 @@
include-locales.description=\
BCP 47 language tags separated by a comma, allowing locale matching\n\
-defined in RFC 4647. eg: en,ja,*-IN
+defined in RFC 4647. e.g.: en,ja,*-IN
include-locales.missingpackages=\
Missing locale data packages in jdk.localedata:\n\t
include-locales.nomatchinglocales=\
-No matching locales found. Check the specified pattern.
+No matching locales found for \"%s\". Check the specified pattern.
+
+include-locales.invalidtag=\
+Invalid language tag: %s
main.status.ok=Functional.
--- a/jdk/test/tools/jlink/JLink2Test.java Tue Mar 29 12:43:15 2016 -0700
+++ b/jdk/test/tools/jlink/JLink2Test.java Tue Mar 29 17:06:33 2016 -0700
@@ -101,7 +101,7 @@
.addJmods(helper.getStdJmodsDir())
.addJmods(jar.getParent())
.addMods("bad")
- .call().assertFailure("(\n|\r|.)*Error: jdk.tools.jlink.plugin.PluginException: module-info.class not found for bad module(\n|\r|.)*");
+ .call().assertFailure("(\n|\r|.)*Error: module-info.class not found for bad module(\n|\r|.)*");
try (JarOutputStream out = new JarOutputStream(new FileOutputStream(jar.toFile()))) {
JarEntry entry = new JarEntry("classes");
out.putNextEntry(entry);
@@ -118,7 +118,7 @@
.addJmods(jar.getParent())
.addJars(helper.getStdJmodsDir())
.addMods("bad")
- .call().assertFailure("(\n|\r|.)*Error: jdk.tools.jlink.plugin.PluginException: module-info.class not found for bad module(\n|\r|.)*");
+ .call().assertFailure("(\n|\r|.)*Error: module-info.class not found for bad module(\n|\r|.)*");
}
private static void testSameNames(Helper helper) throws Exception {
--- a/jdk/test/tools/jlink/plugins/IncludeLocalesPluginTest.java Tue Mar 29 12:43:15 2016 -0700
+++ b/jdk/test/tools/jlink/plugins/IncludeLocalesPluginTest.java Tue Mar 29 17:06:33 2016 -0700
@@ -298,17 +298,19 @@
null,
null,
null,
- new PluginException(
- PluginsResourceBundle.getMessage("include-locales.nomatchinglocales"))
- .toString(),
+ new PluginException(String.format(
+ PluginsResourceBundle.getMessage("include-locales.nomatchinglocales"), "xyz"))
+ .getMessage(),
},
// Error case: Invalid argument
- {"--include-locales=zh_HK",
+ {"--include-locales=en,zh_HK",
null,
null,
null,
- "range=zh_hk",
+ new PluginException(String.format(
+ PluginsResourceBundle.getMessage("include-locales.invalidtag"), "zh_HK"))
+ .getMessage(),
},
};