Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 655ae86

Browse filesBrowse files
bsideupKostyaSha
authored andcommitted
Remove Guava from the API module (#1255)
1 parent 67c7f33 commit 655ae86
Copy full SHA for 655ae86

File tree

10 files changed

+53
-48
lines changed
Filter options

10 files changed

+53
-48
lines changed

‎docker-java-api/pom.xml

Copy file name to clipboardExpand all lines: docker-java-api/pom.xml
-6Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,6 @@
3232
<version>${commons-codec.version}</version>
3333
</dependency>
3434

35-
<dependency>
36-
<groupId>com.google.guava</groupId>
37-
<artifactId>guava</artifactId>
38-
<version>${guava.version}</version>
39-
</dependency>
40-
4135
<dependency>
4236
<groupId>org.slf4j</groupId>
4337
<artifactId>slf4j-api</artifactId>

‎docker-java-api/src/main/java/com/github/dockerjava/api/async/ResultCallbackTemplate.java

Copy file name to clipboardExpand all lines: docker-java-api/src/main/java/com/github/dockerjava/api/async/ResultCallbackTemplate.java
+7-3Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
*/
44
package com.github.dockerjava.api.async;
55

6-
import com.google.common.base.Throwables;
76
import org.slf4j.Logger;
87
import org.slf4j.LoggerFactory;
98

@@ -134,8 +133,13 @@ public boolean awaitStarted(long timeout, TimeUnit timeUnit) throws InterruptedE
134133
*/
135134
protected void throwFirstError() {
136135
if (firstError != null) {
137-
// this call throws a RuntimeException
138-
Throwables.propagate(firstError);
136+
if (firstError instanceof Error) {
137+
throw (Error) firstError;
138+
}
139+
if (firstError instanceof RuntimeException) {
140+
throw (RuntimeException) firstError;
141+
}
142+
throw new RuntimeException(firstError);
139143
}
140144
}
141145
}

‎docker-java-api/src/main/java/com/github/dockerjava/api/command/TopContainerResponse.java

Copy file name to clipboardExpand all lines: docker-java-api/src/main/java/com/github/dockerjava/api/command/TopContainerResponse.java
+9-5Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
44
import com.fasterxml.jackson.annotation.JsonProperty;
5-
import com.google.common.base.Joiner;
65

76
/**
87
*
@@ -28,14 +27,19 @@ public String[][] getProcesses() {
2827

2928
@Override
3029
public String toString() {
31-
StringBuffer buffer = new StringBuffer();
30+
StringBuilder buffer = new StringBuilder("TopContainerResponse{");
31+
buffer.append("titles=");
32+
buffer.append(String.join("; ", titles));
33+
buffer.append(", processes=");
3234
buffer.append("[");
3335
for (String[] fields : processes) {
34-
buffer.append("[" + Joiner.on("; ").skipNulls().join(fields) + "]");
36+
buffer.append("[")
37+
.append(String.join("; ", fields))
38+
.append("]");
3539
}
3640
buffer.append("]");
41+
buffer.append("}");
3742

38-
return "TopContainerResponse{" + "titles=" + Joiner.on("; ").skipNulls().join(titles) + ", processes="
39-
+ buffer.toString() + '}';
43+
return buffer.toString();
4044
}
4145
}

‎docker-java-api/src/main/java/com/github/dockerjava/api/model/Device.java

Copy file name to clipboardExpand all lines: docker-java-api/src/main/java/com/github/dockerjava/api/model/Device.java
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.github.dockerjava.api.model;
22

3-
import static com.google.common.base.Preconditions.checkNotNull;
3+
import static java.util.Objects.requireNonNull;
44
import static org.apache.commons.lang.BooleanUtils.isNotTrue;
55
import static org.apache.commons.lang.StringUtils.isEmpty;
66

@@ -34,9 +34,9 @@ public Device() {
3434
}
3535

3636
public Device(String cGroupPermissions, String pathInContainer, String pathOnHost) {
37-
checkNotNull(cGroupPermissions, "cGroupPermissions is null");
38-
checkNotNull(pathInContainer, "pathInContainer is null");
39-
checkNotNull(pathOnHost, "pathOnHost is null");
37+
requireNonNull(cGroupPermissions, "cGroupPermissions is null");
38+
requireNonNull(pathInContainer, "pathInContainer is null");
39+
requireNonNull(pathOnHost, "pathOnHost is null");
4040
this.cGroupPermissions = cGroupPermissions;
4141
this.pathInContainer = pathInContainer;
4242
this.pathOnHost = pathOnHost;

‎docker-java-api/src/main/java/com/github/dockerjava/api/model/HostConfig.java

Copy file name to clipboardExpand all lines: docker-java-api/src/main/java/com/github/dockerjava/api/model/HostConfig.java
+12-12Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import java.util.List;
1616
import java.util.Map;
1717

18-
import static com.google.common.base.Preconditions.checkNotNull;
18+
import static java.util.Objects.requireNonNull;
1919

2020
/**
2121
* Used in `/containers/create`, and in inspect container.
@@ -573,13 +573,13 @@ public HostConfig withBinds(Binds binds) {
573573
}
574574

575575
public HostConfig withBinds(Bind... binds) {
576-
checkNotNull(binds, "binds was not specified");
576+
requireNonNull(binds, "binds was not specified");
577577
setBinds(binds);
578578
return this;
579579
}
580580

581581
public HostConfig withBinds(List<Bind> binds) {
582-
checkNotNull(binds, "binds was not specified");
582+
requireNonNull(binds, "binds was not specified");
583583
return withBinds(binds.toArray(new Bind[binds.size()]));
584584
}
585585

@@ -712,7 +712,7 @@ public HostConfig withDevices(Device... devices) {
712712
}
713713

714714
public HostConfig withDevices(List<Device> devices) {
715-
checkNotNull(devices, "devices was not specified");
715+
requireNonNull(devices, "devices was not specified");
716716
return withDevices(devices.toArray(new Device[0]));
717717
}
718718

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

735735
public HostConfig withDns(List<String> dns) {
736-
checkNotNull(dns, "dns was not specified");
736+
requireNonNull(dns, "dns was not specified");
737737
return withDns(dns.toArray(new String[0]));
738738
}
739739

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

748748
public HostConfig withDnsSearch(List<String> dnsSearch) {
749-
checkNotNull(dnsSearch, "dnsSearch was not specified");
749+
requireNonNull(dnsSearch, "dnsSearch was not specified");
750750
return withDnsSearch(dnsSearch.toArray(new String[0]));
751751
}
752752

@@ -775,13 +775,13 @@ public HostConfig withLinks(Links links) {
775775
}
776776

777777
public HostConfig withLinks(Link... links) {
778-
checkNotNull(links, "links was not specified");
778+
requireNonNull(links, "links was not specified");
779779
setLinks(links);
780780
return this;
781781
}
782782

783783
public HostConfig withLinks(List<Link> links) {
784-
checkNotNull(links, "links was not specified");
784+
requireNonNull(links, "links was not specified");
785785
return withLinks(links.toArray(new Link[0]));
786786
}
787787

@@ -894,13 +894,13 @@ public HostConfig withPortBindings(Ports portBindings) {
894894
}
895895

896896
public HostConfig withPortBindings(PortBinding... portBindings) {
897-
checkNotNull(portBindings, "portBindings was not specified");
897+
requireNonNull(portBindings, "portBindings was not specified");
898898
withPortBindings(new Ports(portBindings));
899899
return this;
900900
}
901901

902902
public HostConfig withPortBindings(List<PortBinding> portBindings) {
903-
checkNotNull(portBindings, "portBindings was not specified");
903+
requireNonNull(portBindings, "portBindings was not specified");
904904
return withPortBindings(portBindings.toArray(new PortBinding[0]));
905905
}
906906

@@ -985,7 +985,7 @@ public HostConfig withUlimits(Ulimit[] ulimits) {
985985
}
986986

987987
public HostConfig withUlimits(List<Ulimit> ulimits) {
988-
checkNotNull(ulimits, "no ulimits was specified");
988+
requireNonNull(ulimits, "no ulimits was specified");
989989
return withUlimits(ulimits.toArray(new Ulimit[0]));
990990
}
991991

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

10081008
public HostConfig withVolumesFrom(List<VolumesFrom> volumesFrom) {
1009-
checkNotNull(volumesFrom, "volumesFrom was not specified");
1009+
requireNonNull(volumesFrom, "volumesFrom was not specified");
10101010
return withVolumesFrom(volumesFrom.toArray(new VolumesFrom[0]));
10111011
}
10121012

‎docker-java-api/src/main/java/com/github/dockerjava/api/model/Identifier.java

Copy file name to clipboardExpand all lines: docker-java-api/src/main/java/com/github/dockerjava/api/model/Identifier.java
+6-9Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
package com.github.dockerjava.api.model;
22

3-
import com.google.common.base.MoreObjects;
4-
import com.google.common.base.Optional;
5-
63
import java.io.Serializable;
4+
import java.util.Optional;
75

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

21-
if (tag == null) {
22-
this.tag = Optional.absent();
23-
} else {
24-
this.tag = Optional.of(tag);
25-
}
19+
this.tag = Optional.ofNullable(tag);
2620
}
2721

2822
/**
@@ -55,6 +49,9 @@ public static Identifier fromCompoundString(String identifier) {
5549

5650
@Override
5751
public String toString() {
58-
return MoreObjects.toStringHelper(this).add("repository", repository).add("tag", tag).toString();
52+
return "Identifier{" +
53+
"repository=" + repository +
54+
", tag=" + tag +
55+
'}';
5956
}
6057
}

‎docker-java-api/src/main/java/com/github/dockerjava/api/model/Repository.java

Copy file name to clipboardExpand all lines: docker-java-api/src/main/java/com/github/dockerjava/api/model/Repository.java
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
import java.net.MalformedURLException;
55
import java.net.URL;
66

7-
import com.google.common.base.MoreObjects;
8-
97
/**
108
* A repository or image name.
119
*/
@@ -36,7 +34,9 @@ public URL getURL() throws MalformedURLException {
3634

3735
@Override
3836
public String toString() {
39-
return MoreObjects.toStringHelper(this).add("name", name).toString();
37+
return "Repository{" +
38+
"name='" + name + '\'' +
39+
'}';
4040
}
4141

4242
public String getPath() {

‎docker-java-api/src/main/java/com/github/dockerjava/api/model/RestartPolicy.java

Copy file name to clipboardExpand all lines: docker-java-api/src/main/java/com/github/dockerjava/api/model/RestartPolicy.java
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
package com.github.dockerjava.api.model;
22

3-
import static com.google.common.base.Preconditions.checkNotNull;
4-
53
import org.apache.commons.lang.builder.EqualsBuilder;
64
import org.apache.commons.lang.builder.HashCodeBuilder;
75

86
import com.fasterxml.jackson.annotation.JsonProperty;
97

108
import java.io.Serializable;
119

10+
import static java.util.Objects.requireNonNull;
11+
1212
/**
1313
* Container restart policy
1414
*
@@ -41,7 +41,7 @@ public RestartPolicy() {
4141
}
4242

4343
private RestartPolicy(int maximumRetryCount, String name) {
44-
checkNotNull(name, "name is null");
44+
requireNonNull(name, "name is null");
4545
this.maximumRetryCount = maximumRetryCount;
4646
this.name = name;
4747
}

‎docker-java-api/src/main/java/com/github/dockerjava/api/model/Ulimit.java

Copy file name to clipboardExpand all lines: docker-java-api/src/main/java/com/github/dockerjava/api/model/Ulimit.java
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
package com.github.dockerjava.api.model;
22

3-
import static com.google.common.base.Preconditions.checkNotNull;
4-
53
import org.apache.commons.lang.builder.EqualsBuilder;
64
import org.apache.commons.lang.builder.HashCodeBuilder;
75

86
import com.fasterxml.jackson.annotation.JsonProperty;
97

108
import java.io.Serializable;
119

10+
import static java.util.Objects.requireNonNull;
11+
1212
/**
1313
* @author Vangie Du (duwan@live.com)
1414
*/
@@ -28,7 +28,7 @@ public Ulimit() {
2828
}
2929

3030
public Ulimit(String name, int soft, int hard) {
31-
checkNotNull(name, "Name is null");
31+
requireNonNull(name, "Name is null");
3232
this.name = name;
3333
this.soft = soft;
3434
this.hard = hard;

‎docker-java-core/pom.xml

Copy file name to clipboardExpand all lines: docker-java-core/pom.xml
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@
4040
<version>${commons-compress.version}</version>
4141
</dependency>
4242

43+
<dependency>
44+
<groupId>com.google.guava</groupId>
45+
<artifactId>guava</artifactId>
46+
<version>${guava.version}</version>
47+
</dependency>
48+
4349
<dependency>
4450
<groupId>org.bouncycastle</groupId>
4551
<artifactId>bcpkix-jdk15on</artifactId>

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.