From c7188803540e256209a07d980d8a264b5c377a49 Mon Sep 17 00:00:00 2001 From: Johnny Lim Date: Sun, 29 Oct 2017 09:56:50 +0900 Subject: [PATCH] Handle null early in Sanitizer.sanitize() Closes gh-10806 --- .../org/springframework/boot/actuate/endpoint/Sanitizer.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/Sanitizer.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/Sanitizer.java index 50e453d957..bf8e5e22eb 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/Sanitizer.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/Sanitizer.java @@ -79,9 +79,12 @@ 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;