diff options
Diffstat (limited to 'containers/org.eclipse.linuxtools.docker.core/src/org/eclipse')
4 files changed, 66 insertions, 58 deletions
diff --git a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnection.java b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnection.java index 57fc86cee1..a67f905e5e 100644 --- a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnection.java +++ b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnection.java @@ -971,7 +971,8 @@ public class DockerConnection implements IDockerConnection, Closeable { final ContainerCreation creation = client .createContainer(builder.build(), containerName); - final String id = creation.id(); + + final String id = creation != null ? creation.id() : null; // force a refresh of the current containers to include the new one listContainers(); return id; diff --git a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnectionInfo.java b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnectionInfo.java index a4b8e548ae..73bb1e3ebf 100644 --- a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnectionInfo.java +++ b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnectionInfo.java @@ -53,31 +53,32 @@ public class DockerConnectionInfo implements IDockerConnectionInfo { private final String dockerRootDir; public DockerConnectionInfo(final Info info, final Version version) { - this.containers = info.containers(); - this.debug = info.debug(); - this.executionDriver = info.executionDriver(); - this.fileDescriptors = info.fileDescriptors(); - this.goroutines = info.goroutines(); - this.images = info.images(); - this.initPath = info.initPath(); - this.kernelVersion = info.kernelVersion(); - this.memoryLimit = info.memoryLimit(); - this.storageDriver = info.storageDriver(); - this.swapLimit = info.swapLimit(); - this.apiVersion = version.apiVersion(); - this.gitCommit = version.gitCommit(); - this.os = version.os(); - this.version = version.version(); - this.driverStatus = info.driverStatus(); - this.cpuNumber = info.cpus(); - this.totalMemory = info.memTotal(); - this.name = info.name(); - this.id = info.id(); - this.initSha1 = info.initSha1(); - this.ipv4Forwarding = info.ipv4Forwarding(); - this.indexServerAddress = info.indexServerAddress(); - this.labels = info.labels(); - this.dockerRootDir = info.dockerRootDir(); + this.containers = info != null ? info.containers() : -1; + this.debug = info != null ? info.debug() : false; + this.executionDriver = info != null ? info.executionDriver() : null; + this.fileDescriptors = info != null ? info.fileDescriptors() : -1; + this.goroutines = info != null ? info.goroutines() : -1; + this.images = info != null ? info.images() : -1; + this.initPath = info != null ? info.initPath() : null; + this.kernelVersion = info != null ? info.kernelVersion() : null; + this.memoryLimit = info != null ? info.memoryLimit() : false; + this.storageDriver = info != null ? info.storageDriver() : null; + this.swapLimit = info != null ? info.swapLimit() : false; + this.apiVersion = version != null ? version.apiVersion() : null; + this.gitCommit = version != null ? version.gitCommit() : null; + this.os = version != null ? version.os() : ""; + this.version = version != null ? version.version() : null; + this.driverStatus = info != null ? info.driverStatus() : null; + this.cpuNumber = info != null ? info.cpus() : -1; + this.totalMemory = info != null ? info.memTotal() : -1; + this.name = info != null ? info.name() : null; + this.id = info != null ? info.id() : null; + this.initSha1 = info != null ? info.initSha1() : null; + this.ipv4Forwarding = info != null ? info.ipv4Forwarding() : false; + this.indexServerAddress = info != null ? info.indexServerAddress() + : null; + this.labels = info != null ? info.labels() : null; + this.dockerRootDir = info != null ? info.dockerRootDir() : null; } diff --git a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerContainerInfo.java b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerContainerInfo.java index 84d7db1004..f40f68cbe9 100644 --- a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerContainerInfo.java +++ b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerContainerInfo.java @@ -45,25 +45,29 @@ public class DockerContainerInfo implements IDockerContainerInfo { private Map<String, Boolean> volumesRW; public DockerContainerInfo (final ContainerInfo info) { - this.id = info.id(); - this.created = info.created(); - this.path = info.path(); - this.args = info.args(); - this.config = new DockerContainerConfig(info.config()); - this.hostConfig = new DockerHostConfig(info.hostConfig()); - this.state = new DockerContainerState(info.state()); - this.image = info.image(); - this.networkSettings = new DockerNetworkSettings(info.networkSettings()); - this.resolvConfPath = info.resolvConfPath(); - this.hostnamePath = info.hostnamePath(); - this.hostsPath = info.hostsPath(); - this.name = info.name(); - this.driver = info.driver(); - this.execDriver = info.execDriver(); - this.processLabel = info.processLabel(); - this.mountLabel = info.mountLabel(); - this.volumes = info.volumes(); - this.volumesRW = info.volumesRW(); + this.id = info != null ? info.id() : null; + this.created = info != null ? info.created() : null; + this.path = info != null ? info.path() : null; + this.args = info != null ? info.args() : null; + this.config = info != null ? new DockerContainerConfig(info.config()) + : null; + this.hostConfig = info != null ? new DockerHostConfig(info.hostConfig()) + : null; + this.state = info != null ? new DockerContainerState(info.state()) + : null; + this.image = info != null ? info.image() : null; + this.networkSettings = info != null + ? new DockerNetworkSettings(info.networkSettings()) : null; + this.resolvConfPath = info != null ? info.resolvConfPath() : null; + this.hostnamePath = info != null ? info.hostnamePath() : null; + this.hostsPath = info != null ? info.hostsPath() : null; + this.name = info != null ? info.name() : null; + this.driver = info != null ? info.driver() : null; + this.execDriver = info != null ? info.execDriver() : null; + this.processLabel = info != null ? info.processLabel() : null; + this.mountLabel = info != null ? info.mountLabel() : null; + this.volumes = info != null ? info.volumes() : null; + this.volumesRW = info != null ? info.volumesRW() : null; } @Override diff --git a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerImageInfo.java b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerImageInfo.java index 0514885f65..e9aff6f837 100644 --- a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerImageInfo.java +++ b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerImageInfo.java @@ -32,19 +32,21 @@ public class DockerImageInfo implements IDockerImageInfo { private String os; private Long size; - public DockerImageInfo(ImageInfo info) { - this.id = info.id(); - this.parent = info.parent(); - this.comment = info.comment(); - this.created = info.created(); - this.container = info.container(); - this.containerConfig = new DockerContainerConfig(info.containerConfig()); - this.dockerVersion = info.dockerVersion(); - this.author = info.author(); - this.config = new DockerContainerConfig(info.config()); - this.architecture = info.architecture(); - this.os = info.os(); - this.size = info.size(); + public DockerImageInfo(final ImageInfo info) { + this.id = info != null ? info.id() : null; + this.parent = info != null ? info.parent() : null; + this.comment = info != null ? info.comment() : null; + this.created = info != null ? info.created() : null; + this.container = info != null ? info.container() : null; + this.containerConfig = info != null + ? new DockerContainerConfig(info.containerConfig()) : null; + this.dockerVersion = info != null ? info.dockerVersion() : null; + this.author = info != null ? info.author() : null; + this.config = info != null ? new DockerContainerConfig(info.config()) + : null; + this.architecture = info != null ? info.architecture() : null; + this.os = info != null ? info.os() : null; + this.size = info != null ? info.size() : null; } @Override |