summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorey Ashford2013-10-28 14:32:27 (EDT)
committerChris Recoskie2013-10-29 13:45:37 (EDT)
commitc71f63f8993aa1194c0e8a66663aaa4a18f89a90 (patch)
treedafff0bd1aa30847a41e17c504af7f70b882fd7d
parentfb09ba33f027674ff4e09986ae67a403b995fb4b (diff)
downloadorg.eclipse.ptp-c71f63f8993aa1194c0e8a66663aaa4a18f89a90.zip
org.eclipse.ptp-c71f63f8993aa1194c0e8a66663aaa4a18f89a90.tar.gz
org.eclipse.ptp-c71f63f8993aa1194c0e8a66663aaa4a18f89a90.tar.bz2
Bug 368495 - RemoteCommandLauncher#execute for RDT will fail if any
environment variable's value is null Change-Id: I9b7eb1ca825a0f2e115959c15d04a1db7aec7323 Signed-off-by: Corey Ashford <cjashfor@us.ibm.com>
-rw-r--r--rdt/org.eclipse.ptp.rdt.core/src/org/eclipse/ptp/rdt/core/remotemake/Messages.java26
-rw-r--r--rdt/org.eclipse.ptp.rdt.core/src/org/eclipse/ptp/rdt/core/remotemake/RemoteCommandLauncher.java16
-rw-r--r--rdt/org.eclipse.ptp.rdt.core/src/org/eclipse/ptp/rdt/core/remotemake/messages.properties11
3 files changed, 51 insertions, 2 deletions
diff --git a/rdt/org.eclipse.ptp.rdt.core/src/org/eclipse/ptp/rdt/core/remotemake/Messages.java b/rdt/org.eclipse.ptp.rdt.core/src/org/eclipse/ptp/rdt/core/remotemake/Messages.java
new file mode 100644
index 0000000..6509a6c
--- /dev/null
+++ b/rdt/org.eclipse.ptp.rdt.core/src/org/eclipse/ptp/rdt/core/remotemake/Messages.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2013 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.ptp.rdt.core.remotemake;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.ptp.rdt.core.remotemake.messages"; //$NON-NLS-1$
+ public static String RemoteCommandLauncher_env_parse_error;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/rdt/org.eclipse.ptp.rdt.core/src/org/eclipse/ptp/rdt/core/remotemake/RemoteCommandLauncher.java b/rdt/org.eclipse.ptp.rdt.core/src/org/eclipse/ptp/rdt/core/remotemake/RemoteCommandLauncher.java
index 85ff50a..640ad89 100644
--- a/rdt/org.eclipse.ptp.rdt.core/src/org/eclipse/ptp/rdt/core/remotemake/RemoteCommandLauncher.java
+++ b/rdt/org.eclipse.ptp.rdt.core/src/org/eclipse/ptp/rdt/core/remotemake/RemoteCommandLauncher.java
@@ -160,8 +160,20 @@ public class RemoteCommandLauncher implements ICommandLauncher {
remoteEnvMap.clear();
for(String envVar : env) {
- String[] splitStr = envVar.split("="); //$NON-NLS-1$
- remoteEnvMap.put(splitStr[0], splitStr[1]);
+ int eqIdx = envVar.indexOf('=');
+ if (eqIdx == -1)
+ throw new CoreException(
+ new Status(
+ IStatus.ERROR,
+ "org.eclipse.ptp.rdt.core", Messages.RemoteCommandLauncher_env_parse_error + envVar, null)); //$NON-NLS-1$
+ String var = envVar.substring(0, eqIdx);
+ if (eqIdx == (envVar.length() - 1)) {
+ // The value of the variable is a null string
+ remoteEnvMap.put(var, null);
+ } else {
+ String val = envVar.substring(eqIdx + 1, envVar.length());
+ remoteEnvMap.put(var, val);
+ }
}
// set the directory in which to run the command
diff --git a/rdt/org.eclipse.ptp.rdt.core/src/org/eclipse/ptp/rdt/core/remotemake/messages.properties b/rdt/org.eclipse.ptp.rdt.core/src/org/eclipse/ptp/rdt/core/remotemake/messages.properties
new file mode 100644
index 0000000..70dacc8
--- /dev/null
+++ b/rdt/org.eclipse.ptp.rdt.core/src/org/eclipse/ptp/rdt/core/remotemake/messages.properties
@@ -0,0 +1,11 @@
+###############################################################################
+# Copyright (c) 2012,2013 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial version
+###############################################################################
+RemoteCommandLauncher_env_parse_error=Error parsing environment string: