From 7654259f80d0f5babbaf05ca341de02821c3907d Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Wed, 25 Jun 2014 14:32:31 -0700 Subject: [PATCH] Fix JarFile issues when running on Windows Fix 'fat jar' support for windows to correctly deal with URL and path slash issues. The root cause of the original problem was caused by JAR URLs not including a root slash (ie `file:C:/Users` vs `file:/C:/Users`) Fixes gh-1145 --- .../boot/loader/jar/JarFile.java | 57 ++++++------------- .../loader/archive/ExplodedArchiveTests.java | 5 +- .../loader/archive/JarFileArchiveTests.java | 8 ++- .../boot/loader/jar/JarFileTests.java | 35 ++++++------ 4 files changed, 42 insertions(+), 63 deletions(-) diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarFile.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarFile.java index 907c4767ee2..2477d629235 100644 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarFile.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarFile.java @@ -70,7 +70,7 @@ public class JarFile extends java.util.jar.JarFile implements Iterable entries, JarEntryFilter... filters) throws IOException { + private JarFile(RandomAccessDataFile rootFile, String pathFromRoot, + RandomAccessData data, List entries, JarEntryFilter... filters) + throws IOException { super(rootFile.getFile()); this.rootFile = rootFile; - this.name = name; + this.pathFromRoot = pathFromRoot; this.data = data; this.entries = filterEntries(entries, filters); } @@ -364,7 +365,7 @@ public class JarFile extends java.util.jar.JarFile implements Iterable