Skip to content

Commit dd2fc49

Browse files
committed
Merge pull request #470 from KostyaSha/smallFixes
Small fixes
2 parents 91729b2 + 373be76 commit dd2fc49

File tree

5 files changed

+26
-16
lines changed

5 files changed

+26
-16
lines changed

src/main/java/com/github/dockerjava/api/command/ListContainersCmd.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public interface ListContainersCmd extends SyncDockerCmd<List<Container>> {
3232
public Boolean hasShowSizeEnabled();
3333

3434
/**
35-
* @param beforeId
35+
* @param before
3636
* - Show only containers created before Id, include non-running ones.
3737
*/
3838
public ListContainersCmd withBefore(String before);
@@ -44,7 +44,7 @@ public interface ListContainersCmd extends SyncDockerCmd<List<Container>> {
4444
public ListContainersCmd withExitcodeFilter(Integer exitcode);
4545

4646
/**
47-
* @param exitcode
47+
* @param status
4848
* - Show only containers with the passed status (created|restarting|running|paused|exited).
4949
*/
5050
public ListContainersCmd withStatusFilter(String status);
@@ -80,7 +80,7 @@ public interface ListContainersCmd extends SyncDockerCmd<List<Container>> {
8080
public ListContainersCmd withShowSize(Boolean showSize);
8181

8282
/**
83-
* @param sinceId
83+
* @param since
8484
* - Show only containers created since Id, include non-running ones.
8585
*/
8686
public ListContainersCmd withSince(String since);

src/main/java/com/github/dockerjava/core/DockerClientConfig.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -164,16 +164,11 @@ private static Properties overrideDockerPropertiesWithSettingsFromUserHome(Prope
164164
Properties overriddenProperties = new Properties();
165165
overriddenProperties.putAll(p);
166166

167-
final File usersDockerPropertiesFile = new File(systemProperties.getProperty("user.home"), "."
168-
+ DOCKER_JAVA_PROPERTIES);
167+
final File usersDockerPropertiesFile = new File(systemProperties.getProperty("user.home"),
168+
"." + DOCKER_JAVA_PROPERTIES);
169169
if (usersDockerPropertiesFile.isFile()) {
170-
try {
171-
final FileInputStream in = new FileInputStream(usersDockerPropertiesFile);
172-
try {
173-
overriddenProperties.load(in);
174-
} finally {
175-
in.close();
176-
}
170+
try (FileInputStream in = new FileInputStream(usersDockerPropertiesFile)) {
171+
overriddenProperties.load(in);
177172
} catch (IOException e) {
178173
throw new RuntimeException(e);
179174
}
@@ -381,6 +376,12 @@ public final DockerClientConfigBuilder withDockerHost(String dockerHost) {
381376
return this;
382377
}
383378

379+
380+
public final DockerClientConfigBuilder withApiVersion(RemoteApiVersion apiVersion) {
381+
this.apiVersion = apiVersion.getVersion();
382+
return this;
383+
}
384+
384385
public final DockerClientConfigBuilder withApiVersion(String apiVersion) {
385386
this.apiVersion = apiVersion;
386387
return this;

src/main/java/com/github/dockerjava/core/RemoteApiVersion.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
package com.github.dockerjava.core;
22

3-
import java.io.Serializable;
4-
import java.util.regex.Matcher;
5-
import java.util.regex.Pattern;
6-
73
import com.google.common.base.MoreObjects;
84
import com.google.common.base.Objects;
95
import com.google.common.base.Preconditions;
106
import com.google.common.base.Strings;
117

8+
import java.io.Serializable;
9+
import java.util.regex.Matcher;
10+
import java.util.regex.Pattern;
11+
1212
/**
1313
* Bean to encapsulate the version of the <a href="http://docs.docker.com/engine/reference/api/docker_remote_api/">Docker Remote (REST)
1414
* API</a>
@@ -125,6 +125,13 @@ public boolean isGreaterOrEqual(final RemoteApiVersion other) {
125125
return false;
126126
}
127127

128+
/**
129+
* @return String representation of version. i.e. "1.22"
130+
*/
131+
public String getVersion() {
132+
return major + "." + minor;
133+
}
134+
128135
// CHECKSTYLE:OFF
129136
@Override
130137
public boolean equals(final Object o) {

src/test/java/com/github/dockerjava/core/command/ListContainersCmdImplTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public void afterMethod(ITestResult result) {
5252
super.afterMethod(result);
5353
}
5454

55+
@Test
5556
public void testListContainers() throws Exception {
5657

5758
String testImage = "busybox";

src/test/java/com/github/dockerjava/netty/exec/ListContainersCmdExecTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public void afterMethod(ITestResult result) {
5454
super.afterMethod(result);
5555
}
5656

57+
@Test
5758
public void testListContainers() throws Exception {
5859

5960
String testImage = "busybox";

0 commit comments

Comments
 (0)