Skip to content

Commit aaaa791

Browse files
geniusYoomhalbritter
authored andcommitted
Validate that 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. See gh-45013 Signed-off-by: geniuus <cross_man@naver.com>
1 parent 63adda6 commit aaaa791

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/ssl/SslHealthIndicator.java

+4
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,23 @@
2828
import org.springframework.boot.info.SslInfo.BundleInfo;
2929
import org.springframework.boot.info.SslInfo.CertificateChainInfo;
3030
import org.springframework.boot.info.SslInfo.CertificateInfo;
31+
import org.springframework.util.Assert;
3132

3233
/**
3334
* {@link HealthIndicator} that checks the certificates the application uses and reports
3435
* {@link Status#OUT_OF_SERVICE} when a certificate is invalid.
3536
*
3637
* @author Jonatan Ivanov
38+
* @author Young Jae You
3739
* @since 3.4.0
3840
*/
3941
public class SslHealthIndicator extends AbstractHealthIndicator {
4042

4143
private final SslInfo sslInfo;
4244

4345
public SslHealthIndicator(SslInfo sslInfo) {
46+
super("SSL health check failed");
47+
Assert.notNull(sslInfo, "'sslInfo' must not be null");
4448
this.sslInfo = sslInfo;
4549
}
4650

0 commit comments

Comments
 (0)