Skip to content

Commit f2f77f7

Browse files
sormurasAlan Bateman
authored and
Alan Bateman
committedOct 5, 2020
8253761: Wrong URI syntax printed by jar --describe-module
Reviewed-by: alanb
1 parent b29e108 commit f2f77f7

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed
 

‎src/jdk.jartool/share/classes/sun/tools/jar/Main.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1737,7 +1737,7 @@ static class ZipFileModuleInfoEntry implements ModuleInfoEntry {
17371737
/** Returns an optional containing the effective URI. */
17381738
@Override public Optional<String> uriString() {
17391739
String uri = (Paths.get(zipFile.getName())).toUri().toString();
1740-
uri = "jar:" + uri + "/!" + entry.getName();
1740+
uri = "jar:" + uri + "!/" + entry.getName();
17411741
return Optional.of(uri);
17421742
}
17431743
}

‎test/jdk/tools/jar/mmrjar/Basic.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ public void test5() throws IOException {
269269
jar("-d --file mr.jar");
270270

271271
String uri = (Paths.get("mr.jar")).toUri().toString();
272-
uri = "jar:" + uri + "/!module-info.class";
272+
uri = "jar:" + uri + "!/module-info.class";
273273

274274
actual = lines(outbytes);
275275
expected = Set.of(
@@ -423,7 +423,7 @@ public void test7() throws IOException {
423423
actual = lines(outbytes);
424424
expected = Set.of(
425425
"releases: 9 10",
426-
"m1 " + uriPrefix + "/!META-INF/versions/9/module-info.class",
426+
"m1 " + uriPrefix + "!/META-INF/versions/9/module-info.class",
427427
"requires java.base mandated",
428428
"exports p",
429429
"main-class p.Main"
@@ -434,7 +434,7 @@ public void test7() throws IOException {
434434
actual = lines(outbytes);
435435
expected = Set.of(
436436
"releases: 9 10",
437-
"m1 " + uriPrefix + "/!META-INF/versions/10/module-info.class",
437+
"m1 " + uriPrefix + "!/META-INF/versions/10/module-info.class",
438438
"requires java.base mandated",
439439
"exports p",
440440
"main-class p.Main"

‎test/jdk/tools/jar/modularJar/Basic.java

+8-4
Original file line numberDiff line numberDiff line change
@@ -494,9 +494,9 @@ public void partialUpdateFooModuleInfo() throws IOException {
494494
"--file=" + modularJar.toString())
495495
.assertSuccess()
496496
.resultChecker(r -> {
497-
// Expect "bar jar:file:/.../!module-info.class"
497+
// Expect "bar jar:file:/...!/module-info.class"
498498
// conceals jdk.test.foo, conceals jdk.test.foo.internal"
499-
String uri = "jar:" + modularJar.toUri().toString() + "/!module-info.class";
499+
String uri = "jar:" + modularJar.toUri().toString() + "!/module-info.class";
500500
assertTrue(r.output.contains("bar " + uri),
501501
"Expecting to find \"bar " + uri + "\"",
502502
"in output, but did not: [" + r.output + "]");
@@ -848,10 +848,14 @@ public void describeModuleFoo() throws IOException {
848848
jar(option,
849849
"--file=" + modularJar.toString())
850850
.assertSuccess()
851-
.resultChecker(r ->
851+
.resultChecker(r -> {
852852
assertTrue(r.output.contains(FOO.moduleName + "@" + FOO.version),
853853
"Expected to find ", FOO.moduleName + "@" + FOO.version,
854-
" in [", r.output, "]")
854+
" in [", r.output, "]");
855+
assertTrue(r.output.contains(modularJar.toUri().toString()),
856+
"Expected to find ", modularJar.toUri().toString(),
857+
" in [", r.output, "]");
858+
}
855859
);
856860

857861
jar(option,

0 commit comments

Comments
 (0)
Please sign in to comment.