Skip to content

Commit 4c08c27

Browse files
committed
Avoid NPE in PathMatchConfigurer
Closes gh-28816
1 parent f814fb4 commit 4c08c27

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Diff for: spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/PathMatchConfigurer.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,9 @@ public PathMatchConfigurer addPathPrefix(String prefix, Predicate<Class<?>> pred
151151
* {@code false} and use of this property becomes unnecessary.
152152
*/
153153
@Deprecated
154-
public PathMatchConfigurer setUseSuffixPatternMatch(Boolean suffixPatternMatch) {
154+
public PathMatchConfigurer setUseSuffixPatternMatch(@Nullable Boolean suffixPatternMatch) {
155155
this.suffixPatternMatch = suffixPatternMatch;
156-
this.preferPathMatcher |= suffixPatternMatch;
156+
this.preferPathMatcher |= (suffixPatternMatch != null && suffixPatternMatch);
157157
return this;
158158
}
159159

@@ -173,9 +173,9 @@ public PathMatchConfigurer setUseSuffixPatternMatch(Boolean suffixPatternMatch)
173173
* config options.
174174
*/
175175
@Deprecated
176-
public PathMatchConfigurer setUseRegisteredSuffixPatternMatch(Boolean registeredSuffixPatternMatch) {
176+
public PathMatchConfigurer setUseRegisteredSuffixPatternMatch(@Nullable Boolean registeredSuffixPatternMatch) {
177177
this.registeredSuffixPatternMatch = registeredSuffixPatternMatch;
178-
this.preferPathMatcher |= registeredSuffixPatternMatch;
178+
this.preferPathMatcher |= (registeredSuffixPatternMatch != null && registeredSuffixPatternMatch);
179179
return this;
180180
}
181181

0 commit comments

Comments
 (0)