Use noNullElements
Collection#contains(null) does not work for all collection types Closes gh-10703
This commit is contained in:
@@ -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.
|
||||
@@ -66,7 +66,7 @@ public class MediaTypeServerWebExchangeMatcher implements ServerWebExchangeMatch
|
||||
*/
|
||||
public MediaTypeServerWebExchangeMatcher(Collection<MediaType> matchingMediaTypes) {
|
||||
Assert.notEmpty(matchingMediaTypes, "matchingMediaTypes cannot be null");
|
||||
Assert.isTrue(!matchingMediaTypes.contains(null),
|
||||
Assert.noNullElements(matchingMediaTypes,
|
||||
() -> "matchingMediaTypes cannot contain null. Got " + matchingMediaTypes);
|
||||
this.matchingMediaTypes = matchingMediaTypes;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -45,7 +45,7 @@ public final class AndRequestMatcher implements RequestMatcher {
|
||||
*/
|
||||
public AndRequestMatcher(List<RequestMatcher> requestMatchers) {
|
||||
Assert.notEmpty(requestMatchers, "requestMatchers must contain a value");
|
||||
Assert.isTrue(!requestMatchers.contains(null), "requestMatchers cannot contain null values");
|
||||
Assert.noNullElements(requestMatchers, "requestMatchers cannot contain null values");
|
||||
this.requestMatchers = requestMatchers;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -40,7 +40,7 @@ public final class OrRequestMatcher implements RequestMatcher {
|
||||
*/
|
||||
public OrRequestMatcher(List<RequestMatcher> requestMatchers) {
|
||||
Assert.notEmpty(requestMatchers, "requestMatchers must contain a value");
|
||||
Assert.isTrue(!requestMatchers.contains(null), "requestMatchers cannot contain null values");
|
||||
Assert.noNullElements(requestMatchers, "requestMatchers cannot contain null values");
|
||||
this.requestMatchers = requestMatchers;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user