diff --git a/common/src/main/java/net/adoptopenjdk/icedteaweb/IcedTeaWebConstants.java b/common/src/main/java/net/adoptopenjdk/icedteaweb/IcedTeaWebConstants.java index b158fa6d2..b52dbdbd0 100644 --- a/common/src/main/java/net/adoptopenjdk/icedteaweb/IcedTeaWebConstants.java +++ b/common/src/main/java/net/adoptopenjdk/icedteaweb/IcedTeaWebConstants.java @@ -10,4 +10,6 @@ public interface IcedTeaWebConstants { String DEFAULT_ERROR_MESSAGE = "ERROR"; String SYSTEM_PROPERTY_JAVA_VERSION = "java.version"; + + static final String DOUBLE_QUOTE = "\""; } diff --git a/core/src/main/java/net/sourceforge/jnlp/runtime/Boot.java b/core/src/main/java/net/sourceforge/jnlp/runtime/Boot.java index e0f7b1495..2399d561b 100644 --- a/core/src/main/java/net/sourceforge/jnlp/runtime/Boot.java +++ b/core/src/main/java/net/sourceforge/jnlp/runtime/Boot.java @@ -347,7 +347,7 @@ private static String getMainFile() throws InvalidArgumentException { } private static String stripDoubleQuote(String path) { - if (path.length() >= 2 && path.charAt(0) == '"' && path.charAt(path.length() - 1) == '"') + if (path.length() >= 2 && IcedTeaWebConstants.DOUBLE_QUOTE.equals(path.charAt(0)) && IcedTeaWebConstants.DOUBLE_QUOTE.equals(path.charAt(path.length() - 1))); { path = path.substring(1, path.length() - 1); } diff --git a/core/src/main/java/net/sourceforge/jnlp/util/WindowsDesktopEntry.java b/core/src/main/java/net/sourceforge/jnlp/util/WindowsDesktopEntry.java index 2833f38f5..e76858173 100644 --- a/core/src/main/java/net/sourceforge/jnlp/util/WindowsDesktopEntry.java +++ b/core/src/main/java/net/sourceforge/jnlp/util/WindowsDesktopEntry.java @@ -63,7 +63,7 @@ public File getDesktopIconFile() { public void createShortcutOnWindowsDesktop() throws IOException { String path = getDesktopLnkPath(); String JavaWsBin = XDesktopEntry.getJavaWsBin(); - ShellLink sl = ShellLink.createLink(JavaWsBin).setCMDArgs('"' + file.getSourceLocation().toString() + '"'); + ShellLink sl = ShellLink.createLink(JavaWsBin).setCMDArgs(quoted(file.getSourceLocation())); if (iconLocation != null) { sl.setIconLocation(iconLocation); } @@ -94,9 +94,9 @@ public void createWindowsMenu() throws IOException { menuDir.mkdir(); } final String JavaWsBin = XDesktopEntry.getJavaWsBin(); - final ShellLink sl = ShellLink.createLink(JavaWsBin).setCMDArgs('"' + file.getSourceLocation().toString() + '"'); + final ShellLink sl = ShellLink.createLink(JavaWsBin).setCMDArgs(quoted(file.getSourceLocation())); // setup uninstall shortcut - final ShellLink ul = ShellLink.createLink(JavaWsBin).setCMDArgs("-Xclearcache " + '"' + file.getFileLocation().toString() + '"'); + final ShellLink ul = ShellLink.createLink(JavaWsBin).setCMDArgs("-Xclearcache " + quoted(file.getFileLocation())); if (iconLocation != null) { sl.setIconLocation(iconLocation); ul.setIconLocation(iconLocation); @@ -169,4 +169,8 @@ private static enum ManageMode { A } + private String quoted(URL url) { + return IcedTeaWebConstants.DOUBLE_QUOTE + url + IcedTeaWebConstants.DOUBLE_QUOTE; + } + }