diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/transport/DockerConnectionException.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/transport/DockerConnectionException.java index 04ab30477f..ec22850faa 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/transport/DockerConnectionException.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/transport/DockerConnectionException.java @@ -17,6 +17,7 @@ package org.springframework.boot.buildpack.platform.docker.transport; import org.springframework.util.Assert; +import org.springframework.util.StringUtils; /** * Exception thrown when connection to the Docker daemon fails. @@ -33,11 +34,11 @@ public class DockerConnectionException extends RuntimeException { } private static String buildMessage(String host, Exception cause) { - Assert.notNull(host, "host must not be null"); - Assert.notNull(cause, "cause must not be null"); + Assert.notNull(host, "Host must not be null"); + Assert.notNull(cause, "Cause must not be null"); StringBuilder message = new StringBuilder("Connection to the Docker daemon at '" + host + "' failed"); String causeMessage = getCauseMessage(cause); - if (causeMessage != null && !causeMessage.isEmpty()) { + if (StringUtils.hasText(causeMessage)) { message.append(" with error \"").append(causeMessage).append("\""); } message.append("; ensure the Docker daemon is running and accessible"); @@ -48,7 +49,6 @@ public class DockerConnectionException extends RuntimeException { if (cause.getCause() != null && cause.getCause().getClass().getName().equals(JNA_EXCEPTION_CLASS_NAME)) { return cause.getCause().getMessage(); } - return cause.getMessage(); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/docker/transport/DockerConnectionExceptionTests.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/docker/transport/DockerConnectionExceptionTests.java index b2bd4fb5b6..0501c5364c 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/docker/transport/DockerConnectionExceptionTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/docker/transport/DockerConnectionExceptionTests.java @@ -35,13 +35,13 @@ class DockerConnectionExceptionTests { @Test void createWhenHostIsNullThrowsException() { assertThatIllegalArgumentException().isThrownBy(() -> new DockerConnectionException(null, null)) - .withMessage("host must not be null"); + .withMessage("Host must not be null"); } @Test void createWhenCauseIsNullThrowsException() { assertThatIllegalArgumentException().isThrownBy(() -> new DockerConnectionException(HOST, null)) - .withMessage("cause must not be null"); + .withMessage("Cause must not be null"); } @Test diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/asciidoc/packaging-oci-image.adoc b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/asciidoc/packaging-oci-image.adoc index 7e8266aad8..af2cb95a06 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/asciidoc/packaging-oci-image.adoc +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/asciidoc/packaging-oci-image.adoc @@ -100,7 +100,7 @@ The builder can be specified on the command line as well, as shown in this examp [indent=0] ---- -$ gradle bootBuildImage --builder=mine/java-cnb-builder + $ gradle bootBuildImage --builder=mine/java-cnb-builder ---- @@ -164,5 +164,5 @@ The image name can be specified on the command line as well, as shown in this ex [indent=0] ---- -$ gradle bootBuildImage --imageName=example.com/library/my-app:v1 + $ gradle bootBuildImage --imageName=example.com/library/my-app:v1 ----