-
Notifications
You must be signed in to change notification settings - Fork 41.2k
jar URLs created using a context URL with our Handler point to the root of the jar rather than an entry #7021
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
Comments
Previously our handler didn't override parseURL or sameFile which resulted in behaviour that differed from that of the JDK's handler. Crucially, this would result in our JarURLConnection being passed a spec that didn't contain a "!/". A knock-on effect of this was that the connection would point to the root of the jar rather than the intended entry. Closes spring-projectsgh-7021
Possible fix: https://github.com/wilkinsona/spring-boot/tree/gh-7021 @philwebb Could you please cast an eye over this one as well? |
I think this is good, although it's pretty hard to be 100% confident. I've merged it. |
And… it broke stuff |
This was without doubt one of my most useless reviews ever. I knew I'd probably messed it up, but panicked because the issue had been open so long and committed it anyway. To make matters worse I did Sorry about that :( |
Uh oh!
There was an error while loading. Please reload this page.
When added to
JarURLConnectionTests
, this test will fail:Note that the
Handler
is aorg.springframework.boot.loader.jar.Handler
. If it is asun.net.www.protocol.jar.Handler
then the test passes. The key difference is what's returned fromgetFile()
of the URL./import.sql
file:/Users/awilkinson/dev/spring/spring-boot/1.4.x/spring-boot-tools/spring-boot-loader/target/junit8413793381285871673/junit3981300331907567187.tmp!/nested.jar!/import.sql
This difference throws out the spec-related logic in
JarURLConnection
. The lack of a!/
leaves theJarURLConnection
with an emptyjarEntryName
, i.e. pointing to the root of the nested jar. As a result, the attempt to get the input stream fails:The text was updated successfully, but these errors were encountered: