Skip to content

Commit f9f7a7c

Browse files
committed
Polish contribution
See gh-30971
1 parent 6de95a2 commit f9f7a7c

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

spring-test/src/main/java/org/springframework/test/web/servlet/setup/StandaloneMockMvcBuilder.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -514,8 +514,8 @@ protected void addReturnValueHandlers(List<HandlerMethodReturnValueHandler> retu
514514
protected void addInterceptors(InterceptorRegistry registry) {
515515
for (MappedInterceptor interceptor : mappedInterceptors) {
516516
InterceptorRegistration registration = registry.addInterceptor(interceptor.getInterceptor());
517-
if (interceptor.getPathPatterns() != null) {
518-
registration.addPathPatterns(interceptor.getPathPatterns());
517+
if (interceptor.getIncludePathPatterns() != null) {
518+
registration.addPathPatterns(interceptor.getIncludePathPatterns());
519519
}
520520
}
521521
}

spring-webmvc/src/main/java/org/springframework/web/servlet/handler/MappedInterceptor.java

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2021 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -137,18 +137,21 @@ public MappedInterceptor(@Nullable String[] includePatterns, @Nullable String[]
137137

138138

139139
/**
140-
* Return the patterns this interceptor is mapped to.
140+
* Get the include path patterns this interceptor is mapped to.
141+
* @see #getIncludePathPatterns()
142+
* @see #getExcludePathPatterns()
143+
* @deprecated since 6.1 in favor of {@link #getIncludePathPatterns()}
141144
*/
142145
@Nullable
143-
@Deprecated
146+
@Deprecated(since = "6.1", forRemoval = true)
144147
public String[] getPathPatterns() {
145-
return (!ObjectUtils.isEmpty(this.includePatterns) ?
146-
Arrays.stream(this.includePatterns).map(PatternAdapter::getPatternString).toArray(String[]::new) :
147-
null);
148+
return getIncludePathPatterns();
148149
}
149150

150151
/**
151-
* Return the include path patterns this interceptor is mapped to.
152+
* Get the include path patterns this interceptor is mapped to.
153+
* @since 6.1
154+
* @see #getExcludePathPatterns()
152155
*/
153156
@Nullable
154157
public String[] getIncludePathPatterns() {
@@ -158,7 +161,9 @@ public String[] getIncludePathPatterns() {
158161
}
159162

160163
/**
161-
* Return the exclude path patterns this interceptor is mapped to.
164+
* Get the exclude path patterns this interceptor is mapped to.
165+
* @since 6.1
166+
* @see #getIncludePathPatterns()
162167
*/
163168
@Nullable
164169
public String[] getExcludePathPatterns() {

0 commit comments

Comments
 (0)