Skip to content

Commit d047d28

Browse files
committed
Fix new Sonar smells
Upgrade dependencies for upcoming release
1 parent a49b04e commit d047d28

14 files changed

+93
-76
lines changed

build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,11 @@ subprojects { subproject ->
135135
servletApiVersion = '4.0.1'
136136
smackVersion = '4.3.1'
137137
springAmqpVersion = project.hasProperty('springAmqpVersion') ? project.springAmqpVersion : '2.2.0.M1'
138-
springDataJpaVersion = '2.2.0.BUILD-SNAPSHOT'
139-
springDataMongoVersion = '2.2.0.BUILD-SNAPSHOT'
140-
springDataRedisVersion = '2.2.0.BUILD-SNAPSHOT'
141-
springGemfireVersion = '2.2.0.BUILD-SNAPSHOT'
142-
springSecurityVersion = '5.2.0.BUILD-SNAPSHOT'
138+
springDataJpaVersion = '2.2.0.M3'
139+
springDataMongoVersion = '2.2.0.M3'
140+
springDataRedisVersion = '2.2.0.M3'
141+
springGemfireVersion = '2.2.0.M3'
142+
springSecurityVersion = '5.2.0.M1'
143143
springRetryVersion = '1.2.4.RELEASE'
144144
springVersion = project.hasProperty('springVersion') ? project.springVersion : '5.2.0.M1'
145145
springWsVersion = '3.0.7.RELEASE'

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import org.springframework.beans.factory.BeanFactory;
2020
import org.springframework.integration.support.channel.ChannelResolverUtils;
21-
import org.springframework.messaging.core.DestinationResolver;
2221
import org.springframework.util.Assert;
2322
import org.springframework.util.ErrorHandler;
2423

@@ -27,6 +26,7 @@
2726
*
2827
* @author Artem Bilan
2928
* @author Gary Russell
29+
*
3030
* @since 5.2
3131
*
3232
*/
@@ -42,7 +42,8 @@ private ChannelUtils() {
4242
* Obtain an {@link ErrorHandler} registered with the
4343
* {@value MESSAGE_PUBLISHING_ERROR_HANDLER_BEAN_NAME} bean name.
4444
* By default resolves to the {@link org.springframework.integration.channel.MessagePublishingErrorHandler}
45-
* with the {@value ChannelResolverUtils#CHANNEL_RESOLVER_BEAN_NAME} {@link DestinationResolver} bean.
45+
* with the {@value ChannelResolverUtils#CHANNEL_RESOLVER_BEAN_NAME}
46+
* {@link org.springframework.messaging.core.DestinationResolver} bean.
4647
* @param beanFactory BeanFactory for lookup, must not be null.
4748
* @return the instance of {@link ErrorHandler} bean whose name is
4849
* {@value MESSAGE_PUBLISHING_ERROR_HANDLER_BEAN_NAME}.

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

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -61,23 +61,23 @@
6161
@SuppressWarnings("deprecation")
6262
public class IntegrationManagementConfigurer
6363
implements SmartInitializingSingleton, ApplicationContextAware, BeanNameAware,
64-
DestructionAwareBeanPostProcessor {
64+
DestructionAwareBeanPostProcessor {
6565

66-
private static final Log logger = LogFactory.getLog(IntegrationManagementConfigurer.class);
66+
private static final Log LOGGER = LogFactory.getLog(IntegrationManagementConfigurer.class);
6767

6868
public static final String MANAGEMENT_CONFIGURER_NAME = "integrationManagementConfigurer";
6969

7070
private final Map<String, org.springframework.integration.support.management.MessageChannelMetrics>
71-
channelsByName = new HashMap<>();
71+
channelsByName = new HashMap<>();
7272

7373
private final Map<String, org.springframework.integration.support.management.MessageHandlerMetrics>
74-
handlersByName = new HashMap<>();
74+
handlersByName = new HashMap<>();
7575

7676
private final Map<String, org.springframework.integration.support.management.MessageSourceMetrics>
77-
sourcesByName = new HashMap<>();
77+
sourcesByName = new HashMap<>();
7878

7979
private final Map<String,
80-
org.springframework.integration.support.management.MessageSourceMetricsConfigurer>
80+
org.springframework.integration.support.management.MessageSourceMetricsConfigurer>
8181
sourceConfigurers = new HashMap<>();
8282

8383
private ApplicationContext applicationContext;
@@ -229,7 +229,7 @@ public Boolean getDefaultStatsEnabled() {
229229
* Exception logging (debug or otherwise) is not affected by this setting.
230230
* <p>
231231
* It has been found that in high-volume messaging environments, calls to methods such as
232-
* {@code logger.isDebuggingEnabled()} can be quite expensive and account for an inordinate amount of CPU
232+
* {@link Log#isDebugEnabled()} can be quite expensive and account for an inordinate amount of CPU
233233
* time.
234234
* <p>
235235
* Set this to false to disable logging by default in all framework components that implement
@@ -263,7 +263,7 @@ public void afterSingletonsInstantiated() {
263263
}
264264
if (this.metricsFactory == null) {
265265
Map<String, org.springframework.integration.support.management.MetricsFactory>
266-
factories = this.applicationContext
266+
factories = this.applicationContext
267267
.getBeansOfType(org.springframework.integration.support.management.MetricsFactory.class);
268268
if (factories.size() == 1) {
269269
this.metricsFactory = factories.values().iterator().next();
@@ -327,22 +327,25 @@ else if (bean instanceof org.springframework.integration.support.management.Mess
327327
this.handlersByName.remove(nameOfBean + ".handler");
328328
}
329329
}
330-
else if (bean instanceof org.springframework.integration.support.management.MessageSourceMetrics) {
331-
if (this.sourcesByName.remove(nameOfBean) == null) {
332-
this.sourcesByName.remove(nameOfBean + ".source");
333-
}
330+
else if (bean instanceof org.springframework.integration.support.management.MessageSourceMetrics &&
331+
this.sourcesByName.remove(nameOfBean) == null) {
332+
333+
this.sourcesByName.remove(nameOfBean + ".source");
334334
}
335335
}
336336

337337
private Object doConfigureMetrics(Object bean, String name) {
338338
if (bean instanceof org.springframework.integration.support.management.MessageChannelMetrics) {
339-
configureChannelMetrics(name, (org.springframework.integration.support.management.MessageChannelMetrics) bean);
339+
configureChannelMetrics(name,
340+
(org.springframework.integration.support.management.MessageChannelMetrics) bean);
340341
}
341342
else if (bean instanceof org.springframework.integration.support.management.MessageHandlerMetrics) {
342-
configureHandlerMetrics(name, (org.springframework.integration.support.management.MessageHandlerMetrics) bean);
343+
configureHandlerMetrics(name,
344+
(org.springframework.integration.support.management.MessageHandlerMetrics) bean);
343345
}
344346
else if (bean instanceof org.springframework.integration.support.management.MessageSourceMetrics) {
345-
configureSourceMetrics(name, (org.springframework.integration.support.management.MessageSourceMetrics) bean);
347+
configureSourceMetrics(name,
348+
(org.springframework.integration.support.management.MessageSourceMetrics) bean);
346349
this.sourceConfigurers.values().forEach(c -> c
347350
.configure((org.springframework.integration.support.management.MessageSourceMetrics) bean, name));
348351
}
@@ -469,8 +472,8 @@ public org.springframework.integration.support.management.MessageChannelMetrics
469472
if (this.channelsByName.containsKey(name)) {
470473
return this.channelsByName.get(name);
471474
}
472-
if (logger.isDebugEnabled()) {
473-
logger.debug("No channel found for (" + name + ")");
475+
if (LOGGER.isDebugEnabled()) {
476+
LOGGER.debug("No channel found for (" + name + ")");
474477
}
475478
return null;
476479
}
@@ -483,8 +486,8 @@ public org.springframework.integration.support.management.MessageHandlerMetrics
483486
return this.handlersByName.get(name + ".handler");
484487
}
485488

486-
if (logger.isDebugEnabled()) {
487-
logger.debug("No handler found for (" + name + ")");
489+
if (LOGGER.isDebugEnabled()) {
490+
LOGGER.debug("No handler found for (" + name + ")");
488491
}
489492
return null;
490493
}
@@ -497,8 +500,8 @@ public org.springframework.integration.support.management.MessageSourceMetrics g
497500
return this.sourcesByName.get(name + ".source");
498501
}
499502

500-
if (logger.isDebugEnabled()) {
501-
logger.debug("No source found for (" + name + ")");
503+
if (LOGGER.isDebugEnabled()) {
504+
LOGGER.debug("No source found for (" + name + ")");
502505
}
503506
return null;
504507
}

spring-integration-core/src/main/java/org/springframework/integration/support/management/AbstractMessageChannelMetrics.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@
2929
*/
3030
public abstract class AbstractMessageChannelMetrics implements ConfigurableMetrics {
3131

32-
protected final Log logger = LogFactory.getLog(getClass());
32+
private static final String DEPRECATION = "deprecation";
3333

34-
protected final String name;
34+
protected final Log logger = LogFactory.getLog(getClass()); // NOSONAR - final
35+
36+
protected final String name; // NOSONAR - final
3537

3638
private volatile boolean fullStatsEnabled;
3739

@@ -61,7 +63,7 @@ protected boolean isFullStatsEnabled() {
6163
* @return the context to be used in a subsequent {@link #afterSend(MetricsContext, boolean)}
6264
* call.
6365
*/
64-
@SuppressWarnings("deprecation")
66+
@SuppressWarnings(DEPRECATION)
6567
public abstract MetricsContext beforeSend();
6668

6769
/**
@@ -71,7 +73,7 @@ protected boolean isFullStatsEnabled() {
7173
* @param context the context.
7274
* @param result true for success, false otherwise.
7375
*/
74-
public abstract void afterSend(@SuppressWarnings("deprecation") MetricsContext context, boolean result);
76+
public abstract void afterSend(@SuppressWarnings(DEPRECATION) MetricsContext context, boolean result);
7577

7678
/**
7779
* Reset all counters/statistics.
@@ -102,13 +104,13 @@ protected boolean isFullStatsEnabled() {
102104

103105
public abstract double getStandardDeviationSendDuration();
104106

105-
@SuppressWarnings("deprecation")
107+
@SuppressWarnings(DEPRECATION)
106108
public abstract Statistics getSendDuration();
107109

108-
@SuppressWarnings("deprecation")
110+
@SuppressWarnings(DEPRECATION)
109111
public abstract Statistics getSendRate();
110112

111-
@SuppressWarnings("deprecation")
113+
@SuppressWarnings(DEPRECATION)
112114
public abstract Statistics getErrorRate();
113115

114116
public abstract void afterReceive();

spring-integration-core/src/main/java/org/springframework/integration/support/management/AggregatingMetricsFactory.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
*
2828
*/
2929
@Deprecated
30-
@SuppressWarnings("deprecation")
3130
public class AggregatingMetricsFactory implements MetricsFactory {
3231

3332
private final int sampleSize;

spring-integration-core/src/main/java/org/springframework/integration/support/management/DefaultMetricsFactory.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
*
3131
*/
3232
@Deprecated
33-
@SuppressWarnings("deprecation")
3433
public class DefaultMetricsFactory implements MetricsFactory {
3534

3635
@Override

spring-integration-core/src/main/java/org/springframework/integration/support/management/ExponentialMovingAverage.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
* @since 2.0
4242
*/
4343
@Deprecated
44-
@SuppressWarnings("deprecation")
4544
public class ExponentialMovingAverage {
4645

4746
private volatile long count;
@@ -50,7 +49,7 @@ public class ExponentialMovingAverage {
5049

5150
private volatile double max;
5251

53-
private final Deque<Double> samples = new ArrayDeque<Double>();
52+
private final Deque<Double> samples = new ArrayDeque<>();
5453

5554
private final int retention;
5655

spring-integration-core/src/main/java/org/springframework/integration/support/management/ExponentialMovingAverageRate.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
*
4747
*/
4848
@Deprecated
49-
@SuppressWarnings("deprecation")
5049
public class ExponentialMovingAverageRate {
5150

5251
private volatile double min = Double.MAX_VALUE;
@@ -61,7 +60,7 @@ public class ExponentialMovingAverageRate {
6160

6261
private final double period;
6362

64-
private final Deque<Long> times = new ArrayDeque<Long>();
63+
private final Deque<Long> times = new ArrayDeque<>();
6564

6665
private final int retention;
6766

spring-integration-core/src/main/java/org/springframework/integration/support/management/ExponentialMovingAverageRatio.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
* @since 2.0
4848
*/
4949
@Deprecated
50-
@SuppressWarnings("deprecation")
5150
public class ExponentialMovingAverageRatio {
5251

5352
private volatile double t0;
@@ -60,9 +59,9 @@ public class ExponentialMovingAverageRatio {
6059

6160
private final double lapse;
6261

63-
private final Deque<Long> times = new ArrayDeque<Long>();
62+
private final Deque<Long> times = new ArrayDeque<>();
6463

65-
private final Deque<Integer> values = new ArrayDeque<Integer>();
64+
private final Deque<Integer> values = new ArrayDeque<>();
6665

6766
private final int retention;
6867

spring-integration-core/src/main/java/org/springframework/integration/support/management/LifecycleMessageHandlerMetrics.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,13 @@
3434
*/
3535
@Deprecated
3636
@IntegrationManagedResource
37-
@SuppressWarnings("deprecation")
3837
public class LifecycleMessageHandlerMetrics implements
3938
org.springframework.integration.support.management.MessageHandlerMetrics, Lifecycle,
4039
ConfigurableMetricsAware<AbstractMessageHandlerMetrics> {
4140

4241
private final Lifecycle lifecycle;
4342

44-
protected final org.springframework.integration.support.management.MessageHandlerMetrics delegate;
43+
protected final org.springframework.integration.support.management.MessageHandlerMetrics delegate; // NOSONAR
4544

4645

4746
public LifecycleMessageHandlerMetrics(Lifecycle lifecycle,

0 commit comments

Comments
 (0)