Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Johnston2018-08-23 14:38:06 -0400
committerJeff Johnston2018-08-23 15:24:52 -0400
commitd88951063d9a932d11378c15a4031f9dd8d1d174 (patch)
tree2906f42ccbbe3de6bb27720b422259b97d7e9569
parent12f5951ad81273bac3678f68d19038c161db7966 (diff)
downloadorg.eclipse.linuxtools-d88951063d9a932d11378c15a4031f9dd8d1d174.tar.gz
org.eclipse.linuxtools-d88951063d9a932d11378c15a4031f9dd8d1d174.tar.xz
org.eclipse.linuxtools-d88951063d9a932d11378c15a4031f9dd8d1d174.zip
Bug 538219 - NullPointerException in DisplayContainerLogCommandHandler
- add null checks in execute method in case the container info is not available yet or we can't get the container config Change-Id: Id65d56ff56f6477b15e6fdb502f61b34f9232c1e Reviewed-on: https://git.eclipse.org/r/127952 Tested-by: CI Bot Reviewed-by: Jeff Johnston <jjohnstn@redhat.com>
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/commands/DisplayContainerLogCommandHandler.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/commands/DisplayContainerLogCommandHandler.java b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/commands/DisplayContainerLogCommandHandler.java
index 6b5a179658..edad28987f 100644
--- a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/commands/DisplayContainerLogCommandHandler.java
+++ b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/commands/DisplayContainerLogCommandHandler.java
@@ -22,6 +22,8 @@ import org.eclipse.linuxtools.docker.core.DockerException;
import org.eclipse.linuxtools.docker.core.EnumDockerLoggingStatus;
import org.eclipse.linuxtools.docker.core.IDockerConnection;
import org.eclipse.linuxtools.docker.core.IDockerContainer;
+import org.eclipse.linuxtools.docker.core.IDockerContainerConfig;
+import org.eclipse.linuxtools.docker.core.IDockerContainerInfo;
import org.eclipse.linuxtools.internal.docker.core.DockerConnection;
import org.eclipse.linuxtools.internal.docker.ui.consoles.RunConsole;
import org.eclipse.linuxtools.internal.docker.ui.views.DVMessages;
@@ -50,9 +52,14 @@ public class DisplayContainerLogCommandHandler extends AbstractHandler {
final String id = container.id();
final String name = container.name();
- if (connection.getContainerInfo(id).config().tty()) {
- RunConsole.attachToTerminal(connection, id, null);
- return null;
+ IDockerContainerInfo info = connection.getContainerInfo(id);
+
+ if (info != null) {
+ IDockerContainerConfig config = info.config();
+ if (config != null && config.tty()) {
+ RunConsole.attachToTerminal(connection, id, null);
+ return null;
+ }
}
try {
final RunConsole rc = RunConsole.findConsole(id);

Back to the top