Skip to content

Nested jar URLs cannot be split and reassembled resulting in errors with projects that use this technique (such as JobRunr) #38592

@rdehuyss

Description

@rdehuyss

Hi, I'm Ronald, the creator of JobRunr.

An issue was reported to us regarding the new nested jar support which broke JobRunr as it reads files from the classpath.

Inside an Uber jar, it is currently impossible to list the files within a directory using a NIO FileSystemProvider

I would expect the following to work:

var url = ((JarURLConnection)H2StorageProvider.class.getResource("migrations").openConnection()).getJarFileURL(); FileSystem fileSystem = FileSystems.newFileSystem(url.toURI(), Collections.emptyMap()); Path path = fileSystem.getPath("BOOT-INF/lib/jobrunr-6.3.3.jar!/org/jobrunr/storage/sql/common/migrations/"); boolean exists = Files.exists(path); List<Path> list = Files.list(path).collect(Collectors.toList()); return "Root exists: " + exists + "; contents: " + list;

The FileSystem returned is of type class org.springframework.boot.loader.nio.file.NestedFileSystem.

For a reproducible scenario, please see https://github.com/rdehuyss/spring-boot-3.2-nested-jar-issue

Metadata

Metadata

Assignees

Labels

type: regressionA regression from a previous release

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions