diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/NestedJarFile.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/NestedJarFile.java index 2fe35c46c16..d711b9137a5 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/NestedJarFile.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/NestedJarFile.java @@ -230,7 +230,7 @@ public class NestedJarFile extends JarFile { } ZipContent.Entry entry = getVersionedContentEntry(name); if (entry != null) { - return false; + return true; } synchronized (this) { ensureOpen(); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/net/protocol/jar/UrlJarFileFactory.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/net/protocol/jar/UrlJarFileFactory.java index 7a45caea98a..35ba9283ca9 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/net/protocol/jar/UrlJarFileFactory.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/net/protocol/jar/UrlJarFileFactory.java @@ -58,7 +58,12 @@ class UrlJarFileFactory { } 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) {