Consistent not-null assertions for configured interceptors
Closes gh-25088
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2020 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.
|
||||
@@ -24,6 +24,7 @@ import org.springframework.http.client.ClientHttpRequestFactory;
|
||||
import org.springframework.http.client.ClientHttpRequestInterceptor;
|
||||
import org.springframework.http.client.InterceptingClientHttpRequestFactory;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
/**
|
||||
@@ -57,6 +58,7 @@ public abstract class InterceptingHttpAccessor extends HttpAccessor {
|
||||
* @see AnnotationAwareOrderComparator
|
||||
*/
|
||||
public void setInterceptors(List<ClientHttpRequestInterceptor> interceptors) {
|
||||
Assert.noNullElements(interceptors, "'interceptors' must not contain null elements");
|
||||
// Take getInterceptors() List as-is when passed in here
|
||||
if (this.interceptors != interceptors) {
|
||||
this.interceptors.clear();
|
||||
|
||||
Reference in New Issue
Block a user