Skip to content

Commit e40cfe1

Browse files
garyrussellartembilan
authored andcommitted
Sonar fixes
Hidden fields, `o.s.i.a*` through `o.s.i.j*`.
1 parent 6eeec50 commit e40cfe1

File tree

53 files changed

+486
-467
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+486
-467
lines changed

spring-integration-amqp/src/main/java/org/springframework/integration/amqp/outbound/AbstractAmqpOutboundEndpoint.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2018 the original author or authors.
2+
* Copyright 2016-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -486,19 +486,19 @@ protected CorrelationData generateCorrelationData(Message<?> requestMessage) {
486486
}
487487

488488
protected String generateExchangeName(Message<?> requestMessage) {
489-
String exchangeName = this.exchangeName;
489+
String exchange = this.exchangeName;
490490
if (this.exchangeNameGenerator != null) {
491-
exchangeName = this.exchangeNameGenerator.processMessage(requestMessage);
491+
exchange = this.exchangeNameGenerator.processMessage(requestMessage);
492492
}
493-
return exchangeName;
493+
return exchange;
494494
}
495495

496496
protected String generateRoutingKey(Message<?> requestMessage) {
497-
String routingKey = this.routingKey;
497+
String key = this.routingKey;
498498
if (this.routingKeyGenerator != null) {
499-
routingKey = this.routingKeyGenerator.processMessage(requestMessage);
499+
key = this.routingKeyGenerator.processMessage(requestMessage);
500500
}
501-
return routingKey;
501+
return key;
502502
}
503503

504504
protected void addDelayProperty(Message<?> message, org.springframework.amqp.core.Message amqpMessage) {

spring-integration-core/src/main/java/org/springframework/integration/channel/AbstractMessageChannel.java

+14-14
Original file line numberDiff line numberDiff line change
@@ -425,10 +425,10 @@ public boolean send(Message<?> messageArg, long timeout) {
425425
Deque<ChannelInterceptor> interceptorStack = null;
426426
boolean sent = false;
427427
boolean metricsProcessed = false;
428-
MetricsContext metrics = null;
429-
boolean countsEnabled = this.countsEnabled;
430-
ChannelInterceptorList interceptors = this.interceptors;
431-
AbstractMessageChannelMetrics channelMetrics = this.channelMetrics;
428+
MetricsContext metricsContext = null;
429+
boolean countsAreEnabled = this.countsEnabled;
430+
ChannelInterceptorList interceptorList = this.interceptors;
431+
AbstractMessageChannelMetrics metrics = this.channelMetrics;
432432
SampleFacade sample = null;
433433
try {
434434
if (this.datatypes.length > 0) {
@@ -438,23 +438,23 @@ public boolean send(Message<?> messageArg, long timeout) {
438438
if (debugEnabled) {
439439
logger.debug("preSend on channel '" + this + "', message: " + message);
440440
}
441-
if (interceptors.getSize() > 0) {
441+
if (interceptorList.getSize() > 0) {
442442
interceptorStack = new ArrayDeque<>();
443-
message = interceptors.preSend(message, this, interceptorStack);
443+
message = interceptorList.preSend(message, this, interceptorStack);
444444
if (message == null) {
445445
return false;
446446
}
447447
}
448-
if (countsEnabled) {
449-
metrics = channelMetrics.beforeSend();
448+
if (countsAreEnabled) {
449+
metricsContext = metrics.beforeSend();
450450
if (this.metricsCaptor != null) {
451451
sample = this.metricsCaptor.start();
452452
}
453453
sent = doSend(message, timeout);
454454
if (sample != null) {
455455
sample.stop(sendTimer(sent));
456456
}
457-
channelMetrics.afterSend(metrics, sent);
457+
metrics.afterSend(metricsContext, sent);
458458
metricsProcessed = true;
459459
}
460460
else {
@@ -465,20 +465,20 @@ public boolean send(Message<?> messageArg, long timeout) {
465465
logger.debug("postSend (sent=" + sent + ") on channel '" + this + "', message: " + message);
466466
}
467467
if (interceptorStack != null) {
468-
interceptors.postSend(message, this, sent);
469-
interceptors.afterSendCompletion(message, this, sent, null, interceptorStack);
468+
interceptorList.postSend(message, this, sent);
469+
interceptorList.afterSendCompletion(message, this, sent, null, interceptorStack);
470470
}
471471
return sent;
472472
}
473473
catch (Exception e) {
474-
if (countsEnabled && !metricsProcessed) {
474+
if (countsAreEnabled && !metricsProcessed) {
475475
if (sample != null) {
476476
sample.stop(buildSendTimer(false, e.getClass().getSimpleName()));
477477
}
478-
channelMetrics.afterSend(metrics, false);
478+
metrics.afterSend(metricsContext, false);
479479
}
480480
if (interceptorStack != null) {
481-
interceptors.afterSendCompletion(message, this, sent, e, interceptorStack);
481+
interceptorList.afterSendCompletion(message, this, sent, e, interceptorStack);
482482
}
483483
throw IntegrationUtils.wrapInDeliveryExceptionIfNecessary(message,
484484
() -> "failed to send Message to channel '" + this.getComponentName() + "'", e);

spring-integration-core/src/main/java/org/springframework/integration/channel/DirectChannel.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -85,8 +85,9 @@ protected UnicastingDispatcher getDispatcher() {
8585
protected void onInit() {
8686
super.onInit();
8787
if (this.maxSubscribers == null) {
88-
Integer maxSubscribers = this.getIntegrationProperty(IntegrationProperties.CHANNELS_MAX_UNICAST_SUBSCRIBERS, Integer.class);
89-
this.setMaxSubscribers(maxSubscribers);
88+
Integer max = this.getIntegrationProperty(IntegrationProperties.CHANNELS_MAX_UNICAST_SUBSCRIBERS,
89+
Integer.class);
90+
this.setMaxSubscribers(max);
9091
}
9192
}
9293

spring-integration-core/src/main/java/org/springframework/integration/config/ConsumerEndpointFactoryBean.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -316,17 +316,17 @@ else if (channel instanceof PollableChannel) {
316316
if (this.autoStartup != null) {
317317
this.endpoint.setAutoStartup(this.autoStartup);
318318
}
319-
int phase = this.phase;
319+
int phaseToSet = this.phase;
320320
if (!this.isPhaseSet) {
321321
if (this.endpoint instanceof PollingConsumer) {
322-
phase = Integer.MAX_VALUE / 2;
322+
phaseToSet = Integer.MAX_VALUE / 2;
323323
}
324324
else {
325-
phase = Integer.MIN_VALUE;
325+
phaseToSet = Integer.MIN_VALUE;
326326
}
327327
}
328328

329-
this.endpoint.setPhase(phase);
329+
this.endpoint.setPhase(phaseToSet);
330330
this.endpoint.setRole(this.role);
331331
if (this.taskScheduler != null) {
332332
this.endpoint.setTaskScheduler(this.taskScheduler);

spring-integration-core/src/main/java/org/springframework/integration/config/annotation/AbstractMethodAnnotationPostProcessor.java

+7-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -117,24 +117,20 @@ public AbstractMethodAnnotationPostProcessor(ConfigurableListableBeanFactory bea
117117
Assert.notNull(beanFactory, "'beanFactory' must not be null");
118118
this.messageHandlerAttributes.add(SEND_TIMEOUT_ATTRIBUTE);
119119
this.beanFactory = beanFactory;
120-
ConversionService conversionService = this.beanFactory.getConversionService();
121-
if (conversionService != null) {
122-
this.conversionService = conversionService;
123-
}
124-
else {
125-
this.conversionService = DefaultConversionService.getSharedInstance();
126-
}
120+
this.conversionService = this.beanFactory.getConversionService() != null
121+
? this.beanFactory.getConversionService()
122+
: DefaultConversionService.getSharedInstance();
127123
this.channelResolver = new BeanFactoryChannelResolver(beanFactory);
128124
this.annotationType = (Class<T>) GenericTypeResolver.resolveTypeArgument(this.getClass(),
129125
MethodAnnotationPostProcessor.class);
130-
Disposables disposables = null;
126+
Disposables disposablesBean = null;
131127
try {
132-
disposables = beanFactory.getBean(Disposables.class);
128+
disposablesBean = beanFactory.getBean(Disposables.class);
133129
}
134130
catch (Exception e) {
135131
// NOSONAR - only for test cases
136132
}
137-
this.disposables = disposables;
133+
this.disposables = disposablesBean;
138134
}
139135

140136

spring-integration-core/src/main/java/org/springframework/integration/dsl/EndpointSpec.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2018 the original author or authors.
2+
* Copyright 2016-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -88,9 +88,9 @@ public S poller(Function<PollerFactory, PollerSpec> pollers) {
8888
* @see PollerSpec
8989
*/
9090
public S poller(PollerSpec pollerMetadataSpec) {
91-
Map<Object, String> componentsToRegister = pollerMetadataSpec.getComponentsToRegister();
92-
if (componentsToRegister != null) {
93-
this.componentsToRegister.putAll(componentsToRegister);
91+
Map<Object, String> components = pollerMetadataSpec.getComponentsToRegister();
92+
if (components != null) {
93+
this.componentsToRegister.putAll(components);
9494
}
9595
return poller(pollerMetadataSpec.get());
9696
}

spring-integration-core/src/main/java/org/springframework/integration/dsl/IntegrationFlowDefinition.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -3095,14 +3095,14 @@ else if (this.currentComponent instanceof SourcePollingChannelAdapterSpec) {
30953095

30963096
private boolean isOutputChannelRequired() {
30973097
if (this.currentComponent != null) {
3098-
Object currentComponent = this.currentComponent;
3098+
Object currentElement = this.currentComponent;
30993099

3100-
if (AopUtils.isAopProxy(currentComponent)) {
3101-
currentComponent = extractProxyTarget(currentComponent);
3100+
if (AopUtils.isAopProxy(currentElement)) {
3101+
currentElement = extractProxyTarget(currentElement);
31023102
}
31033103

3104-
return currentComponent instanceof AbstractMessageProducingHandler
3105-
|| currentComponent instanceof SourcePollingChannelAdapterSpec;
3104+
return currentElement instanceof AbstractMessageProducingHandler
3105+
|| currentElement instanceof SourcePollingChannelAdapterSpec;
31063106
}
31073107
return false;
31083108
}

spring-integration-core/src/main/java/org/springframework/integration/endpoint/AbstractPollingEndpoint.java

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -250,23 +250,23 @@ private Callable<Message<?>> createPollingTask() {
250250
.collect(Collectors.toList());
251251
}
252252

253-
Callable<Message<?>> pollingTask = this::doPoll;
253+
Callable<Message<?>> task = this::doPoll;
254254

255-
List<Advice> adviceChain = this.adviceChain;
256-
if (!CollectionUtils.isEmpty(adviceChain)) {
257-
ProxyFactory proxyFactory = new ProxyFactory(pollingTask);
258-
if (!CollectionUtils.isEmpty(adviceChain)) {
259-
adviceChain.stream()
255+
List<Advice> advices = this.adviceChain;
256+
if (!CollectionUtils.isEmpty(advices)) {
257+
ProxyFactory proxyFactory = new ProxyFactory(task);
258+
if (!CollectionUtils.isEmpty(advices)) {
259+
advices.stream()
260260
.filter(advice -> !isReceiveOnlyAdvice(advice))
261261
.forEach(proxyFactory::addAdvice);
262262
}
263-
pollingTask = (Callable<Message<?>>) proxyFactory.getProxy(this.beanClassLoader);
263+
task = (Callable<Message<?>>) proxyFactory.getProxy(this.beanClassLoader);
264264
}
265265
if (!CollectionUtils.isEmpty(receiveOnlyAdviceChain)) {
266266
applyReceiveOnlyAdviceChain(receiveOnlyAdviceChain);
267267
}
268268

269-
return pollingTask;
269+
return task;
270270
}
271271

272272
private Runnable createPoller() {

spring-integration-core/src/main/java/org/springframework/integration/endpoint/MessageProducerSupport.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,9 @@ protected void sendMessage(Message<?> messageArg) {
219219
* @since 4.3.10
220220
*/
221221
protected final boolean sendErrorMessageIfNecessary(Message<?> message, RuntimeException exception) {
222-
MessageChannel errorChannel = getErrorChannel();
223-
if (errorChannel != null) {
224-
this.messagingTemplate.send(errorChannel, buildErrorMessage(message, exception));
222+
MessageChannel channel = getErrorChannel();
223+
if (channel != null) {
224+
this.messagingTemplate.send(channel, buildErrorMessage(message, exception));
225225
return true;
226226
}
227227
return false;

spring-integration-core/src/main/java/org/springframework/integration/endpoint/SourcePollingChannelAdapter.java

+4-8
Original file line numberDiff line numberDiff line change
@@ -145,17 +145,13 @@ protected boolean isReceiveOnlyAdvice(Advice advice) {
145145
protected void applyReceiveOnlyAdviceChain(Collection<Advice> chain) {
146146
if (!CollectionUtils.isEmpty(chain)) {
147147
if (AopUtils.isAopProxy(this.source)) {
148-
Advised source = (Advised) this.source;
149-
this.appliedAdvices.forEach(source::removeAdvice);
150-
for (Advice advice : chain) {
151-
source.addAdvisor(adviceToReceiveAdvisor(advice));
152-
}
148+
Advised advised = (Advised) this.source;
149+
this.appliedAdvices.forEach(advised::removeAdvice);
150+
chain.stream().forEach(advice -> advised.addAdvisor(adviceToReceiveAdvisor(advice)));
153151
}
154152
else {
155153
ProxyFactory proxyFactory = new ProxyFactory(this.source);
156-
for (Advice advice : chain) {
157-
proxyFactory.addAdvisor(adviceToReceiveAdvisor(advice));
158-
}
154+
chain.stream().forEach(advice -> proxyFactory.addAdvisor(adviceToReceiveAdvisor(advice)));
159155
this.source = (MessageSource<?>) proxyFactory.getProxy(getBeanClassLoader());
160156
}
161157
this.appliedAdvices.clear();

spring-integration-core/src/main/java/org/springframework/integration/expression/ExpressionEvalMap.java

+14-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2013-2018 the original author or authors.
2+
* Copyright 2013-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -282,16 +282,21 @@ public ExpressionEvalMapComponentsBuilder withReturnType(Class<?> returnType) {
282282

283283
private class ExpressionEvalMapFinalBuilderImpl implements ExpressionEvalMapFinalBuilder {
284284

285+
ExpressionEvalMapFinalBuilderImpl() {
286+
super();
287+
}
288+
285289
@Override
286290
public ExpressionEvalMap build() {
287291
if (ExpressionEvalMapBuilder.this.evaluationCallback != null) {
288292
return new ExpressionEvalMap(ExpressionEvalMapBuilder.this.expressions,
289293
ExpressionEvalMapBuilder.this.evaluationCallback);
290294
}
291-
ComponentsEvaluationCallback evaluationCallback =
292-
new ComponentsEvaluationCallback(ExpressionEvalMapBuilder.this.context,
293-
ExpressionEvalMapBuilder.this.root, ExpressionEvalMapBuilder.this.returnType);
294-
return new ExpressionEvalMap(ExpressionEvalMapBuilder.this.expressions, evaluationCallback);
295+
else {
296+
return new ExpressionEvalMap(ExpressionEvalMapBuilder.this.expressions,
297+
new ComponentsEvaluationCallback(ExpressionEvalMapBuilder.this.context,
298+
ExpressionEvalMapBuilder.this.root, ExpressionEvalMapBuilder.this.returnType));
299+
}
295300
}
296301

297302
}
@@ -300,6 +305,10 @@ public ExpressionEvalMap build() {
300305
private class ExpressionEvalMapComponentsBuilderImpl extends ExpressionEvalMapFinalBuilderImpl
301306
implements ExpressionEvalMapComponentsBuilder {
302307

308+
ExpressionEvalMapComponentsBuilderImpl() {
309+
super();
310+
}
311+
303312
@Override
304313
public ExpressionEvalMapComponentsBuilder usingEvaluationContext(EvaluationContext context) {
305314
return ExpressionEvalMapBuilder.this.usingEvaluationContext(context);

spring-integration-core/src/main/java/org/springframework/integration/filter/MessageFilter.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -173,9 +173,9 @@ protected Object doHandleRequestMessage(Message<?> message) {
173173
@Override
174174
public Object postProcess(Message<?> message, Object result) {
175175
if (result == null) {
176-
MessageChannel discardChannel = getDiscardChannel();
177-
if (discardChannel != null) {
178-
this.messagingTemplate.send(discardChannel, message);
176+
MessageChannel channel = getDiscardChannel();
177+
if (channel != null) {
178+
this.messagingTemplate.send(channel, message);
179179
}
180180
if (this.throwExceptionOnRejection) {
181181
throw new MessageRejectedException(message, "MessageFilter '" + this.getComponentName()

0 commit comments

Comments
 (0)