Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions docker-java-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@
<version>${commons-codec.version}</version>
</dependency>

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
*/
package com.github.dockerjava.api.async;

import com.google.common.base.Throwables;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -134,8 +133,13 @@ public boolean awaitStarted(long timeout, TimeUnit timeUnit) throws InterruptedE
*/
protected void throwFirstError() {
if (firstError != null) {
// this call throws a RuntimeException
Throwables.propagate(firstError);
if (firstError instanceof Error) {
throw (Error) firstError;
}
if (firstError instanceof RuntimeException) {
throw (RuntimeException) firstError;
}
throw new RuntimeException(firstError);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.base.Joiner;

/**
*
Expand All @@ -28,14 +27,19 @@ public String[][] getProcesses() {

@Override
public String toString() {
StringBuffer buffer = new StringBuffer();
StringBuilder buffer = new StringBuilder("TopContainerResponse{");
buffer.append("titles=");
buffer.append(String.join("; ", titles));
buffer.append(", processes=");
buffer.append("[");
for (String[] fields : processes) {
buffer.append("[" + Joiner.on("; ").skipNulls().join(fields) + "]");
buffer.append("[")
.append(String.join("; ", fields))
.append("]");
}
buffer.append("]");
buffer.append("}");

return "TopContainerResponse{" + "titles=" + Joiner.on("; ").skipNulls().join(titles) + ", processes="
+ buffer.toString() + '}';
return buffer.toString();
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.dockerjava.api.model;

import static com.google.common.base.Preconditions.checkNotNull;
import static java.util.Objects.requireNonNull;
import static org.apache.commons.lang.BooleanUtils.isNotTrue;
import static org.apache.commons.lang.StringUtils.isEmpty;

Expand Down Expand Up @@ -34,9 +34,9 @@ public Device() {
}

public Device(String cGroupPermissions, String pathInContainer, String pathOnHost) {
checkNotNull(cGroupPermissions, "cGroupPermissions is null");
checkNotNull(pathInContainer, "pathInContainer is null");
checkNotNull(pathOnHost, "pathOnHost is null");
requireNonNull(cGroupPermissions, "cGroupPermissions is null");
requireNonNull(pathInContainer, "pathInContainer is null");
requireNonNull(pathOnHost, "pathOnHost is null");
this.cGroupPermissions = cGroupPermissions;
this.pathInContainer = pathInContainer;
this.pathOnHost = pathOnHost;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import java.util.List;
import java.util.Map;

import static com.google.common.base.Preconditions.checkNotNull;
import static java.util.Objects.requireNonNull;

/**
* Used in `/containers/create`, and in inspect container.
Expand Down Expand Up @@ -573,13 +573,13 @@ public HostConfig withBinds(Binds binds) {
}

public HostConfig withBinds(Bind... binds) {
checkNotNull(binds, "binds was not specified");
requireNonNull(binds, "binds was not specified");
setBinds(binds);
return this;
}

public HostConfig withBinds(List<Bind> binds) {
checkNotNull(binds, "binds was not specified");
requireNonNull(binds, "binds was not specified");
return withBinds(binds.toArray(new Bind[binds.size()]));
}

Expand Down Expand Up @@ -712,7 +712,7 @@ public HostConfig withDevices(Device... devices) {
}

public HostConfig withDevices(List<Device> devices) {
checkNotNull(devices, "devices was not specified");
requireNonNull(devices, "devices was not specified");
return withDevices(devices.toArray(new Device[0]));
}

Expand All @@ -733,7 +733,7 @@ public HostConfig withDns(String... dns) {
}

public HostConfig withDns(List<String> dns) {
checkNotNull(dns, "dns was not specified");
requireNonNull(dns, "dns was not specified");
return withDns(dns.toArray(new String[0]));
}

Expand All @@ -746,7 +746,7 @@ public HostConfig withDnsSearch(String... dnsSearch) {
}

public HostConfig withDnsSearch(List<String> dnsSearch) {
checkNotNull(dnsSearch, "dnsSearch was not specified");
requireNonNull(dnsSearch, "dnsSearch was not specified");
return withDnsSearch(dnsSearch.toArray(new String[0]));
}

Expand Down Expand Up @@ -775,13 +775,13 @@ public HostConfig withLinks(Links links) {
}

public HostConfig withLinks(Link... links) {
checkNotNull(links, "links was not specified");
requireNonNull(links, "links was not specified");
setLinks(links);
return this;
}

public HostConfig withLinks(List<Link> links) {
checkNotNull(links, "links was not specified");
requireNonNull(links, "links was not specified");
return withLinks(links.toArray(new Link[0]));
}

Expand Down Expand Up @@ -894,13 +894,13 @@ public HostConfig withPortBindings(Ports portBindings) {
}

public HostConfig withPortBindings(PortBinding... portBindings) {
checkNotNull(portBindings, "portBindings was not specified");
requireNonNull(portBindings, "portBindings was not specified");
withPortBindings(new Ports(portBindings));
return this;
}

public HostConfig withPortBindings(List<PortBinding> portBindings) {
checkNotNull(portBindings, "portBindings was not specified");
requireNonNull(portBindings, "portBindings was not specified");
return withPortBindings(portBindings.toArray(new PortBinding[0]));
}

Expand Down Expand Up @@ -985,7 +985,7 @@ public HostConfig withUlimits(Ulimit[] ulimits) {
}

public HostConfig withUlimits(List<Ulimit> ulimits) {
checkNotNull(ulimits, "no ulimits was specified");
requireNonNull(ulimits, "no ulimits was specified");
return withUlimits(ulimits.toArray(new Ulimit[0]));
}

Expand All @@ -1006,7 +1006,7 @@ public HostConfig withVolumesFrom(VolumesFrom... volumesFrom) {
}

public HostConfig withVolumesFrom(List<VolumesFrom> volumesFrom) {
checkNotNull(volumesFrom, "volumesFrom was not specified");
requireNonNull(volumesFrom, "volumesFrom was not specified");
return withVolumesFrom(volumesFrom.toArray(new VolumesFrom[0]));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package com.github.dockerjava.api.model;

import com.google.common.base.MoreObjects;
import com.google.common.base.Optional;

import java.io.Serializable;
import java.util.Optional;

/**
* @author magnayn
Expand All @@ -18,11 +16,7 @@ public class Identifier implements Serializable {
public Identifier(Repository repository, String tag) {
this.repository = repository;

if (tag == null) {
this.tag = Optional.absent();
} else {
this.tag = Optional.of(tag);
}
this.tag = Optional.ofNullable(tag);
}

/**
Expand Down Expand Up @@ -55,6 +49,9 @@ public static Identifier fromCompoundString(String identifier) {

@Override
public String toString() {
return MoreObjects.toStringHelper(this).add("repository", repository).add("tag", tag).toString();
return "Identifier{" +
"repository=" + repository +
", tag=" + tag +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import java.net.MalformedURLException;
import java.net.URL;

import com.google.common.base.MoreObjects;

/**
* A repository or image name.
*/
Expand Down Expand Up @@ -36,7 +34,9 @@ public URL getURL() throws MalformedURLException {

@Override
public String toString() {
return MoreObjects.toStringHelper(this).add("name", name).toString();
return "Repository{" +
"name='" + name + '\'' +
'}';
}

public String getPath() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.github.dockerjava.api.model;

import static com.google.common.base.Preconditions.checkNotNull;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;

import com.fasterxml.jackson.annotation.JsonProperty;

import java.io.Serializable;

import static java.util.Objects.requireNonNull;

/**
* Container restart policy
*
Expand Down Expand Up @@ -41,7 +41,7 @@ public RestartPolicy() {
}

private RestartPolicy(int maximumRetryCount, String name) {
checkNotNull(name, "name is null");
requireNonNull(name, "name is null");
this.maximumRetryCount = maximumRetryCount;
this.name = name;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.github.dockerjava.api.model;

import static com.google.common.base.Preconditions.checkNotNull;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;

import com.fasterxml.jackson.annotation.JsonProperty;

import java.io.Serializable;

import static java.util.Objects.requireNonNull;

/**
* @author Vangie Du (duwan@live.com)
*/
Expand All @@ -28,7 +28,7 @@ public Ulimit() {
}

public Ulimit(String name, int soft, int hard) {
checkNotNull(name, "Name is null");
requireNonNull(name, "Name is null");
this.name = name;
this.soft = soft;
this.hard = hard;
Expand Down
6 changes: 6 additions & 0 deletions docker-java-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@
<version>${commons-compress.version}</version>
</dependency>

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>

<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk15on</artifactId>
Expand Down