@Test public void testUnqotedClasspathWithSpaces() { final String classpathWithSpaces = "c:\\Program Files\\OpenWebStart\\javaws.jar"; final String expectedWindows = "\"c:\\Program Files\\OpenWebStart\\javaws.jar\""; final String expectedUnix = "c:\\Program Files\\OpenWebStart\\javaws.jar"; final String transformed = PathQuoteUtil.quoteIfRequired(classpathWithSpaces); if (LauncherUtil.isWindows()) { Assertions.assertEquals(expectedWindows, transformed); } else { Assertions.assertEquals(expectedUnix, transformed); } }
public static String quoteIfRequired(final String original) { if (LauncherUtil.isWindows() && original != null && original.contains(WHITESPACE) && !original.startsWith(DOUBLE_QUOTE)) { return DOUBLE_QUOTE + original + DOUBLE_QUOTE; } return original; }
PathQuoteUtil { public static String quoteIfRequired(final String original) { if (LauncherUtil.isWindows() && original != null && original.contains(WHITESPACE) && !original.startsWith(DOUBLE_QUOTE)) { return DOUBLE_QUOTE + original + DOUBLE_QUOTE; } return original; } }
PathQuoteUtil { public static String quoteIfRequired(final String original) { if (LauncherUtil.isWindows() && original != null && original.contains(WHITESPACE) && !original.startsWith(DOUBLE_QUOTE)) { return DOUBLE_QUOTE + original + DOUBLE_QUOTE; } return original; }  }
PathQuoteUtil { public static String quoteIfRequired(final String original) { if (LauncherUtil.isWindows() && original != null && original.contains(WHITESPACE) && !original.startsWith(DOUBLE_QUOTE)) { return DOUBLE_QUOTE + original + DOUBLE_QUOTE; } return original; }  static String quoteIfRequired(final String original); }
PathQuoteUtil { public static String quoteIfRequired(final String original) { if (LauncherUtil.isWindows() && original != null && original.contains(WHITESPACE) && !original.startsWith(DOUBLE_QUOTE)) { return DOUBLE_QUOTE + original + DOUBLE_QUOTE; } return original; }  static String quoteIfRequired(final String original);  }