Merge branch '5.3.x'
# Conflicts: # build.gradle # spring-messaging/src/main/java/org/springframework/messaging/rsocket/DefaultRSocketRequesterBuilder.java # spring-messaging/src/main/java/org/springframework/messaging/rsocket/MetadataEncoder.java # spring-messaging/src/main/java/org/springframework/messaging/simp/broker/OrderedMessageChannelDecorator.java # spring-messaging/src/main/java/org/springframework/messaging/simp/user/DefaultUserDestinationResolver.java # spring-test/src/main/java/org/springframework/test/web/servlet/request/MockHttpServletRequestBuilder.java # spring-web/src/main/java/org/springframework/http/HttpRange.java # spring-webflux/src/main/java/org/springframework/web/reactive/result/view/RedirectView.java # spring-webflux/src/main/java/org/springframework/web/reactive/socket/CloseStatus.java # spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/RedirectViewControllerRegistration.java
This commit is contained in:
@@ -492,7 +492,7 @@ public final class ContentDisposition {
|
||||
* @see <a href="https://tools.ietf.org/html/rfc5987">RFC 5987</a>
|
||||
*/
|
||||
private static String decodeFilename(String filename, Charset charset) {
|
||||
Assert.notNull(filename, "'input' String` should not be null");
|
||||
Assert.notNull(filename, "'input' String should not be null");
|
||||
Assert.notNull(charset, "'charset' should not be null");
|
||||
byte[] value = filename.getBytes(charset);
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
@@ -603,10 +603,10 @@ public final class ContentDisposition {
|
||||
* @see <a href="https://tools.ietf.org/html/rfc5987">RFC 5987</a>
|
||||
*/
|
||||
private static String encodeFilename(String input, Charset charset) {
|
||||
Assert.notNull(input, "`input` is required");
|
||||
Assert.notNull(charset, "`charset` is required");
|
||||
Assert.notNull(input, "'input' is required");
|
||||
Assert.notNull(charset, "'charset' is required");
|
||||
Assert.isTrue(!StandardCharsets.US_ASCII.equals(charset), "ASCII does not require encoding");
|
||||
Assert.isTrue(UTF_8.equals(charset) || ISO_8859_1.equals(charset), "Only UTF-8 and ISO-8859-1 supported.");
|
||||
Assert.isTrue(UTF_8.equals(charset) || ISO_8859_1.equals(charset), "Only UTF-8 and ISO-8859-1 are supported");
|
||||
byte[] source = input.getBytes(charset);
|
||||
int len = source.length;
|
||||
StringBuilder sb = new StringBuilder(len << 1);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -65,7 +65,7 @@ public abstract class HttpRange {
|
||||
long contentLength = getLengthFor(resource);
|
||||
long start = getRangeStart(contentLength);
|
||||
long end = getRangeEnd(contentLength);
|
||||
Assert.isTrue(start < contentLength, "'position' exceeds the resource length " + contentLength);
|
||||
Assert.isTrue(start < contentLength, () -> "'position' exceeds the resource length " + contentLength);
|
||||
return new ResourceRegion(resource, start, end - start + 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -242,7 +242,7 @@ public abstract class Jackson2CodecSupport {
|
||||
JsonView annotation = getAnnotation(param, JsonView.class);
|
||||
if (annotation != null) {
|
||||
Class<?>[] classes = annotation.value();
|
||||
Assert.isTrue(classes.length == 1, JSON_VIEW_HINT_ERROR + param);
|
||||
Assert.isTrue(classes.length == 1, () -> JSON_VIEW_HINT_ERROR + param);
|
||||
hints = (hints != null ? hints : new HashMap<>(1));
|
||||
hints.put(JSON_VIEW_HINT, classes[0]);
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ public class BufferedImageHttpMessageConverter implements HttpMessageConverter<B
|
||||
*/
|
||||
public void setCacheDir(File cacheDir) {
|
||||
Assert.notNull(cacheDir, "'cacheDir' must not be null");
|
||||
Assert.isTrue(cacheDir.isDirectory(), "'cacheDir' is not a directory");
|
||||
Assert.isTrue(cacheDir.isDirectory(), () -> "'cacheDir' is not a directory: " + cacheDir);
|
||||
this.cacheDir = cacheDir;
|
||||
}
|
||||
|
||||
|
||||
@@ -432,7 +432,7 @@ public class FormHttpMessageConverter implements HttpMessageConverter<MultiValue
|
||||
StringBuilder builder = new StringBuilder();
|
||||
formData.forEach((name, values) -> {
|
||||
if (name == null) {
|
||||
Assert.isTrue(CollectionUtils.isEmpty(values), "Null name in form data: " + formData);
|
||||
Assert.isTrue(CollectionUtils.isEmpty(values), () -> "Null name in form data: " + formData);
|
||||
return;
|
||||
}
|
||||
values.forEach(value -> {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -94,7 +94,7 @@ class DefaultServerHttpRequestBuilder implements ServerHttpRequest.Builder {
|
||||
|
||||
@Override
|
||||
public ServerHttpRequest.Builder path(String path) {
|
||||
Assert.isTrue(path.startsWith("/"), "The path does not have a leading slash.");
|
||||
Assert.isTrue(path.startsWith("/"), () -> "The path does not have a leading slash: " + path);
|
||||
this.uriPath = path;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ class ServletServerHttpRequest extends AbstractServerHttpRequest {
|
||||
super(initUri(request), request.getContextPath() + servletPath, initHeaders(headers, request));
|
||||
|
||||
Assert.notNull(bufferFactory, "'bufferFactory' must not be null");
|
||||
Assert.isTrue(bufferSize > 0, "'bufferSize' must be higher than 0");
|
||||
Assert.isTrue(bufferSize > 0, "'bufferSize' must be greater than 0");
|
||||
|
||||
this.request = request;
|
||||
this.bufferFactory = bufferFactory;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -209,7 +209,7 @@ public abstract class AbstractRequestLoggingFilter extends OncePerRequestFilter
|
||||
* @since 3.0
|
||||
*/
|
||||
public void setMaxPayloadLength(int maxPayloadLength) {
|
||||
Assert.isTrue(maxPayloadLength >= 0, "'maxPayloadLength' should be larger than or equal to 0");
|
||||
Assert.isTrue(maxPayloadLength >= 0, "'maxPayloadLength' must be greater than or equal to 0");
|
||||
this.maxPayloadLength = maxPayloadLength;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -54,7 +54,7 @@ public class RelativeRedirectFilter extends OncePerRequestFilter {
|
||||
*/
|
||||
public void setRedirectStatus(HttpStatusCode status) {
|
||||
Assert.notNull(status, "Property 'redirectStatus' is required");
|
||||
Assert.isTrue(status.is3xxRedirection(), "Not a redirect status code");
|
||||
Assert.isTrue(status.is3xxRedirection(), () -> "Not a redirect status code: " + status);
|
||||
this.redirectStatus = status;
|
||||
}
|
||||
|
||||
|
||||
@@ -200,12 +200,12 @@ public class UrlPathHelper {
|
||||
* Return a previously {@link #getLookupPathForRequest resolved} lookupPath.
|
||||
* @param request the current request
|
||||
* @return the previously resolved lookupPath
|
||||
* @throws IllegalArgumentException if the not found
|
||||
* @throws IllegalArgumentException if the lookup path is not found
|
||||
* @since 5.3
|
||||
*/
|
||||
public static String getResolvedLookupPath(ServletRequest request) {
|
||||
String lookupPath = (String) request.getAttribute(PATH_ATTRIBUTE);
|
||||
Assert.notNull(lookupPath, "Expected lookupPath in request attribute \"" + PATH_ATTRIBUTE + "\".");
|
||||
Assert.notNull(lookupPath, () -> "Expected lookupPath in request attribute \"" + PATH_ATTRIBUTE + "\".");
|
||||
return lookupPath;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user