Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Core] Support nested jar file systems #2830

Merged
merged 1 commit into from Dec 11, 2023
Merged

Conversation

mpkorstanje
Copy link
Contributor

🤔 What's changed?

Spring Boot 3.2 changed the URL format of their nested jars[1] to be more compliant with JDK expectations. They now represented nested jars as their own nested scheme rather than the file scheme. This allows these URLs to be used seamlessly with FileSystems.newFileSystem.

Unfortunately the workarounds for Spring Boot 3.1 did not account for this.

Additionally, our jar uri parsing assumed naively that there would only be a single !/ in a regular jar uri. However, jar uris are recursively defined as[2]:

jar:<url>!/[<entry>]

And while this should allow Cucumber to discover resources in nested jars as well it does seem that Spring Boot 3.2 still has some issues[3].

  1. https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.2-Release-Notes
  2. https://www.iana.org/assignments/uri-schemes/prov/jar
  3. ZipFileSystem throws "java.util.zip.ZipException: read CEN tables failed" with certain nested jars spring-projects/spring-boot#38595

Closes: #2828

🏷️ What kind of change is this?

  • ⚡ New feature (non-breaking change which adds new behaviour)

📋 Checklist:

  • I agree to respect and uphold the Cucumber Community Code of Conduct
  • I've changed the behaviour of the code
    • I have added/updated tests to cover my changes.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • Users should know about my change
    • I have added an entry to the "Unreleased" section of the CHANGELOG, linking to this pull request.

Copy link

codecov bot commented Dec 10, 2023

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (3ae7af5) 84.95% compared to head (bea8cca) 84.97%.

Files Patch % Lines
...ucumber/core/resource/JarUriFileSystemService.java 85.71% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #2830      +/-   ##
============================================
+ Coverage     84.95%   84.97%   +0.01%     
- Complexity     2724     2728       +4     
============================================
  Files           331      331              
  Lines          9539     9545       +6     
  Branches        916      917       +1     
============================================
+ Hits           8104     8111       +7     
+ Misses         1110     1109       -1     
  Partials        325      325              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Spring Boot 3.2 changed the URL format of their nested jars[1] to be
more compliant with JDK expectations. They now represented nested jars
as their own `nested` scheme rather than the `file` scheme. This allows
these URLs to be used seamlessly with `FileSystems.newFileSystem`.

Unfortunately the workarounds for Spring Boot 3.1 did not account for
this.

Additionally, our jar uri parsing assumed naively that there would only
be a single `!/` in a regular jar uri. However, jar uris are
recursively defined as[2]:

```
jar:<url>!/[<entry>]
```

And while this should allow Cucumber to discover resources in nested
jars as well it does seem that Spring Boot 3.2 still has some issues[3].

Closes: #2828

1. https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.2-Release-Notes
2. https://www.iana.org/assignments/uri-schemes/prov/jar
3. spring-projects/spring-boot#38595
@mpkorstanje mpkorstanje merged commit 6c4a910 into main Dec 11, 2023
9 checks passed
@mpkorstanje mpkorstanje deleted the support-nested-jars branch December 11, 2023 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot find features on classpath inside Spring Boot 3.2.0 uberjar
1 participant