Skip to content

Commit efde763

Browse files
committed
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: geniusYoo <[email protected]>
1 parent e87d5d7 commit efde763

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,16 @@
3434
* {@link Status#OUT_OF_SERVICE} when a certificate is invalid.
3535
*
3636
* @author Jonatan Ivanov
37+
* @author geniuus
3738
* @since 3.4.0
3839
*/
3940
public class SslHealthIndicator extends AbstractHealthIndicator {
4041

4142
private final SslInfo sslInfo;
4243

4344
public SslHealthIndicator(SslInfo sslInfo) {
45+
super("SSL health check failed");
46+
Assert.notNull(sslInfo, "'sslInfo' must not be null");
4447
this.sslInfo = sslInfo;
4548
}
4649

0 commit comments

Comments
 (0)