[jbosstools-commits] JBoss Tools SVN: r35609 - trunk/forge/plugins/org.jboss.tools.forge.core/src/org/jboss/tools/forge/core/process.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Thu Oct 13 03:56:36 EDT 2011


Author: koen.aers at jboss.com
Date: 2011-10-13 03:56:35 -0400 (Thu, 13 Oct 2011)
New Revision: 35609

Modified:
   trunk/forge/plugins/org.jboss.tools.forge.core/src/org/jboss/tools/forge/core/process/ForgeLaunchHelper.java
Log:
JBIDE-9882: Forge does not start on XP

Modified: trunk/forge/plugins/org.jboss.tools.forge.core/src/org/jboss/tools/forge/core/process/ForgeLaunchHelper.java
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.core/src/org/jboss/tools/forge/core/process/ForgeLaunchHelper.java	2011-10-13 07:54:52 UTC (rev 35608)
+++ trunk/forge/plugins/org.jboss.tools.forge.core/src/org/jboss/tools/forge/core/process/ForgeLaunchHelper.java	2011-10-13 07:56:35 UTC (rev 35609)
@@ -94,31 +94,27 @@
 	}
 	
 	private static String createJBossModulesPathArgument(String location) {
-		StringBuffer buffer = new StringBuffer("-modulepath ");
+		StringBuffer buffer = new StringBuffer();
 		buffer.append(getMainModulesLocation(location)).append(File.pathSeparator);
 		buffer.append(getUserModulesLocation()).append(File.pathSeparator);
 		buffer.append(getExtraModulesLocation());
-		return buffer.toString();
+		return "-modulepath " + encloseWithDoubleQuotesIfNeeded(buffer.toString());
 	}
 	
-	private static String encloseWithDoubleQuotes(String str) {
-		return "\"" + str + "\"";
+	private static String encloseWithDoubleQuotesIfNeeded(String str) {
+		if (str.contains(" ")) { 
+			return "\"" + str + "\"";
+		} else {
+			return str;
+		}
 	}
 	
 	private static String getMainModulesLocation(String location) {
-		String result = location + "/modules";
-		if (result.contains(" ")) {
-			result = encloseWithDoubleQuotes(result);
-		}
-		return result;
+		return  location + "/modules";
 	}
 	
 	private static String getUserModulesLocation() {
-		String result = System.getProperty("user.home") + "/.forge/plugins";
-		if (result.contains(" ")) {
-			result = encloseWithDoubleQuotes(result);
-		}
-		return result;
+		return System.getProperty("user.home") + "/.forge/plugins";
 	}
 	
 	private static String getExtraModulesLocation() {
@@ -128,19 +124,20 @@
 		} catch (IOException e) {
 			ForgeCorePlugin.log(new RuntimeException("Problem while obtaining location of extra runtime classes.", e));
 		}
-		if (result.contains(" ")) {
-			result = encloseWithDoubleQuotes(result);
-		}
 		return result;
 	}
 	
 	private static String createVmArguments(String location) {
 		StringBuffer buffer = new StringBuffer();
-		buffer.append("-Dforge.home=").append(location).append(' ');
+		buffer.append("-Dforge.home=").append(encloseWithDoubleQuotesIfNeeded(location)).append(' ');
 		buffer.append("-Dforge.shell.colorEnabled=true").append(' ');
 		buffer.append("-Dforge.compatibility.IDE=true").append(' ');
-		buffer.append("-cp ").append(location).append("/jboss-modules.jar ");
+		buffer.append(getClassPathArgument(location));
 		return buffer.toString();
 	}
 	
+	private static String getClassPathArgument(String location) {
+		return "-cp " + encloseWithDoubleQuotesIfNeeded(location + "/jboss-modules.jar");
+	}
+	
 }



More information about the jbosstools-commits mailing list