summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Aubry2012-12-14 10:32:31 (EST)
committer Kevin KIN-FOO2012-12-14 11:48:55 (EST)
commit3702b84c5d658ecac5c3f8746f3efee93f0ebcfa (patch)
tree096d0041a310741677f01bb6f65be26cdc20428d
parent57db65e0f00bf1473495cdd96956ca804a39c2c3 (diff)
downloadorg.eclipse.koneki.ldt-3702b84c5d658ecac5c3f8746f3efee93f0ebcfa.zip
org.eclipse.koneki.ldt-3702b84c5d658ecac5c3f8746f3efee93f0ebcfa.tar.gz
org.eclipse.koneki.ldt-3702b84c5d658ecac5c3f8746f3efee93f0ebcfa.tar.bz2
Fix NPE on creating a new launch remote config.0.9_RC20.9R_0_9_maintenance
-rw-r--r--plugins/org.eclipse.koneki.ldt.remote.core/src/org/eclipse/koneki/ldt/remote/core/internal/lua/LuaRSEUtil.java3
-rw-r--r--plugins/org.eclipse.koneki.ldt.remote.debug.core/src/org/eclipse/koneki/ldt/remote/debug/core/internal/launch/LuaRemoteLaunchConfigurationUtil.java10
-rw-r--r--plugins/org.eclipse.koneki.ldt.remote.debug.ui/src/org/eclipse/koneki/ldt/remote/debug/ui/internal/launch/tab/LuaRemoteLaunchConfigurationMainTab.java12
3 files changed, 16 insertions, 9 deletions
diff --git a/plugins/org.eclipse.koneki.ldt.remote.core/src/org/eclipse/koneki/ldt/remote/core/internal/lua/LuaRSEUtil.java b/plugins/org.eclipse.koneki.ldt.remote.core/src/org/eclipse/koneki/ldt/remote/core/internal/lua/LuaRSEUtil.java
index c0e7596..b60a360 100644
--- a/plugins/org.eclipse.koneki.ldt.remote.core/src/org/eclipse/koneki/ldt/remote/core/internal/lua/LuaRSEUtil.java
+++ b/plugins/org.eclipse.koneki.ldt.remote.core/src/org/eclipse/koneki/ldt/remote/core/internal/lua/LuaRSEUtil.java
@@ -79,6 +79,9 @@ public final class LuaRSEUtil {
}
public static LuaSubSystem getLuaSubSystem(IHost host) {
+ if (host == null)
+ return null;
+
for (ISubSystem subsytem : host.getSubSystems()) {
if (subsytem instanceof LuaSubSystem) {
return (LuaSubSystem) subsytem;
diff --git a/plugins/org.eclipse.koneki.ldt.remote.debug.core/src/org/eclipse/koneki/ldt/remote/debug/core/internal/launch/LuaRemoteLaunchConfigurationUtil.java b/plugins/org.eclipse.koneki.ldt.remote.debug.core/src/org/eclipse/koneki/ldt/remote/debug/core/internal/launch/LuaRemoteLaunchConfigurationUtil.java
index c90f16d..faffda8 100644
--- a/plugins/org.eclipse.koneki.ldt.remote.debug.core/src/org/eclipse/koneki/ldt/remote/debug/core/internal/launch/LuaRemoteLaunchConfigurationUtil.java
+++ b/plugins/org.eclipse.koneki.ldt.remote.debug.core/src/org/eclipse/koneki/ldt/remote/debug/core/internal/launch/LuaRemoteLaunchConfigurationUtil.java
@@ -166,15 +166,15 @@ public final class LuaRemoteLaunchConfigurationUtil {
}
public static String getRemoteApplicationPath(ILaunchConfiguration configuration) {
- IHost host = getHost(configuration);
+
+ final IHost host = getHost(configuration);
if (host == null)
return ""; //$NON-NLS-1$
- IRemoteFileSubSystem remoteFileSubSystem = RSEUtil.getRemoteFileSubsystem(host);
- if (remoteFileSubSystem == null)
+ final IRemoteFileSubSystem remoteFileSubSystem = RSEUtil.getRemoteFileSubsystem(host);
+ final LuaSubSystem luaSubSystem = LuaRSEUtil.getLuaSubSystem(host);
+ if (luaSubSystem == null || remoteFileSubSystem == null)
return ""; //$NON-NLS-1$
-
- LuaSubSystem luaSubSystem = LuaRSEUtil.getLuaSubSystem(host);
return luaSubSystem.getOutputDirectory() + remoteFileSubSystem.getSeparator() + configuration.getName();
}
}
diff --git a/plugins/org.eclipse.koneki.ldt.remote.debug.ui/src/org/eclipse/koneki/ldt/remote/debug/ui/internal/launch/tab/LuaRemoteLaunchConfigurationMainTab.java b/plugins/org.eclipse.koneki.ldt.remote.debug.ui/src/org/eclipse/koneki/ldt/remote/debug/ui/internal/launch/tab/LuaRemoteLaunchConfigurationMainTab.java
index 0354fe4..e2da364 100644
--- a/plugins/org.eclipse.koneki.ldt.remote.debug.ui/src/org/eclipse/koneki/ldt/remote/debug/ui/internal/launch/tab/LuaRemoteLaunchConfigurationMainTab.java
+++ b/plugins/org.eclipse.koneki.ldt.remote.debug.ui/src/org/eclipse/koneki/ldt/remote/debug/ui/internal/launch/tab/LuaRemoteLaunchConfigurationMainTab.java
@@ -27,6 +27,7 @@ import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.koneki.ldt.core.LuaConstants;
import org.eclipse.koneki.ldt.core.LuaNature;
import org.eclipse.koneki.ldt.remote.core.internal.RSEUtil;
+import org.eclipse.koneki.ldt.remote.core.internal.lua.LuaRSEUtil;
import org.eclipse.koneki.ldt.remote.debug.core.internal.LuaRemoteDebugConstant;
import org.eclipse.koneki.ldt.remote.debug.core.internal.launch.LuaRemoteLaunchConfigurationUtil;
import org.eclipse.koneki.ldt.remote.debug.ui.internal.Activator;
@@ -215,10 +216,13 @@ public class LuaRemoteLaunchConfigurationMainTab extends AbstractLaunchConfigura
}
configuration.setAttribute(LuaRemoteDebugConstant.SCRIPT_NAME, defaultScript);
- // get first available target
- IHost[] hosts = RSECorePlugin.getTheSystemRegistry().getHosts();
- if (hosts.length > 0) {
- LuaRemoteLaunchConfigurationUtil.setConnectionId(configuration, hosts[0]);
+ // get first available target with luaSsh subsystem
+ final IHost[] hosts = RSECorePlugin.getTheSystemRegistry().getHosts();
+ for (int i = 0; i < hosts.length && LuaRemoteLaunchConfigurationUtil.getHost(configuration) == null; i++) {
+ final IHost host = hosts[i];
+ if (LuaRSEUtil.getLuaSubSystem(host) != null) {
+ LuaRemoteLaunchConfigurationUtil.setConnectionId(configuration, host);
+ }
}
configuration.setAttribute(LuaRemoteDebugConstant.DBGP_LOGGING, false);
configuration.setAttribute(LuaRemoteDebugConstant.BREAK_ON_FIRST_LINE, false);