Skip to content

Commit 6a58761

Browse files
committed
Close streams
1 parent 39339b9 commit 6a58761

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

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/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

0 commit comments

Comments
 (0)