| author | Corey Ashford | 2012-05-16 13:36:36 (EDT) |
|---|---|---|
| committer | Jeff Johnston | 2012-05-16 13:36:36 (EDT) |
| commit | 32911ffcb217e7b3ad4b91b35cca8c361bfa20a9 (patch) (side-by-side diff) | |
| tree | af2c4bfe7ac21b64b53b375678a6324a57df66ee | |
| parent | 2bdc917bab72726822bc191f11458a45f00f8a0c (diff) | |
| download | org.eclipse.linuxtools-32911ffcb217e7b3ad4b91b35cca8c361bfa20a9.zip org.eclipse.linuxtools-32911ffcb217e7b3ad4b91b35cca8c361bfa20a9.tar.gz org.eclipse.linuxtools-32911ffcb217e7b3ad4b91b35cca8c361bfa20a9.tar.bz2 | |
Fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=369468
RDTCommandLauncher#execute: Fix bugs with the loop that transfers the
environment variable strings from the form "<var>=<value>" to a
hash map.
Signed-off-by: Corey Ashford <cjashfor@linux.vnet.ibm.com>
4 files changed, 60 insertions, 4 deletions
diff --git a/profiling/org.eclipse.linuxtools.rdt.proxy/src/org/eclipse/linuxtools/internal/rdt/proxy/Messages.java b/profiling/org.eclipse.linuxtools.rdt.proxy/src/org/eclipse/linuxtools/internal/rdt/proxy/Messages.java new file mode 100644 index 0000000..78f4a96 --- a/dev/null +++ b/profiling/org.eclipse.linuxtools.rdt.proxy/src/org/eclipse/linuxtools/internal/rdt/proxy/Messages.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2012 IBM Corporation. + * 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.linuxtools.internal.rdt.proxy; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.rdt.proxy.messages"; //$NON-NLS-1$ + public static String RDTCommandLauncher_malformed_env_var_string; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/profiling/org.eclipse.linuxtools.rdt.proxy/src/org/eclipse/linuxtools/internal/rdt/proxy/RDTCommandLauncher.java b/profiling/org.eclipse.linuxtools.rdt.proxy/src/org/eclipse/linuxtools/internal/rdt/proxy/RDTCommandLauncher.java index f1dce3e..6ba77db 100644 --- a/profiling/org.eclipse.linuxtools.rdt.proxy/src/org/eclipse/linuxtools/internal/rdt/proxy/RDTCommandLauncher.java +++ b/profiling/org.eclipse.linuxtools.rdt.proxy/src/org/eclipse/linuxtools/internal/rdt/proxy/RDTCommandLauncher.java @@ -21,6 +21,7 @@ import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.Status; import org.eclipse.linuxtools.profiling.launch.IRemoteCommandLauncher; import org.eclipse.linuxtools.rdt.proxy.Activator; import org.eclipse.ptp.remote.core.IRemoteConnection; @@ -144,10 +145,19 @@ public class RDTCommandLauncher implements IRemoteCommandLauncher { for (int i = 0; i < env.length; ++i) { String s = env[i]; - String[] tokens = s.split("=", 2); - envMap.put(tokens[0], tokens[1]); + String[] tokens = s.split("=", 2); //$NON-NLS-1$ + switch (tokens.length) { + case 1: + envMap.put(tokens[0], null); + break; + case 2: + envMap.put(tokens[0], tokens[1]); + break; + default: + Activator.log(Status.WARNING, Messages.RDTCommandLauncher_malformed_env_var_string + s); + } } - + fProcess = builder.start(); fErrorMessage = ""; //$NON-NLS-1$ } catch (IOException e) { @@ -221,4 +231,4 @@ public class RDTCommandLauncher implements IRemoteCommandLauncher { return buf.toString(); } -}
\ No newline at end of file +} diff --git a/profiling/org.eclipse.linuxtools.rdt.proxy/src/org/eclipse/linuxtools/internal/rdt/proxy/messages.properties b/profiling/org.eclipse.linuxtools.rdt.proxy/src/org/eclipse/linuxtools/internal/rdt/proxy/messages.properties new file mode 100644 index 0000000..59eaeb8 --- a/dev/null +++ b/profiling/org.eclipse.linuxtools.rdt.proxy/src/org/eclipse/linuxtools/internal/rdt/proxy/messages.properties @@ -0,0 +1,11 @@ +#******************************************************************************* +# Copyright (c) 2012 IBM Corporation +# 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 +#******************************************************************************* +RDTCommandLauncher_malformed_env_var_string=Malformed environment variable string: diff --git a/profiling/org.eclipse.linuxtools.rdt.proxy/src/org/eclipse/linuxtools/rdt/proxy/Activator.java b/profiling/org.eclipse.linuxtools.rdt.proxy/src/org/eclipse/linuxtools/rdt/proxy/Activator.java index 2358c93..a6e5bce 100644 --- a/profiling/org.eclipse.linuxtools.rdt.proxy/src/org/eclipse/linuxtools/rdt/proxy/Activator.java +++ b/profiling/org.eclipse.linuxtools.rdt.proxy/src/org/eclipse/linuxtools/rdt/proxy/Activator.java @@ -13,6 +13,8 @@ package org.eclipse.linuxtools.rdt.proxy; import java.util.MissingResourceException; import java.util.ResourceBundle; +import org.eclipse.core.runtime.Status; + import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.ui.plugin.AbstractUIPlugin; import org.osgi.framework.BundleContext; @@ -101,4 +103,12 @@ public class Activator extends AbstractUIPlugin { public static ImageDescriptor getImageDescriptor(String path) { return imageDescriptorFromPlugin(PLUGIN_ID, path); } + + public static void log(int severity, String msg) { + log(severity, msg, null); + } + + public static void log(int severity, String msg, Exception e) { + getDefault().getLog().log(new Status(severity, PLUGIN_ID, Status.OK, msg, e)); + } } |

