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:
commit
82823517fa
|
@ -177,7 +177,7 @@ public abstract class DataBufferUtils {
|
|||
if (options.length > 0) {
|
||||
for (OpenOption option : options) {
|
||||
Assert.isTrue(!(option == StandardOpenOption.APPEND || option == StandardOpenOption.WRITE),
|
||||
"'" + option + "' not allowed");
|
||||
() -> "'" + option + "' not allowed");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
@ -103,7 +103,7 @@ final class DefaultRSocketRequesterBuilder implements RSocketRequester.Builder {
|
|||
|
||||
@Override
|
||||
public RSocketRequester.Builder metadataMimeType(MimeType mimeType) {
|
||||
Assert.notNull(mimeType, "`metadataMimeType` is required");
|
||||
Assert.notNull(mimeType, "'metadataMimeType' is required");
|
||||
this.metadataMimeType = mimeType;
|
||||
return this;
|
||||
}
|
||||
|
@ -281,7 +281,7 @@ final class DefaultRSocketRequesterBuilder implements RSocketRequester.Builder {
|
|||
Mono<DataBuffer> dataMono = Mono.empty();
|
||||
if (data != null) {
|
||||
ReactiveAdapter adapter = strategies.reactiveAdapterRegistry().getAdapter(data.getClass());
|
||||
Assert.isTrue(adapter == null || !adapter.isMultiValue(), "Expected single value: " + data);
|
||||
Assert.isTrue(adapter == null || !adapter.isMultiValue(), () -> "Expected single value: " + data);
|
||||
Mono<?> mono = (adapter != null ? Mono.from(adapter.toPublisher(data)) : Mono.just(data));
|
||||
dataMono = mono.map(value -> {
|
||||
ResolvableType type = ResolvableType.forClass(value.getClass());
|
||||
|
|
|
@ -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.
|
||||
|
@ -141,7 +141,8 @@ final class MetadataEncoder {
|
|||
}
|
||||
ReactiveAdapter adapter = this.strategies.reactiveAdapterRegistry().getAdapter(metadata.getClass());
|
||||
if (adapter != null) {
|
||||
Assert.isTrue(!adapter.isMultiValue(), "Expected single value: " + metadata);
|
||||
Object originalMetadata = metadata;
|
||||
Assert.isTrue(!adapter.isMultiValue(), () -> "Expected single value: " + originalMetadata);
|
||||
metadata = Mono.from(adapter.toPublisher(metadata)).defaultIfEmpty(NO_VALUE);
|
||||
this.hasAsyncValues = true;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2020 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.
|
||||
|
@ -421,7 +421,7 @@ public class RSocketMessageHandler extends MessageMappingMessageHandler {
|
|||
String str = setupPayload.dataMimeType();
|
||||
MimeType dataMimeType = StringUtils.hasText(str) ? MimeTypeUtils.parseMimeType(str) : this.defaultDataMimeType;
|
||||
Assert.notNull(dataMimeType, "No `dataMimeType` in ConnectionSetupPayload and no default value");
|
||||
Assert.isTrue(isDataMimeTypeSupported(dataMimeType), "Data MimeType '" + dataMimeType + "' not supported");
|
||||
Assert.isTrue(isDataMimeTypeSupported(dataMimeType), () -> "Data MimeType '" + dataMimeType + "' not supported");
|
||||
|
||||
str = setupPayload.metadataMimeType();
|
||||
MimeType metaMimeType = StringUtils.hasText(str) ? MimeTypeUtils.parseMimeType(str) : this.defaultMetadataMimeType;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 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.
|
||||
|
@ -138,7 +138,7 @@ public class SimpMessagingTemplate extends AbstractMessageSendingTemplate<String
|
|||
*/
|
||||
@Override
|
||||
public void send(Message<?> message) {
|
||||
Assert.notNull(message, "Message is required");
|
||||
Assert.notNull(message, "Message must not be null");
|
||||
String destination = SimpMessageHeaderAccessor.getDestination(message.getHeaders());
|
||||
if (destination != null) {
|
||||
sendInternal(message);
|
||||
|
@ -224,7 +224,8 @@ public class SimpMessagingTemplate extends AbstractMessageSendingTemplate<String
|
|||
throws MessagingException {
|
||||
|
||||
Assert.notNull(user, "User must not be null");
|
||||
Assert.isTrue(!user.contains("%2F"), "Invalid sequence \"%2F\" in user name: " + user);
|
||||
String username = user;
|
||||
Assert.isTrue(!user.contains("%2F"), () -> "Invalid sequence \"%2F\" in user name: " + username);
|
||||
user = StringUtils.replace(user, "/", "%2F");
|
||||
destination = destination.startsWith("/") ? destination : "/" + destination;
|
||||
super.convertAndSend(this.destinationPrefix + user + destination, payload, headers, postProcessor);
|
||||
|
|
|
@ -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.
|
||||
|
@ -148,7 +148,7 @@ public class OrderedMessageChannelDecorator implements MessageChannel {
|
|||
public static void configureInterceptor(MessageChannel channel, boolean preserveOrder) {
|
||||
if (preserveOrder) {
|
||||
Assert.isInstanceOf(ExecutorSubscribableChannel.class, channel,
|
||||
"An ExecutorSubscribableChannel is required for `preservePublishOrder`");
|
||||
"An ExecutorSubscribableChannel is required for 'preservePublishOrder'");
|
||||
ExecutorSubscribableChannel execChannel = (ExecutorSubscribableChannel) channel;
|
||||
if (execChannel.getInterceptors().stream().noneMatch(i -> i instanceof CallbackInterceptor)) {
|
||||
execChannel.addInterceptor(0, new CallbackInterceptor());
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2020 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.
|
||||
|
@ -212,7 +212,7 @@ public class StompHeaders implements MultiValueMap<String, String>, Serializable
|
|||
}
|
||||
Arrays.stream(acceptVersions).forEach(version ->
|
||||
Assert.isTrue(version != null && (version.equals("1.1") || version.equals("1.2")),
|
||||
"Invalid version: " + version));
|
||||
() -> "Invalid version: " + version));
|
||||
set(ACCEPT_VERSION, StringUtils.arrayToCommaDelimitedString(acceptVersions));
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
@ -179,7 +179,7 @@ public class DefaultUserDestinationResolver implements UserDestinationResolver {
|
|||
}
|
||||
Principal principal = SimpMessageHeaderAccessor.getUser(headers);
|
||||
String user = (principal != null ? principal.getName() : null);
|
||||
Assert.isTrue(user == null || !user.contains("%2F"), "Invalid sequence \"%2F\" in user name: " + user);
|
||||
Assert.isTrue(user == null || !user.contains("%2F"), () -> "Invalid sequence \"%2F\" in user name: " + user);
|
||||
Set<String> sessionIds = Collections.singleton(sessionId);
|
||||
return new ParseResult(sourceDestination, actualDestination, sourceDestination, sessionIds, user);
|
||||
}
|
||||
|
|
|
@ -234,7 +234,7 @@ class DefaultWebTestClientBuilder implements WebTestClient.Builder {
|
|||
|
||||
@Override
|
||||
public WebTestClient.Builder entityExchangeResultConsumer(Consumer<EntityExchangeResult<?>> entityResultConsumer) {
|
||||
Assert.notNull(entityResultConsumer, "`entityResultConsumer` is required");
|
||||
Assert.notNull(entityResultConsumer, "'entityResultConsumer' is required");
|
||||
this.entityResultConsumer = this.entityResultConsumer.andThen(entityResultConsumer);
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -148,7 +148,7 @@ public class MockHttpServletRequestBuilder
|
|||
private static URI initUri(String url, Object[] vars) {
|
||||
Assert.notNull(url, "'url' must not be null");
|
||||
Assert.isTrue(url.isEmpty() || url.startsWith("/") || url.startsWith("http://") || url.startsWith("https://"),
|
||||
"'url' should start with a path or be a complete HTTP URL: " + url);
|
||||
() -> "'url' should start with a path or be a complete HTTP URL: " + url);
|
||||
return UriComponentsBuilder.fromUriString(url).buildAndExpand(vars).encode().toUri();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 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.
|
||||
|
@ -42,8 +42,8 @@ public class HybridContextLoader extends AbstractGenericContextLoader {
|
|||
|
||||
@Override
|
||||
protected void validateMergedContextConfiguration(MergedContextConfiguration mergedConfig) {
|
||||
Assert.isTrue(mergedConfig.hasClasses() || mergedConfig.hasLocations(), getClass().getSimpleName()
|
||||
+ " requires either classes or locations");
|
||||
Assert.isTrue(mergedConfig.hasResources(),
|
||||
() -> getClass().getSimpleName() + " requires either classes or locations");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
@ -31,8 +31,8 @@ import org.springframework.web.server.ServerWebExchange;
|
|||
* ensure all conditions match a given request.
|
||||
*
|
||||
* <p>When {@code CompositeRequestCondition} instances are combined or compared
|
||||
* they are expected to (a) contain the same number of conditions and (b) that
|
||||
* conditions in the respective index are of the same type. It is acceptable to
|
||||
* is expected that (a) they contain the same number of conditions and (b)
|
||||
* conditions at the same index are of the same type. It is acceptable to
|
||||
* provide {@code null} conditions or no conditions at all to the constructor.
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
|
@ -105,7 +105,7 @@ public class CompositeRequestCondition extends AbstractRequestCondition<Composit
|
|||
|
||||
/**
|
||||
* If one instance is empty, return the other.
|
||||
* If both instances have conditions, combine the individual conditions
|
||||
* <p>If both instances have conditions, combine the individual conditions
|
||||
* after ensuring they are of the same type and number.
|
||||
*/
|
||||
@Override
|
||||
|
@ -131,8 +131,8 @@ public class CompositeRequestCondition extends AbstractRequestCondition<Composit
|
|||
|
||||
private void assertNumberOfConditions(CompositeRequestCondition other) {
|
||||
Assert.isTrue(getLength() == other.getLength(),
|
||||
"Cannot combine CompositeRequestConditions with a different number of conditions. " +
|
||||
ObjectUtils.nullSafeToString(this.requestConditions) + " and " +
|
||||
() -> "Cannot combine CompositeRequestConditions with a different number of conditions. " +
|
||||
ObjectUtils.nullSafeToString(this.requestConditions) + " and " +
|
||||
ObjectUtils.nullSafeToString(other.requestConditions));
|
||||
}
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ public class RedirectView extends AbstractUrlBasedView {
|
|||
* {@link HttpStatus#PERMANENT_REDIRECT}.
|
||||
*/
|
||||
public void setStatusCode(HttpStatusCode statusCode) {
|
||||
Assert.isTrue(statusCode.is3xxRedirection(), "Not a redirect status code");
|
||||
Assert.isTrue(statusCode.is3xxRedirection(), () -> "Not a redirect status code: " + statusCode);
|
||||
this.statusCode = statusCode;
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
@ -154,7 +154,7 @@ public final class CloseStatus {
|
|||
* @param reason the reason
|
||||
*/
|
||||
public CloseStatus(int code, @Nullable String reason) {
|
||||
Assert.isTrue((code >= 1000 && code < 5000), "Invalid status code");
|
||||
Assert.isTrue((code >= 1000 && code < 5000), () -> "Invalid status code: " + code);
|
||||
this.code = code;
|
||||
this.reason = reason;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2017 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 RedirectViewControllerRegistration {
|
|||
* will select {@code HttpStatus.MOVED_TEMPORARILY (302)} by default.
|
||||
*/
|
||||
public RedirectViewControllerRegistration setStatusCode(HttpStatusCode statusCode) {
|
||||
Assert.isTrue(statusCode.is3xxRedirection(), "Not a redirect status code");
|
||||
Assert.isTrue(statusCode.is3xxRedirection(), () -> "Not a redirect status code: " + statusCode);
|
||||
this.redirectView.setStatusCode(statusCode);
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
@ -133,8 +133,8 @@ public class CompositeRequestCondition extends AbstractRequestCondition<Composit
|
|||
|
||||
private void assertNumberOfConditions(CompositeRequestCondition other) {
|
||||
Assert.isTrue(getLength() == other.getLength(),
|
||||
"Cannot combine CompositeRequestConditions with a different number of conditions. " +
|
||||
ObjectUtils.nullSafeToString(this.requestConditions) + " and " +
|
||||
() -> "Cannot combine CompositeRequestConditions with a different number of conditions. " +
|
||||
ObjectUtils.nullSafeToString(this.requestConditions) + " and " +
|
||||
ObjectUtils.nullSafeToString(other.requestConditions));
|
||||
}
|
||||
|
||||
|
|
|
@ -168,7 +168,7 @@ public final class CloseStatus implements Serializable {
|
|||
* @param reason the reason
|
||||
*/
|
||||
public CloseStatus(int code, @Nullable String reason) {
|
||||
Assert.isTrue((code >= 1000 && code < 5000), "Invalid status code");
|
||||
Assert.isTrue((code >= 1000 && code < 5000), () -> "Invalid status code: " + code);
|
||||
this.code = code;
|
||||
this.reason = reason;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue