8206962: jlink --release-info=del throws NPE if no keys are specified

Reviewed-by: alanb
This commit is contained in:
Athijegannathan Sundararajan 2018-12-05 19:22:04 +05:30
parent e03d20eb41
commit 3883078d21
2 changed files with 16 additions and 1 deletions
src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins
test/jdk/tools/jlink

@ -108,7 +108,11 @@ public final class ReleaseInfoPlugin implements Plugin {
case "del": {
// --release-info del:keys=openjdk,java_version
Utils.parseList(config.get(KEYS)).stream().forEach((k) -> {
String keys = config.get(KEYS);
if (keys == null || keys.isEmpty()) {
throw new IllegalArgumentException("No key specified for delete");
}
Utils.parseList(keys).stream().forEach((k) -> {
release.remove(k);
});
}

@ -44,6 +44,7 @@ import tests.JImageGenerator;
* @summary Test image creation
* @bug 8189777
* @bug 8194922
* @bug 8206962
* @author Jean-Francois Denise
* @requires (vm.compMode != "Xcomp" & os.maxMemory >= 2g)
* @library ../lib
@ -344,6 +345,16 @@ public class JLinkTest {
.option("--help")
.call().assertSuccess();
}
{
String imageDir = "bug8206962";
JImageGenerator.getJLinkTask()
.modulePath(helper.defaultModulePath())
.output(helper.createNewImageDir(imageDir))
.addMods("java.base")
.option("--release-info=del")
.call().assertFailure("Error: No key specified for delete");
}
}
private static void testCompress(Helper helper, String moduleName, String... userOptions) throws IOException {