-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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 Quarkus ClassLoader's jar ProtectionDomain handling #11970
Conversation
@stuartwdouglas I assume that the current code was just the result of a bug? Or did you have something specific in mind? |
The CI is due to this PR - looking at it now |
CI issue should now be fixed - Pinging @jaikiran as well since I made a change to his code |
I'm a bit surprised that it's failing in JRE, because from what I can tell, I don't think the current code in |
@jaikiran #11549 (comment) (which I was able to reproduce) was the reason I made this change |
I could reproduce this outside of Quarkus in a simple Java class. So I asked for inputs from the JDK team[1]. The initial assessment is that, the construct used by Kotlin(?) and that other library in the linked issue:
isn't expected to work when the URL in question is a So I went ahead and tried out simple test to see how URLClassLoader behaves when it comes to So this change looks fine to me. [1] https://mail.openjdk.java.net/pipermail/net-dev/2020-September/014389.html |
Awesome, thanks for the great analysis @jaikiran! |
@@ -217,7 +218,8 @@ void registerExchangeAttributeBuilders(final BuildProducer<ServiceProviderBuildI | |||
logger.debug("Skipping registration of service providers for " + ExchangeAttributeBuilder.class); | |||
return; | |||
} | |||
try (final FileSystem jarFileSystem = ZipUtils.newFileSystem(codeSource.getLocation().toURI(), | |||
try (final FileSystem jarFileSystem = ZipUtils.newFileSystem( | |||
new URI("jar", codeSource.getLocation().toURI().toString(), null), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These URI
/URL
APIs are sometimes a bit too complex and I usually have to go back read their docs multiple times and even try out a few things to be sure that whatever construct is being used/changed will work fine without issues. So, I'm unsure if this change will cause any issues. However, given that this specific area of code has relevant tests[1] that cover Java 8, 11, 14 and even native-image, we can go ahead with this change if the CI shows all green.
[1] #9474
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed :)
CI failure seems totally unrelated, but since this change could potentially have a wide impact, I will restart CI since I want to be totally sure |
@stuartwdouglas I let you check this one? I will backport it tomorrow morning. |
Bring it inline with what
URLClassLoader
doesFixes: #11549