Skip to content

Commit 6028d92

Browse files
committed
Support Windows UNC paths with fat jars
Update `Launcher` and `JarFile` to correctly deal with Windows UNC paths. Fixes gh-1641
1 parent 6009f41 commit 6028d92

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/Launcher.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ protected final Archive createArchive() throws Exception {
142142
ProtectionDomain protectionDomain = getClass().getProtectionDomain();
143143
CodeSource codeSource = protectionDomain.getCodeSource();
144144
URI location = (codeSource == null ? null : codeSource.getLocation().toURI());
145-
String path = (location == null ? null : location.getPath());
145+
String path = (location == null ? null : location.getSchemeSpecificPart());
146146
if (path == null) {
147147
throw new IllegalStateException("Unable to determine code source archive");
148148
}

spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/JarFile.java

+1
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,7 @@ public URL getUrl() throws MalformedURLException {
424424
if (this.url == null) {
425425
Handler handler = new Handler(this);
426426
String file = this.rootFile.getFile().toURI() + this.pathFromRoot + "!/";
427+
file = file.replace("file:////", "file://"); // Fix UNC paths
427428
this.url = new URL("jar", "", -1, file, handler);
428429
}
429430
return this.url;

0 commit comments

Comments
 (0)