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

Fix parsing of recursive JAR URIs in CloseablePath #3606

Merged
merged 4 commits into from
Feb 25, 2024

Conversation

mpkorstanje
Copy link
Contributor

@mpkorstanje mpkorstanje commented Dec 17, 2023

Overview

Jar uris follow the format[1]:

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

So splitting should be done on the last !/ rather than the first.

Fixes: #1724 for Spring Boot 3.2 and later.

  1. https://docs.oracle.com/javase/8/docs/api/java/net/JarURLConnection.html

I hereby agree to the terms of the JUnit Contributor License Agreement.


Definition of Done

@mpkorstanje
Copy link
Contributor Author

Verified end-2-end using https://github.com/mpkorstanje/junit-5-spring-boot-3.2.0.

@mpkorstanje mpkorstanje changed the title Fix jar uri parsing in CloseablePath Fix parsing of recursive jar uris Dec 17, 2023
Jar uris follow the format[1]:

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

So splitting should be done on the last `!/` rather than the first.

Fixes: junit-team#1724 for Spring Boot 3.2 and later.

 1. https://docs.oracle.com/javase/8/docs/api/java/net/JarURLConnection.html
@mpkorstanje mpkorstanje marked this pull request as ready for review December 17, 2023 10:13
@sbrannen sbrannen changed the title Fix parsing of recursive jar uris Fix parsing of recursive JAR URIs in CloseablePath Dec 17, 2023
@sbrannen sbrannen added this to the 5.11 M1 milestone Dec 17, 2023
@sbrannen
Copy link
Member

Thanks for the PR, @mpkorstanje. 👍

Any chance you want to make nested JAR scanning work for Spring Boot versions prior to Spring Boot 3.2 as well (in a separate PR)? 😎

@mpkorstanje
Copy link
Contributor Author

Any chance you want to make nested JAR scanning work for Spring Boot versions prior to Spring Boot 3.2 as well (in a separate PR)? 😎

The general case? No chance. 😄

Spring Boot 3.1 has only 6 months of OSS support left. For the amount of effort involved, it would be gilding a dead lilly.

The specific case of supporting scanning of /BOOT-INF/classes isn't too difficult. That mostly depends on how much of a code blister you're willing to accept. I've put a proposal in #1724 (comment). If that doesn't look too bad, I could polish it up into a PR.

@marcphilipp marcphilipp modified the milestones: 5.11 M1, 5.10.2 Dec 18, 2023
@marcphilipp marcphilipp self-assigned this Feb 2, 2024
@marcphilipp marcphilipp merged commit 3923fd7 into junit-team:main Feb 25, 2024
13 checks passed
@marcphilipp
Copy link
Member

@mpkorstanje Thanks! 👍

@mpkorstanje mpkorstanje deleted the fix-jar-uri-parsing branch February 25, 2024 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tests not found via classpath scanning within nested JAR in Spring Boot JAR
3 participants