mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Open loader jar URLs by default using runtimeVersion
Update `UrlJarFileFactory` so that `runtimeVersion` is used by default instead of `baseVersion`. Prior to this commit we tried to mirror the JDK handler on look for a `#runtime` fragment. This unfortunately doesn't work with the URLs produced by `URLClassPath`. This commit also fixes a bug in `NestedJarFile` where we didn't return the correct result from `hasEntry`. Fixes gh-38050
This commit is contained in:
parent
464523ac04
commit
b35c4d6497
@ -230,7 +230,7 @@ public class NestedJarFile extends JarFile {
|
|||||||
}
|
}
|
||||||
ZipContent.Entry entry = getVersionedContentEntry(name);
|
ZipContent.Entry entry = getVersionedContentEntry(name);
|
||||||
if (entry != null) {
|
if (entry != null) {
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
ensureOpen();
|
ensureOpen();
|
||||||
|
@ -58,7 +58,12 @@ class UrlJarFileFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Runtime.Version getVersion(URL url) {
|
private Runtime.Version getVersion(URL url) {
|
||||||
return "runtime".equals(url.getRef()) ? JarFile.runtimeVersion() : JarFile.baseVersion();
|
// The standard JDK handler uses #runtime to indicate that the runtime version
|
||||||
|
// should be used. This unfortunately doesn't work for us as
|
||||||
|
// jdk.internal.loaderURLClassPath only adds the runtime fragment when the URL
|
||||||
|
// is using the internal JDK handler. We need to flip the default to use
|
||||||
|
// the runtime version. See gh-38050
|
||||||
|
return "base".equals(url.getRef()) ? JarFile.baseVersion() : JarFile.runtimeVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isLocalFileUrl(URL url) {
|
private boolean isLocalFileUrl(URL url) {
|
||||||
|
Loading…
Reference in New Issue
Block a user