diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/Sanitizer.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/Sanitizer.java index 9298edb897c..c130e12719e 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/Sanitizer.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/Sanitizer.java @@ -81,9 +81,12 @@ public class Sanitizer { * @return the potentially sanitized value */ public Object sanitize(String key, Object value) { + if (value == null) { + return null; + } for (Pattern pattern : this.keysToSanitize) { if (pattern.matcher(key).matches()) { - return (value == null ? null : "******"); + return "******"; } } return value;