Skip to content

Commit 92e32a6

Browse files
authored
Merge pull request #605 from KostyaSha/FBAnnotations
Allow null value. boolean <-> Boolean error
2 parents 2f8d317 + 019770c commit 92e32a6

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

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

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

33
import static com.google.common.base.Preconditions.checkNotNull;
4+
import static org.apache.commons.lang.BooleanUtils.isTrue;
45

56
import java.io.File;
67
import java.io.FileInputStream;
@@ -319,7 +320,7 @@ public static class Builder {
319320
private String apiVersion, registryUsername, registryPassword, registryEmail, registryUrl, dockerConfig,
320321
dockerCertPath;
321322

322-
private boolean dockerTlsVerify;
323+
private Boolean dockerTlsVerify;
323324

324325
private SSLConfig customSslConfig = null;
325326

@@ -419,7 +420,7 @@ public DefaultDockerClientConfig build() {
419420
SSLConfig sslConfig = null;
420421

421422
if (customSslConfig == null) {
422-
if (dockerTlsVerify) {
423+
if (isTrue(dockerTlsVerify)) {
423424
dockerCertPath = checkDockerCertPath(dockerCertPath);
424425
sslConfig = new LocalDirectorySSLConfig(dockerCertPath);
425426
}

src/test/java/com/github/dockerjava/core/DefaultDockerClientConfigTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -180,25 +180,25 @@ public void withDockerTlsVerify() throws Exception {
180180
field.setAccessible(true);
181181

182182
builder.withDockerTlsVerify("");
183-
assertThat(field.getBoolean(builder), is(false));
183+
assertThat((Boolean) field.get(builder), is(false));
184184

185185
builder.withDockerTlsVerify("false");
186-
assertThat(field.getBoolean(builder), is(false));
186+
assertThat((Boolean) field.get(builder), is(false));
187187

188188
builder.withDockerTlsVerify("FALSE");
189-
assertThat(field.getBoolean(builder), is(false));
189+
assertThat((Boolean) field.get(builder), is(false));
190190

191191
builder.withDockerTlsVerify("true");
192-
assertThat(field.getBoolean(builder), is(true));
192+
assertThat((Boolean) field.get(builder), is(true));
193193

194194
builder.withDockerTlsVerify("TRUE");
195-
assertThat(field.getBoolean(builder), is(true));
195+
assertThat((Boolean) field.get(builder), is(true));
196196

197197
builder.withDockerTlsVerify("0");
198-
assertThat(field.getBoolean(builder), is(false));
198+
assertThat((Boolean) field.get(builder), is(false));
199199

200200
builder.withDockerTlsVerify("1");
201-
assertThat(field.getBoolean(builder), is(true));
201+
assertThat((Boolean) field.get(builder), is(true));
202202
}
203203

204204
}

0 commit comments

Comments
 (0)