Skip to content

Commit 6f6337d

Browse files
author
Dave Syer
committed
Be defensive about JarFileArchive creation
It doesn't make any difference with the old versions of Spring Boot that we depend on here, but if we ever upgrade (or if a newer version is on the classpath at runtime) the URL of a JarFileArchive is incorrectly computed without this change.
1 parent 4e1240b commit 6f6337d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

launcher/src/main/java/org/springframework/boot/loader/thin/ArchiveUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import java.util.ArrayList;
2424
import java.util.Arrays;
2525
import java.util.List;
26-
import java.util.jar.JarFile;
2726
import java.util.jar.Manifest;
2827

2928
import org.eclipse.aether.artifact.DefaultArtifact;
@@ -32,6 +31,7 @@
3231
import org.springframework.boot.loader.archive.Archive;
3332
import org.springframework.boot.loader.archive.ExplodedArchive;
3433
import org.springframework.boot.loader.archive.JarFileArchive;
34+
import org.springframework.boot.loader.jar.JarFile;
3535
import org.springframework.boot.loader.tools.MainClassFinder;
3636
import org.springframework.core.io.UrlResource;
3737

@@ -52,7 +52,7 @@ public static Archive getArchive(String path) {
5252
return new ExplodedArchive(file);
5353
}
5454
try {
55-
return new JarFileArchive(file);
55+
return new JarFileArchive(new JarFile(file));
5656
}
5757
catch (IOException e) {
5858
throw new IllegalStateException("Cannot create JAR archive: " + file, e);

0 commit comments

Comments
 (0)