X Tutup
Skip to content

DOCKER_TLS_VERIFY cannot be 'false' or empty #519

@hongweiyi

Description

@hongweiyi

Test code:

@Test
public void withDockerTlsVerify() throws Exception {
    DockerClientConfig.DockerClientConfigBuilder builder = new DockerClientConfig.DockerClientConfigBuilder();
    // throw a IllegalArgumentException
    builder.withDockerTlsVerify("");
    // throw a IllegalArgumentException
    builder.withDockerTlsVerify("false");
}

Exception:

java.lang.IllegalArgumentException: The String did not match either specified value

    at org.apache.commons.lang.BooleanUtils.toBoolean(BooleanUtils.java:763)
    at com.github.dockerjava.core.DockerClientConfig$DockerClientConfigBuilder.withDockerTlsVerify(DockerClientConfig.java:421)
    at com.github.dockerjava.core.DockerClientConfigTest.withDockerTlsVerify(DockerClientConfigTest.java:183)
        ...

Problem code:

com.github.dockerjava.core.DockerClientConfig.DockerClientConfigBuilder#withDockerTlsVerify(java.lang.String)

public final DockerClientConfigBuilder withDockerTlsVerify(String dockerTlsVerify) {
    // The simplest way is to catch IllegalArgumentException and set false to dockerTlsVerify
    this.dockerTlsVerify = BooleanUtils.toBoolean(dockerTlsVerify.trim())
            || BooleanUtils.toBoolean(dockerTlsVerify.trim(), "1", "0");
    return this;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup