From c583dbf5302df4102b25c9efd8d40efe0aa5f206 Mon Sep 17 00:00:00 2001 From: geniuus Date: Mon, 7 Apr 2025 01:36:38 +0900 Subject: [PATCH 1/5] fix: Validate sslInfo is not null in SslHealthIndicator constructor The SslHealthIndicator constructor previously did not validate if the provided SslInfo instance was null. This could potentially lead to a NullPointerException later when the doHealthCheck method is invoked if the SslInfo bean was not properly configured or available. This commit adds an Assert.notNull check for the sslInfo parameter to ensure fail-fast behavior during application startup or bean creation. This aligns with the common practice in other Spring Boot components and health indicators where essential dependencies are validated in the constructor. Signed-off-by: geniuus --- .../springframework/boot/actuate/ssl/SslHealthIndicator.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/ssl/SslHealthIndicator.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/ssl/SslHealthIndicator.java index 18d8f2e19320..276ed5be9a77 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/ssl/SslHealthIndicator.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/ssl/SslHealthIndicator.java @@ -34,6 +34,7 @@ * {@link Status#OUT_OF_SERVICE} when a certificate is invalid. * * @author Jonatan Ivanov + * @author geniuus * @since 3.4.0 */ public class SslHealthIndicator extends AbstractHealthIndicator { @@ -41,6 +42,8 @@ public class SslHealthIndicator extends AbstractHealthIndicator { private final SslInfo sslInfo; public SslHealthIndicator(SslInfo sslInfo) { + super("SSL health check failed"); + Assert.notNull(sslInfo, "'sslInfo' must not be null"); this.sslInfo = sslInfo; } From 22187f3b02bf93a6b60f29ca80cb2504c20a4dfe Mon Sep 17 00:00:00 2001 From: geniuus Date: Mon, 7 Apr 2025 01:43:54 +0900 Subject: [PATCH 2/5] chore : fix author author mismatch geniuus -> geniusYoo Signed-off-by: geniuus --- .../springframework/boot/actuate/ssl/SslHealthIndicator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/ssl/SslHealthIndicator.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/ssl/SslHealthIndicator.java index 276ed5be9a77..3b86655bcf32 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/ssl/SslHealthIndicator.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/ssl/SslHealthIndicator.java @@ -34,7 +34,7 @@ * {@link Status#OUT_OF_SERVICE} when a certificate is invalid. * * @author Jonatan Ivanov - * @author geniuus + * @author geniusYoo * @since 3.4.0 */ public class SslHealthIndicator extends AbstractHealthIndicator { From 4d38802fafa6e1e5a0cfd2842ce3aa3fa8fa21a5 Mon Sep 17 00:00:00 2001 From: geniuus Date: Mon, 7 Apr 2025 02:10:55 +0900 Subject: [PATCH 3/5] chore : fix author author mismatch geniusYoo -> geniuus Signed-off-by: geniuus --- .../springframework/boot/actuate/ssl/SslHealthIndicator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/ssl/SslHealthIndicator.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/ssl/SslHealthIndicator.java index 3b86655bcf32..276ed5be9a77 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/ssl/SslHealthIndicator.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/ssl/SslHealthIndicator.java @@ -34,7 +34,7 @@ * {@link Status#OUT_OF_SERVICE} when a certificate is invalid. * * @author Jonatan Ivanov - * @author geniusYoo + * @author geniuus * @since 3.4.0 */ public class SslHealthIndicator extends AbstractHealthIndicator { From 630d0462bf32eecfe851a0d2e48d3fb4b0eab848 Mon Sep 17 00:00:00 2001 From: geniuus Date: Mon, 7 Apr 2025 15:32:41 +0900 Subject: [PATCH 4/5] fix: Add missing import for Assert in SslHealthIndicator The previous commit introduced an `Assert.notNull` check in the SslHealthIndicator constructor but missed the required import for `org.springframework.util.Assert`. This caused the pull request build to fail. This commit adds the necessary import statement to resolve the compilation error. Signed-off-by: geniuus --- .../org/springframework/boot/actuate/ssl/SslHealthIndicator.java | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/ssl/SslHealthIndicator.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/ssl/SslHealthIndicator.java index 276ed5be9a77..4262c2807a29 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/ssl/SslHealthIndicator.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/ssl/SslHealthIndicator.java @@ -28,6 +28,7 @@ import org.springframework.boot.info.SslInfo.BundleInfo; import org.springframework.boot.info.SslInfo.CertificateChainInfo; import org.springframework.boot.info.SslInfo.CertificateInfo; +import org.springframework.util.Assert; /** * {@link HealthIndicator} that checks the certificates the application uses and reports From 71b7534ba2ccf327289f2b8f95e616df49a9f4b1 Mon Sep 17 00:00:00 2001 From: geniuus Date: Mon, 7 Apr 2025 15:33:20 +0900 Subject: [PATCH 5/5] style: Correct @author tag format in SslHealthIndicator Update the Javadoc @author tag in SslHealthIndicator.java to use the ` ` format (Young Jae You) instead of the GitHub handle. This change addresses the feedback provided in the pull request review and aligns the format with Spring project conventions. Signed-off-by: geniuus --- .../springframework/boot/actuate/ssl/SslHealthIndicator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/ssl/SslHealthIndicator.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/ssl/SslHealthIndicator.java index 4262c2807a29..290852888abb 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/ssl/SslHealthIndicator.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/ssl/SslHealthIndicator.java @@ -35,7 +35,7 @@ * {@link Status#OUT_OF_SERVICE} when a certificate is invalid. * * @author Jonatan Ivanov - * @author geniuus + * @author Young Jae You * @since 3.4.0 */ public class SslHealthIndicator extends AbstractHealthIndicator {