Skip to content

ZipFileSystem throws "java.util.zip.ZipException: read CEN tables failed" with certain nested jars #38595

Closed
@philwebb

Description

@philwebb

Initially raised in #38592 (comment)

FileSystems.getFileSystem(URI.create("jar:nested:/Users/rdehuyss/Projects/Personal/jobrunr/examples/example-java-mag/target/example-java-mag-1.0-SNAPSHOT.jar"));

throws the following exception (which I can understand from the docs as it is the new format to retrieve resources):

java.lang.IllegalArgumentException: 'path' must contain '/!'
        at org.springframework.boot.loader.net.protocol.nested.NestedLocation.parse(NestedLocation.java:98)
        at org.springframework.boot.loader.net.protocol.nested.NestedLocation.fromUri(NestedLocation.java:89)
        at org.springframework.boot.loader.nio.file.NestedFileSystemProvider.getPath(NestedFileSystemProvider.java:88)
        at java.base/java.nio.file.Path.of(Path.java:208)
        at java.base/java.nio.file.Paths.get(Paths.java:98)
        at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.uriToPath(ZipFileSystemProvider.java:76)
        at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.newFileSystem(ZipFileSystemProvider.java:98)
        at java.base/java.nio.file.FileSystems.newFileSystem(FileSystems.java:339)
        at java.base/java.nio.file.FileSystems.newFileSystem(FileSystems.java:288)

However,

FileSystems.newFileSystem(URI.create("jar:nested:/Users/rdehuyss/Projects/Personal/jobrunr/examples/example-java-mag/target/example-java-mag-1.0-SNAPSHOT.jar/!BOOT-INF/lib/jobrunr-1.0.0-SNAPSHOT.jar"), Collections.emptyMap());

throws the following exception:

java.util.zip.ZipException: read CEN tables failed
        at jdk.zipfs/jdk.nio.zipfs.ZipFileSystem.initCEN(ZipFileSystem.java:1549)
        at jdk.zipfs/jdk.nio.zipfs.ZipFileSystem.<init>(ZipFileSystem.java:174)
        at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.getZipFileSystem(ZipFileSystemProvider.java:125)
        at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.newFileSystem(ZipFileSystemProvider.java:106)
        at java.base/java.nio.file.FileSystems.newFileSystem(FileSystems.java:339)
        at java.base/java.nio.file.FileSystems.newFileSystem(FileSystems.java:288)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions