Condition 'null != interceptors' is always 'true' (#342)

pull/358/head
xingducai 2 years ago committed by GitHub
parent 34e4c70e8f
commit c0084f489d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -27,3 +27,4 @@
- [Feature: Optimize static metadata manager](https://github.com/Tencent/spring-cloud-tencent/pull/327)
- [test:update junit of metadata.](https://github.com/Tencent/spring-cloud-tencent/pull/340)
- [Optimize code style & unit test case](https://github.com/Tencent/spring-cloud-tencent/pull/336)
- [rm code: Condition 'null != interceptors' is always 'true' ](https://github.com/Tencent/spring-cloud-tencent/pull/342)

@ -168,8 +168,7 @@ public class MetadataTransferAutoConfiguration {
List<ClientHttpRequestInterceptor> interceptors = restTemplate
.getInterceptors();
// Avoid setting interceptor repeatedly.
if (null != interceptors && !interceptors
.contains(encodeTransferMedataRestTemplateInterceptor)) {
if (!interceptors.contains(encodeTransferMedataRestTemplateInterceptor)) {
interceptors.add(encodeTransferMedataRestTemplateInterceptor);
restTemplate.setInterceptors(interceptors);
}
@ -207,10 +206,8 @@ public class MetadataTransferAutoConfiguration {
List<ClientHttpRequestInterceptor> interceptors = restTemplate
.getInterceptors();
// Avoid setting interceptor repeatedly.
if (null != interceptors && !interceptors
.contains(encodeTransferMedataRestTemplateInterceptor)) {
interceptors
.add(this.encodeTransferMedataRestTemplateInterceptor);
if (!interceptors.contains(encodeTransferMedataRestTemplateInterceptor)) {
interceptors.add(this.encodeTransferMedataRestTemplateInterceptor);
restTemplate.setInterceptors(interceptors);
}
}

Loading…
Cancel
Save