Skip to content

Commit a234ef6

Browse files
author
Marcus Linke
committed
Merge branch 'fb-annotations' of https://github.com/KostyaSha/docker-java into KostyaSha-fb-annotations
2 parents bf3b409 + 92ac07d commit a234ef6

File tree

11 files changed

+45
-24
lines changed

11 files changed

+45
-24
lines changed

pom.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,25 @@
373373
<groupId>org.apache.maven.plugins</groupId>
374374
<artifactId>maven-source-plugin</artifactId>
375375
</plugin>
376+
<plugin>
377+
<groupId>org.codehaus.mojo</groupId>
378+
<artifactId>findbugs-maven-plugin</artifactId>
379+
<version>3.0.2</version>
380+
<configuration>
381+
<effort>Max</effort>
382+
<threshold>Low</threshold>
383+
<xmlOutput>true</xmlOutput>
384+
<!-- until all will be fixed -->
385+
<failOnError>false</failOnError>
386+
</configuration>
387+
<executions>
388+
<execution>
389+
<goals>
390+
<goal>check</goal>
391+
</goals>
392+
</execution>
393+
</executions>
394+
</plugin>
376395
</plugins>
377396
</build>
378397

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,8 @@ public static File archiveTARFiles(File base, Iterable<File> files, String archi
2525
TarArchiveEntry tarEntry = new TarArchiveEntry(file);
2626
tarEntry.setName(relativize(base, file));
2727

28-
if (!file.isDirectory()) {
29-
if (file.canExecute()) {
30-
tarEntry.setMode(tarEntry.getMode() | 0755);
31-
}
28+
if (!file.isDirectory() && file.canExecute()) {
29+
tarEntry.setMode(tarEntry.getMode() | 0755);
3230
}
3331

3432
tos.putArchiveEntry(tarEntry);

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import java.io.File;
1010
import java.io.FileInputStream;
1111
import java.io.IOException;
12+
import java.io.InputStream;
1213
import java.io.Serializable;
1314
import java.net.URI;
1415
import java.util.Collections;
@@ -85,9 +86,9 @@ public class DockerClientConfig implements Serializable {
8586
}
8687

8788
private static Properties loadIncludedDockerProperties(Properties systemProperties) {
88-
try {
89+
try (InputStream is = DockerClientConfig.class.getResourceAsStream("/" + DOCKER_IO_PROPERTIES_PROPERTY)) {
8990
Properties p = new Properties();
90-
p.load(DockerClientConfig.class.getResourceAsStream("/" + DOCKER_IO_PROPERTIES_PROPERTY));
91+
p.load(is);
9192
replaceProperties(p, systemProperties);
9293
return p;
9394
} catch (IOException e) {

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,8 @@ static ScanResult scanChunk(String pattern) {
113113
Scan: for (i = 0; i < pattern.length(); i++) {
114114
switch (pattern.charAt(i)) {
115115
case '\\': {
116-
if (!IS_WINDOWS) {
117-
// error check handled in matchChunk: bad pattern.
118-
if (i + 1 < pattern.length()) {
119-
i++;
120-
}
116+
if (!IS_WINDOWS && i + 1 < pattern.length()) {
117+
i++;
121118
}
122119
break;
123120
}

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ public KeystoreSSLConfig(File pfxFile, String password) throws KeyStoreException
5757
checkNotNull(pfxFile);
5858
checkNotNull(password);
5959
keystore = KeyStore.getInstance("pkcs12");
60-
keystore.load(new FileInputStream(pfxFile), password.toCharArray());
60+
try (FileInputStream fs = new FileInputStream(pfxFile)) {
61+
keystore.load(fs, password.toCharArray());
62+
}
6163
keystorePassword = password;
6264
}
6365

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,8 @@ public static RemoteApiVersion parseConfigWithDefault(final String version) {
8080
}
8181

8282
public boolean isGreaterOrEqual(final RemoteApiVersion other) {
83-
if (major >= other.major) {
84-
if (minor >= other.minor) {
85-
return true;
86-
}
83+
if (major >= other.major && minor >= other.minor) {
84+
return true;
8785
}
8886
return false;
8987
}

src/main/java/com/github/dockerjava/core/command/BuildImageResultCallback.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
import com.github.dockerjava.api.model.BuildResponseItem;
1313
import com.github.dockerjava.core.async.ResultCallbackTemplate;
1414

15+
import javax.annotation.CheckForNull;
16+
1517
/**
1618
*
1719
* @author marcus
@@ -21,6 +23,7 @@ public class BuildImageResultCallback extends ResultCallbackTemplate<BuildImageR
2123

2224
private final static Logger LOGGER = LoggerFactory.getLogger(BuildImageResultCallback.class);
2325

26+
@CheckForNull
2427
private BuildResponseItem latestItem = null;
2528

2629
@Override

src/main/java/com/github/dockerjava/core/command/PullImageResultCallback.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
import com.github.dockerjava.api.model.PullResponseItem;
1111
import com.github.dockerjava.core.async.ResultCallbackTemplate;
1212

13+
import javax.annotation.CheckForNull;
14+
1315
/**
1416
*
1517
* @author marcus
@@ -19,6 +21,7 @@ public class PullImageResultCallback extends ResultCallbackTemplate<PullImageRes
1921

2022
private final static Logger LOGGER = LoggerFactory.getLogger(PullImageResultCallback.class);
2123

24+
@CheckForNull
2225
private PullResponseItem latestItem = null;
2326

2427
@Override

src/main/java/com/github/dockerjava/core/command/PushImageResultCallback.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
import com.github.dockerjava.api.model.PushResponseItem;
1111
import com.github.dockerjava.core.async.ResultCallbackTemplate;
1212

13+
import javax.annotation.CheckForNull;
14+
1315
/**
1416
*
1517
* @author marcus
@@ -19,6 +21,7 @@ public class PushImageResultCallback extends ResultCallbackTemplate<PushImageRes
1921

2022
private final static Logger LOGGER = LoggerFactory.getLogger(PushImageResultCallback.class);
2123

24+
@CheckForNull
2225
private PushResponseItem latestItem = null;
2326

2427
@Override

src/main/java/com/github/dockerjava/jaxrs/connector/ApacheConnector.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -213,12 +213,10 @@ class ApacheConnector implements Connector {
213213
if (config != null) {
214214
final Object connectionManager = config.getProperties().get(ApacheClientProperties.CONNECTION_MANAGER);
215215

216-
if (connectionManager != null) {
217-
if (!(connectionManager instanceof HttpClientConnectionManager)) {
218-
LOGGER.log(Level.WARNING, LocalizationMessages.IGNORING_VALUE_OF_PROPERTY(
219-
ApacheClientProperties.CONNECTION_MANAGER, connectionManager.getClass().getName(),
220-
HttpClientConnectionManager.class.getName()));
221-
}
216+
if (connectionManager != null && !(connectionManager instanceof HttpClientConnectionManager)) {
217+
LOGGER.log(Level.WARNING, LocalizationMessages.IGNORING_VALUE_OF_PROPERTY(
218+
ApacheClientProperties.CONNECTION_MANAGER, connectionManager.getClass().getName(),
219+
HttpClientConnectionManager.class.getName()));
222220
}
223221

224222
reqConfig = config.getProperties().get(ApacheClientProperties.REQUEST_CONFIG);

0 commit comments

Comments
 (0)