Fixed handling of spaces in file paths
Update Launcher to correctly handle spaced in file paths.
This commit is contained in:
parent
8682d7a829
commit
3c5fa0daa0
|
|
@ -18,6 +18,7 @@ package org.springframework.boot.loader;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
|
import java.net.URI;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.security.CodeSource;
|
import java.security.CodeSource;
|
||||||
import java.security.ProtectionDomain;
|
import java.security.ProtectionDomain;
|
||||||
|
|
@ -67,13 +68,12 @@ public abstract class Launcher {
|
||||||
protected void launch(String[] args, ProtectionDomain protectionDomain)
|
protected void launch(String[] args, ProtectionDomain protectionDomain)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
CodeSource codeSource = protectionDomain.getCodeSource();
|
CodeSource codeSource = protectionDomain.getCodeSource();
|
||||||
URL codeSourceLocation = (codeSource == null ? null : codeSource.getLocation());
|
URI location = (codeSource == null ? null : codeSource.getLocation().toURI());
|
||||||
String codeSourcePath = (codeSourceLocation == null ? null : codeSourceLocation
|
String path = (location == null ? null : location.getPath());
|
||||||
.getPath());
|
if (path == null) {
|
||||||
if (codeSourcePath == null) {
|
|
||||||
throw new IllegalStateException("Unable to determine code source archive");
|
throw new IllegalStateException("Unable to determine code source archive");
|
||||||
}
|
}
|
||||||
File root = new File(codeSourcePath);
|
File root = new File(path);
|
||||||
if (!root.exists()) {
|
if (!root.exists()) {
|
||||||
throw new IllegalStateException(
|
throw new IllegalStateException(
|
||||||
"Unable to determine code source archive from " + root);
|
"Unable to determine code source archive from " + root);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue