8253761: Wrong URI syntax printed by jar --describe-module

Reviewed-by: alanb
This commit is contained in:
Christian Stein 2020-10-05 18:16:29 +00:00 committed by Alan Bateman
parent b29e1086ac
commit f2f77f7b14
3 changed files with 12 additions and 8 deletions

View File

@ -1737,7 +1737,7 @@ public class Main {
/** Returns an optional containing the effective URI. */
@Override public Optional<String> uriString() {
String uri = (Paths.get(zipFile.getName())).toUri().toString();
uri = "jar:" + uri + "/!" + entry.getName();
uri = "jar:" + uri + "!/" + entry.getName();
return Optional.of(uri);
}
}

View File

@ -269,7 +269,7 @@ public class Basic {
jar("-d --file mr.jar");
String uri = (Paths.get("mr.jar")).toUri().toString();
uri = "jar:" + uri + "/!module-info.class";
uri = "jar:" + uri + "!/module-info.class";
actual = lines(outbytes);
expected = Set.of(
@ -423,7 +423,7 @@ public class Basic {
actual = lines(outbytes);
expected = Set.of(
"releases: 9 10",
"m1 " + uriPrefix + "/!META-INF/versions/9/module-info.class",
"m1 " + uriPrefix + "!/META-INF/versions/9/module-info.class",
"requires java.base mandated",
"exports p",
"main-class p.Main"
@ -434,7 +434,7 @@ public class Basic {
actual = lines(outbytes);
expected = Set.of(
"releases: 9 10",
"m1 " + uriPrefix + "/!META-INF/versions/10/module-info.class",
"m1 " + uriPrefix + "!/META-INF/versions/10/module-info.class",
"requires java.base mandated",
"exports p",
"main-class p.Main"

View File

@ -494,9 +494,9 @@ public class Basic {
"--file=" + modularJar.toString())
.assertSuccess()
.resultChecker(r -> {
// Expect "bar jar:file:/.../!module-info.class"
// Expect "bar jar:file:/...!/module-info.class"
// conceals jdk.test.foo, conceals jdk.test.foo.internal"
String uri = "jar:" + modularJar.toUri().toString() + "/!module-info.class";
String uri = "jar:" + modularJar.toUri().toString() + "!/module-info.class";
assertTrue(r.output.contains("bar " + uri),
"Expecting to find \"bar " + uri + "\"",
"in output, but did not: [" + r.output + "]");
@ -848,10 +848,14 @@ public class Basic {
jar(option,
"--file=" + modularJar.toString())
.assertSuccess()
.resultChecker(r ->
.resultChecker(r -> {
assertTrue(r.output.contains(FOO.moduleName + "@" + FOO.version),
"Expected to find ", FOO.moduleName + "@" + FOO.version,
" in [", r.output, "]")
" in [", r.output, "]");
assertTrue(r.output.contains(modularJar.toUri().toString()),
"Expected to find ", modularJar.toUri().toString(),
" in [", r.output, "]");
}
);
jar(option,