-
Notifications
You must be signed in to change notification settings - Fork 40.8k
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
Rewrite nested jar support code and remove Java 8 support #37668
Comments
Rewrite nested jar code to better align with the implementations provided in Java 17. This update makes two fundamental changes to the previous implementation: - Resource cleanup is now handled using the `java.lang.ref.Cleaner` - Jar URLs now use the form `jar:nested:/my.jar/!nested.jar!/entry` Unlike the previous `jar:jar:/my,jar!/nested.jar!/entry` URL format, the new format is compatible with Java's default Jar URL handler. Specifically, it now only uses a single `jar:` prefix and it no longer includes multiple `!/` separators. In addition to the changes above, many of the ancillary classes have also been refactored and updated to create cleaner APIs. Closes spring-projectsgh-37668
Attempt to fix CI failures caused by timezone differences and different JDK versions. See gh-37668
Reopening due to Windows build issues:
|
Update `NestedJarFile.close()` to call `super.close()` so that the outer jar file is closed and files can hopefully be deleted on Windows. See gh-37668
Update `DefaultCleanerTracking` and `@AssertFileChannelDataBlocksClosed` to capture and store the source object if it is a `Cleanable` so that it can be released later. Although the real cleaner cannot keep a reference to `obj`, it is safe for us to do so in tests since we are in control of the object lifecycle and we don't need it to be garbage collected. This commit also updates the `UrlJarFile` to call the cleaner so that it can be tracked. See gh-37668
The Windows build is now fixed. |
Refactor `NestedLocation` so that it holds a `Path` rather than a `File`. See gh-37668
Hi, I was using
etc etc. What I need it a handle to all of the jars. Thanks! |
The new class you want to use is probably |
Thank you so much for the quick response @philwebb ! So I can use new |
@harveycggit Nesting can only be one level deep. You can't have a nested jar inside a nested jar, you can only have a nested jar inside a regular jar. |
@philwebb thank you again for the response. The NestedJarFileConstructor says it will take null for a resource name:
However, it then calls a constructor that throws the following error if you pass null: So, when I am initially loading the resources I am not looking for a particular entry; I need to iterate through all jars and look for classes that implement some interfaces and so on. What should I be passing with the initial load? new NestedJarFile(home.getSource(), ???) Thanks again! |
That's a mistake in the Javadoc I think. I originally supported null but then changed my mind about it. I'd recommend using the regular JDK |
Do you have any performance test data? |
Our current nested jar support is pretty complicated due to support for earlier versions of Java. There are also a lot of bugs that we're unable to fix with the current implementation. Rewriting our implementation would help us a great deal going forward.
The text was updated successfully, but these errors were encountered: