From 8b16aede894d430bad2e90c3ddf60ea12d8fc7bf Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Thu, 16 Jul 2020 11:36:04 -0400 Subject: [PATCH] Fix new Sonar smells --- .../integration/support/utils/IntegrationUtils.java | 6 +++--- .../kafka/outbound/KafkaProducerMessageHandler.java | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/utils/IntegrationUtils.java b/spring-integration-core/src/main/java/org/springframework/integration/support/utils/IntegrationUtils.java index 65010417eb..606cee32a2 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/support/utils/IntegrationUtils.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/support/utils/IntegrationUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2019 the original author or authors. + * Copyright 2014-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. @@ -58,7 +58,7 @@ public final class IntegrationUtils { /** * Should be set to TRUE on CI plans and framework developer systems. */ - public static final boolean fatalWhenNoBeanFactory = + public static final boolean FATAL_WHEN_NO_BEANFACTORY = Boolean.parseBoolean(System.getenv("SI_FATAL_WHEN_NO_BEANFACTORY")); private IntegrationUtils() { @@ -96,7 +96,7 @@ public final class IntegrationUtils { } else { LOGGER.debug("No 'beanFactory' supplied; cannot find MessageBuilderFactory, using default."); - if (fatalWhenNoBeanFactory) { + if (FATAL_WHEN_NO_BEANFACTORY) { throw new IllegalStateException("All Message creators need a BeanFactory"); } } diff --git a/spring-integration-kafka/src/main/java/org/springframework/integration/kafka/outbound/KafkaProducerMessageHandler.java b/spring-integration-kafka/src/main/java/org/springframework/integration/kafka/outbound/KafkaProducerMessageHandler.java index 36dceb7d15..f74d4f16d0 100644 --- a/spring-integration-kafka/src/main/java/org/springframework/integration/kafka/outbound/KafkaProducerMessageHandler.java +++ b/spring-integration-kafka/src/main/java/org/springframework/integration/kafka/outbound/KafkaProducerMessageHandler.java @@ -182,7 +182,9 @@ public class KafkaProducerMessageHandler extends AbstractReplyProducingMes + "configured to read uncommitted records"); } determineSendTimeout(); - this.deliveryTimeoutMsProperty = this.sendTimeoutExpression.getValue(Long.class) - TIMEOUT_BUFFER; + this.deliveryTimeoutMsProperty = + this.sendTimeoutExpression.getValue(Long.class) // NOSONAR - never null after determineSendTimeout() + - TIMEOUT_BUFFER; } private void determineSendTimeout() {