Skip to content

Commit c8609b8

Browse files
committed
Merge branch '5.1.x'
2 parents 4d17eb4 + 1cd1e93 commit c8609b8

File tree

4 files changed

+32
-37
lines changed

4 files changed

+32
-37
lines changed

build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ ext {
4747
slf4jVersion = "1.7.26" // spring-jcl + consistent 3rd party deps
4848
tiles3Version = "3.0.8"
4949
tomcatVersion = "9.0.17"
50-
undertowVersion = "2.0.19.Final"
50+
undertowVersion = "2.0.20.Final"
5151

5252
gradleScriptDir = "${rootProject.projectDir}/gradle"
5353
withoutJclOverSlf4J = {
@@ -143,7 +143,7 @@ configure(allprojects) { project ->
143143
}
144144

145145
checkstyle {
146-
toolVersion = "8.18"
146+
toolVersion = "8.19"
147147
configDir = rootProject.file("src/checkstyle")
148148
}
149149

@@ -157,7 +157,7 @@ configure(allprojects) { project ->
157157
testCompile("junit:junit:4.12") {
158158
exclude group: "org.hamcrest", module: "hamcrest-core"
159159
}
160-
testCompile("org.mockito:mockito-core:2.25.1") {
160+
testCompile("org.mockito:mockito-core:2.26.0") {
161161
exclude group: "org.hamcrest", module: "hamcrest-core"
162162
}
163163
testCompile("io.mockk:mockk:1.9.1")

spring-web/src/main/java/org/springframework/http/HttpRange.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,7 @@ else if (dashIdx == 0) {
170170
* @param ranges the list of ranges
171171
* @param resource the resource to select the regions from
172172
* @return the list of regions for the given resource
173-
* @throws IllegalArgumentException if the sum of all ranges exceeds the
174-
* resource length.
173+
* @throws IllegalArgumentException if the sum of all ranges exceeds the resource length
175174
* @since 4.3
176175
*/
177176
public static List<ResourceRegion> toResourceRegions(List<HttpRange> ranges, Resource resource) {
@@ -184,7 +183,10 @@ public static List<ResourceRegion> toResourceRegions(List<HttpRange> ranges, Res
184183
}
185184
if (ranges.size() > 1) {
186185
long length = getLengthFor(resource);
187-
long total = regions.stream().map(ResourceRegion::getCount).reduce(0L, (count, sum) -> sum + count);
186+
long total = 0;
187+
for (ResourceRegion region : regions) {
188+
total += region.getCount();
189+
}
188190
if (total >= length) {
189191
throw new IllegalArgumentException("The sum of all ranges (" + total +
190192
") should be less than the resource length (" + length + ")");

spring-web/src/main/java/org/springframework/web/util/UrlPathHelper.java

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import java.util.LinkedHashMap;
2222
import java.util.Map;
2323
import java.util.Properties;
24-
import javax.servlet.ServletContext;
2524
import javax.servlet.http.HttpServletRequest;
2625

2726
import org.apache.commons.logging.Log;
@@ -34,7 +33,7 @@
3433

3534
/**
3635
* Helper class for URL path matching. Provides support for URL paths in
37-
* RequestDispatcher includes and support for consistent URL decoding.
36+
* {@code RequestDispatcher} includes and support for consistent URL decoding.
3837
*
3938
* <p>Used by {@link org.springframework.web.servlet.handler.AbstractUrlHandlerMapping}
4039
* and {@link org.springframework.web.servlet.support.RequestContext} for path matching
@@ -44,6 +43,8 @@
4443
* @author Rob Harrop
4544
* @author Rossen Stoyanchev
4645
* @since 14.01.2004
46+
* @see #getLookupPathForRequest
47+
* @see javax.servlet.RequestDispatcher
4748
*/
4849
public class UrlPathHelper {
4950

@@ -70,8 +71,9 @@ public class UrlPathHelper {
7071

7172

7273
/**
73-
* Whether URL lookups should always use the full path within current
74-
* application context, i.e. within {@link ServletContext#getContextPath()}.
74+
* Whether URL lookups should always use the full path within the current
75+
* web application context, i.e. within
76+
* {@link javax.servlet.ServletContext#getContextPath()}.
7577
* <p>If set to {@literal false} the path within the current servlet mapping
7678
* is used instead if applicable (i.e. in the case of a prefix based Servlet
7779
* mapping such as "/myServlet/*").
@@ -157,8 +159,8 @@ protected String getDefaultEncoding() {
157159
* <p>Detects include request URL if called within a RequestDispatcher include.
158160
* @param request current HTTP request
159161
* @return the lookup path
160-
* @see #getPathWithinApplication
161162
* @see #getPathWithinServletMapping
163+
* @see #getPathWithinApplication
162164
*/
163165
public String getLookupPathForRequest(HttpServletRequest request) {
164166
// Always use full path within current servlet context?
@@ -207,6 +209,7 @@ public String getLookupPathForRequest(HttpServletRequest request, @Nullable Stri
207209
* <p>E.g.: servlet mapping = "/*.test"; request URI = "/a.test" -> "".
208210
* @param request current HTTP request
209211
* @return the path within the servlet mapping, or ""
212+
* @see #getLookupPathForRequest
210213
*/
211214
public String getPathWithinServletMapping(HttpServletRequest request) {
212215
String pathWithinApp = getPathWithinApplication(request);
@@ -254,6 +257,7 @@ public String getPathWithinServletMapping(HttpServletRequest request) {
254257
* <p>Detects include request URL if called within a RequestDispatcher include.
255258
* @param request current HTTP request
256259
* @return the path within the web application
260+
* @see #getLookupPathForRequest
257261
*/
258262
public String getPathWithinApplication(HttpServletRequest request) {
259263
String contextPath = getContextPath(request);
@@ -308,7 +312,7 @@ else if (index1 == requestUri.length()) {
308312
/**
309313
* Sanitize the given path. Uses the following rules:
310314
* <ul>
311-
* <li>replace all "//" by "/"</li>
315+
* <li>replace all "//" by "/"</li>
312316
* </ul>
313317
*/
314318
private String getSanitizedPath(final String path) {
@@ -512,8 +516,8 @@ protected String determineEncoding(HttpServletRequest request) {
512516

513517
/**
514518
* Remove ";" (semicolon) content from the given request URI if the
515-
* {@linkplain #setRemoveSemicolonContent(boolean) removeSemicolonContent}
516-
* property is set to "true". Note that "jssessionid" is always removed.
519+
* {@linkplain #setRemoveSemicolonContent removeSemicolonContent}
520+
* property is set to "true". Note that "jsessionid" is always removed.
517521
* @param requestUri the request URI string to remove ";" content from
518522
* @return the updated URI string
519523
*/
@@ -544,12 +548,10 @@ private String removeJsessionid(String requestUri) {
544548
}
545549

546550
/**
547-
* Decode the given URI path variables via
548-
* {@link #decodeRequestString(HttpServletRequest, String)} unless
549-
* {@link #setUrlDecode(boolean)} is set to {@code true} in which case it is
550-
* assumed the URL path from which the variables were extracted is already
551-
* decoded through a call to
552-
* {@link #getLookupPathForRequest(HttpServletRequest)}.
551+
* Decode the given URI path variables via {@link #decodeRequestString} unless
552+
* {@link #setUrlDecode} is set to {@code true} in which case it is assumed
553+
* the URL path from which the variables were extracted is already decoded
554+
* through a call to {@link #getLookupPathForRequest(HttpServletRequest)}.
553555
* @param request current HTTP request
554556
* @param vars the URI variables extracted from the URL path
555557
* @return the same Map or a new Map instance
@@ -566,18 +568,16 @@ public Map<String, String> decodePathVariables(HttpServletRequest request, Map<S
566568
}
567569

568570
/**
569-
* Decode the given matrix variables via
570-
* {@link #decodeRequestString(HttpServletRequest, String)} unless
571-
* {@link #setUrlDecode(boolean)} is set to {@code true} in which case it is
572-
* assumed the URL path from which the variables were extracted is already
573-
* decoded through a call to
574-
* {@link #getLookupPathForRequest(HttpServletRequest)}.
571+
* Decode the given matrix variables via {@link #decodeRequestString} unless
572+
* {@link #setUrlDecode} is set to {@code true} in which case it is assumed
573+
* the URL path from which the variables were extracted is already decoded
574+
* through a call to {@link #getLookupPathForRequest(HttpServletRequest)}.
575575
* @param request current HTTP request
576576
* @param vars the URI variables extracted from the URL path
577577
* @return the same Map or a new Map instance
578578
*/
579-
public MultiValueMap<String, String> decodeMatrixVariables(HttpServletRequest request,
580-
MultiValueMap<String, String> vars) {
579+
public MultiValueMap<String, String> decodeMatrixVariables(
580+
HttpServletRequest request, MultiValueMap<String, String> vars) {
581581

582582
if (this.urlDecode) {
583583
return vars;

spring-web/src/test/java/org/springframework/http/converter/json/Jackson2ObjectMapperBuilderTests.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,8 @@
8383
import org.springframework.beans.FatalBeanException;
8484
import org.springframework.util.StringUtils;
8585

86-
import static org.hamcrest.Matchers.containsString;
87-
import static org.hamcrest.Matchers.not;
88-
import static org.junit.Assert.assertEquals;
89-
import static org.junit.Assert.assertFalse;
90-
import static org.junit.Assert.assertNotNull;
91-
import static org.junit.Assert.assertNull;
92-
import static org.junit.Assert.assertSame;
93-
import static org.junit.Assert.assertThat;
94-
import static org.junit.Assert.assertTrue;
86+
import static org.hamcrest.Matchers.*;
87+
import static org.junit.Assert.*;
9588

9689
/**
9790
* Test class for {@link Jackson2ObjectMapperBuilder}.

0 commit comments

Comments
 (0)