From 4c08c276f79e00f66d56344b9aca901f1b326e0c Mon Sep 17 00:00:00 2001 From: rstoyanchev Date: Wed, 13 Jul 2022 20:23:40 +0100 Subject: [PATCH] Avoid NPE in PathMatchConfigurer Closes gh-28816 --- .../servlet/config/annotation/PathMatchConfigurer.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/PathMatchConfigurer.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/PathMatchConfigurer.java index 67c96b0f8b..c3a57502dc 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/PathMatchConfigurer.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/PathMatchConfigurer.java @@ -151,9 +151,9 @@ public class PathMatchConfigurer { * {@code false} and use of this property becomes unnecessary. */ @Deprecated - public PathMatchConfigurer setUseSuffixPatternMatch(Boolean suffixPatternMatch) { + public PathMatchConfigurer setUseSuffixPatternMatch(@Nullable Boolean suffixPatternMatch) { this.suffixPatternMatch = suffixPatternMatch; - this.preferPathMatcher |= suffixPatternMatch; + this.preferPathMatcher |= (suffixPatternMatch != null && suffixPatternMatch); return this; } @@ -173,9 +173,9 @@ public class PathMatchConfigurer { * config options. */ @Deprecated - public PathMatchConfigurer setUseRegisteredSuffixPatternMatch(Boolean registeredSuffixPatternMatch) { + public PathMatchConfigurer setUseRegisteredSuffixPatternMatch(@Nullable Boolean registeredSuffixPatternMatch) { this.registeredSuffixPatternMatch = registeredSuffixPatternMatch; - this.preferPathMatcher |= registeredSuffixPatternMatch; + this.preferPathMatcher |= (registeredSuffixPatternMatch != null && registeredSuffixPatternMatch); return this; }