Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Johnston2015-06-06 02:51:16 +0000
committerJeff Johnston2015-06-06 02:51:16 +0000
commitbd7fad5f67386d76978305c47eecf3cb3a9594ea (patch)
tree8c779ab5cf093d3e73220bf0e9efc349c2d5c1ac
parentae86cacb2d80b3101a6d457f7f9cc683a18a87ef (diff)
downloadorg.eclipse.cdt-CDT_8_7_0.tar.gz
org.eclipse.cdt-CDT_8_7_0.tar.xz
org.eclipse.cdt-CDT_8_7_0.zip
Bug 469529 - null pointer exception starting Docker launcherCDT_8_7_0
- an init() call from the Docker Launch plugin start() method may not be able to get a Workbench Window so add code to ensure that an NPE does not occur in ConnectionListener - fix the ContainerLaunchConfigurationDelegate to return null for the ipaddress() of the gdbserver run job if the info has not yet been set (thread timing) Change-Id: I6dae9f1997d8b5b7db3246c0feb7966c4795b05b
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ConnectionListener.java11
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerLaunchConfigurationDelegate.java7
2 files changed, 14 insertions, 4 deletions
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ConnectionListener.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ConnectionListener.java
index 1dd304e434a..c9caba7a9b3 100644
--- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ConnectionListener.java
+++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ConnectionListener.java
@@ -5,7 +5,9 @@ import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ITreeSelection;
import org.eclipse.linuxtools.docker.core.IDockerConnection;
import org.eclipse.ui.ISelectionListener;
+import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
public class ConnectionListener implements ISelectionListener {
@@ -23,11 +25,16 @@ public class ConnectionListener implements ISelectionListener {
}
public void init() {
- DockerLaunchUIPlugin.getDefault().getWorkbench()
- .getActiveWorkbenchWindow().getSelectionService()
+ IWorkbench workbench = DockerLaunchUIPlugin.getDefault().getWorkbench();
+ if (workbench != null) {
+ IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
+ if (window != null) {
+ window.getSelectionService()
.addSelectionListener(
"org.eclipse.linuxtools.docker.ui.dockerExplorerView", //$NON-NLS-1$
this);
+ }
+ }
}
public IDockerConnection getCurrentConnection() {
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerLaunchConfigurationDelegate.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerLaunchConfigurationDelegate.java
index c12bc884d7e..a6b1b90f63a 100644
--- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerLaunchConfigurationDelegate.java
+++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ContainerLaunchConfigurationDelegate.java
@@ -85,8 +85,11 @@ public class ContainerLaunchConfigurationDelegate extends GdbLaunchDelegate
}
public String getIpAddress() {
- IDockerNetworkSettings networkSettings = info.networkSettings();
- return networkSettings.ipAddress();
+ if (info != null) {
+ IDockerNetworkSettings networkSettings = info.networkSettings();
+ return networkSettings.ipAddress();
+ }
+ return null;
}
public IDockerContainerInfo getContainerInfo() {

Back to the top