FULL PRODUCT VERSION :
java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Darwin Maxwells-MacBook-Air 15.2.0 Darwin Kernel Version 15.2.0: Fri Nov 13 19:56:56 PST 2015; root:xnu-3248.20.55~2/RELEASE_X86_64 x86_64
A DESCRIPTION OF THE PROBLEM :
Zip Paths on a Zip File System do not relativize correctly when the path is one level below root.
E.g. "/test/".relativize("/test/me") => "../test/me" (incorrect)
"/test/inner/".relativize("/test/inner/me") => "me" (correct)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
To reproduce this create a zip file somewhere on the file system.
URI uri = URI.create("jar:file:/path/to/the.zip");
FileSystem zipFs = FileSystems.newFileSystem(uri, Collections.emptyMap());
zipFs.getPath("/test/").relativize(zipFs.getPath("/test/inner")).toString()
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
(com.sun.nio.zipfs.ZipPath) inner
ACTUAL -
(com.sun.nio.zipfs.ZipPath) ../test/inner
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public static void main(String[] args) throws IOException {
URI uri = URI.create("jar:file:/path/to/the/test.zip");
FileSystem zipFs = FileSystems.newFileSystem(uri, Collections.emptyMap());
System.out.println(zipFs.getPath("/test/").relativize(zipFs.getPath("/test/inner")));
}
---------- END SOURCE ----------
java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Darwin Maxwells-MacBook-Air 15.2.0 Darwin Kernel Version 15.2.0: Fri Nov 13 19:56:56 PST 2015; root:xnu-3248.20.55~2/RELEASE_X86_64 x86_64
A DESCRIPTION OF THE PROBLEM :
Zip Paths on a Zip File System do not relativize correctly when the path is one level below root.
E.g. "/test/".relativize("/test/me") => "../test/me" (incorrect)
"/test/inner/".relativize("/test/inner/me") => "me" (correct)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
To reproduce this create a zip file somewhere on the file system.
URI uri = URI.create("jar:file:/path/to/the.zip");
FileSystem zipFs = FileSystems.newFileSystem(uri, Collections.emptyMap());
zipFs.getPath("/test/").relativize(zipFs.getPath("/test/inner")).toString()
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
(com.sun.nio.zipfs.ZipPath) inner
ACTUAL -
(com.sun.nio.zipfs.ZipPath) ../test/inner
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public static void main(String[] args) throws IOException {
URI uri = URI.create("jar:file:/path/to/the/test.zip");
FileSystem zipFs = FileSystems.newFileSystem(uri, Collections.emptyMap());
System.out.println(zipFs.getPath("/test/").relativize(zipFs.getPath("/test/inner")));
}
---------- END SOURCE ----------
- relates to
-
JDK-8146754 (zipfs) ZipPath.relativize() returns wrong result for path ending with slash /
-
- Closed
-