8167328: jar -d m.jar hangs

Reviewed-by: alanb, mchung, chegar
This commit is contained in:
Xueming Shen 2016-12-01 15:42:22 -08:00
parent a785d65035
commit 689077a9da
3 changed files with 17 additions and 0 deletions

View File

@ -774,6 +774,12 @@ class Main {
/* parse file arguments */
int n = args.length - count;
if (n > 0) {
if (printModuleDescriptor) {
// "--print-module-descriptor/-d" does not require file argument(s)
error(formatMsg("error.bad.dflag", args[count]));
usageError();
return false;
}
int version = BASE_VERSION;
int k = 0;
String[] nameBuf = new String[n];

View File

@ -44,6 +44,8 @@ error.bad.uflag=\
error.bad.eflag=\
'e' flag and manifest with the 'Main-Class' attribute cannot be specified \n\
together!
error.bad.dflag=\
'-d, --print-module-descriptor' option requires no input file(s) to be specified: {0}
error.nosuch.fileordir=\
{0} : no such file or directory
error.write.file=\

View File

@ -46,6 +46,7 @@ import static java.lang.System.out;
/*
* @test
* @bug 8167328
* @library /lib/testlibrary
* @modules jdk.compiler
* jdk.jartool
@ -756,6 +757,14 @@ public class Basic {
"Expected to find ", FOO.moduleName + "@" + FOO.version,
" in [", r.output, "]")
);
jar(option,
"--file=" + modularJar.toString(),
modularJar.toString())
.assertFailure();
jar(option, modularJar.toString())
.assertFailure();
}
}