Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8253761: Wrong URI syntax printed by jar --describe-module
Reviewed-by: alanb
  • Loading branch information
sormuras authored and Alan Bateman committed Oct 5, 2020
1 parent b29e108 commit f2f77f7b1487e5080641fd4c72766ac774c21f98
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
@@ -1737,7 +1737,7 @@ static class ZipFileModuleInfoEntry implements ModuleInfoEntry {
/** 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);
}
}
@@ -269,7 +269,7 @@ public void test5() throws IOException {
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 void test7() throws IOException {
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 void test7() throws IOException {
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"
@@ -494,9 +494,9 @@ public void partialUpdateFooModuleInfo() throws IOException {
"--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 void describeModuleFoo() throws IOException {
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,

0 comments on commit f2f77f7

Please sign in to comment.