Skip to content

Commit

Permalink
Use constant from quoted string
Browse files Browse the repository at this point in the history
  • Loading branch information
douph1 committed Apr 18, 2019
1 parent c6e5a26 commit 12fb5df
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ public interface IcedTeaWebConstants {
String DEFAULT_ERROR_MESSAGE = "ERROR";

String SYSTEM_PROPERTY_JAVA_VERSION = "java.version";

static final String DOUBLE_QUOTE = "\"";
}
2 changes: 1 addition & 1 deletion core/src/main/java/net/sourceforge/jnlp/runtime/Boot.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -169,4 +169,8 @@ private static enum ManageMode {
A
}

private String quoted(URL url) {
return IcedTeaWebConstants.DOUBLE_QUOTE + url + IcedTeaWebConstants.DOUBLE_QUOTE;
}

}

0 comments on commit 12fb5df

Please sign in to comment.