diff --git a/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/support/EndpointUtils.java b/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/support/EndpointUtils.java index 5541a17504..57d93bf6a1 100644 --- a/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/support/EndpointUtils.java +++ b/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/support/EndpointUtils.java @@ -25,6 +25,7 @@ import com.rabbitmq.client.Channel; * Utility methods for messaging endpoints. * * @author Gary Russell + * @author Artem Bilan * * @since 5.1.3 * @@ -34,7 +35,6 @@ public final class EndpointUtils { private static final String LEFE_MESSAGE = "Message conversion failed"; private EndpointUtils() { - super(); } /** @@ -43,16 +43,16 @@ public final class EndpointUtils { * @param message the failed message. * @param channel the channel. * @param isManualAck true if the container uses manual acknowledgment. - * @param e the exception. + * @param ex the exception. * @return the exception. */ - public static ListenerExecutionFailedException errorMessagePayload(final Message message, - Channel channel, boolean isManualAck, Exception e) { + public static ListenerExecutionFailedException errorMessagePayload(Message message, + Channel channel, boolean isManualAck, Exception ex) { return isManualAck - ? new ManualAckListenerExecutionFailedException(LEFE_MESSAGE, e, message, channel, + ? new ManualAckListenerExecutionFailedException(LEFE_MESSAGE, ex, message, channel, message.getMessageProperties().getDeliveryTag()) - : new ListenerExecutionFailedException(LEFE_MESSAGE, e, message); + : new ListenerExecutionFailedException(LEFE_MESSAGE, ex, message); } } diff --git a/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/support/MappingUtils.java b/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/support/MappingUtils.java index fb253737c6..9259440971 100644 --- a/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/support/MappingUtils.java +++ b/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/support/MappingUtils.java @@ -38,7 +38,6 @@ import org.springframework.util.MimeType; public final class MappingUtils { private MappingUtils() { - super(); } /** diff --git a/spring-integration-core/src/main/java/org/springframework/integration/IntegrationPatternType.java b/spring-integration-core/src/main/java/org/springframework/integration/IntegrationPatternType.java index 2d40716e73..c60ee22dfa 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/IntegrationPatternType.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/IntegrationPatternType.java @@ -28,7 +28,7 @@ import java.util.stream.Collectors; * * @since 5.3 */ -public enum IntegrationPatternType { +public enum IntegrationPatternType { // NOSONAR Initialization circularity is useful for static view message_channel(IntegrationPatternCategory.messaging_channel), @@ -146,7 +146,7 @@ public enum IntegrationPatternType { private final IntegrationPatternType[] patternTypes; IntegrationPatternCategory(IntegrationPatternType... patternTypes) { - this.patternTypes = patternTypes; + this.patternTypes = Arrays.copyOf(patternTypes, patternTypes.length); } public Set getPatternTypes() { diff --git a/spring-integration-core/src/main/java/org/springframework/integration/StaticMessageHeaderAccessor.java b/spring-integration-core/src/main/java/org/springframework/integration/StaticMessageHeaderAccessor.java index fa77f6de67..93cd0a96b7 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/StaticMessageHeaderAccessor.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/StaticMessageHeaderAccessor.java @@ -31,6 +31,7 @@ import org.springframework.util.MimeType; * creation just to access a header. * * @author Gary Russell + * @author Artem Bilan * * @since 5.0.1 * @@ -39,7 +40,6 @@ import org.springframework.util.MimeType; public final class StaticMessageHeaderAccessor { private StaticMessageHeaderAccessor() { - super(); } @Nullable diff --git a/spring-integration-core/src/main/java/org/springframework/integration/acks/AckUtils.java b/spring-integration-core/src/main/java/org/springframework/integration/acks/AckUtils.java index 07e303f1a0..3a7f81e7c0 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/acks/AckUtils.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/acks/AckUtils.java @@ -18,31 +18,19 @@ package org.springframework.integration.acks; import org.springframework.integration.acks.AcknowledgmentCallback.Status; import org.springframework.lang.Nullable; -import org.springframework.messaging.Message; /** * Utility methods for acting on {@link AcknowledgmentCallback} headers. * * @author Gary Russell + * @author Artem Bilan + * * @since 5.0.1 * */ public final class AckUtils { private AckUtils() { - super(); - } - - /** - * Return the {@link AcknowledgmentCallback} header (if present). - * @param message the message. - * @return the callback, or null. - * @deprecated use StaticMessageHeaderAccessor.getAcknowledgmentCallback(message). - */ - @Deprecated - @Nullable - public static AcknowledgmentCallback getAckCallback(Message message) { - throw new UnsupportedOperationException("Use StaticMessageHeaderAccessor.getAcknowledgmentCallback(message)"); } /** diff --git a/spring-integration-core/src/main/java/org/springframework/integration/aggregator/AbstractCorrelatingMessageHandler.java b/spring-integration-core/src/main/java/org/springframework/integration/aggregator/AbstractCorrelatingMessageHandler.java index 52559610df..532d1bed69 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/aggregator/AbstractCorrelatingMessageHandler.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/aggregator/AbstractCorrelatingMessageHandler.java @@ -960,7 +960,6 @@ public abstract class AbstractCorrelatingMessageHandler extends AbstractMessageP private class ForceReleaseMessageGroupProcessor implements MessageGroupProcessor { ForceReleaseMessageGroupProcessor() { - super(); } @Override diff --git a/spring-integration-core/src/main/java/org/springframework/integration/aggregator/MessageCountReleaseStrategy.java b/spring-integration-core/src/main/java/org/springframework/integration/aggregator/MessageCountReleaseStrategy.java index b80f98f2b9..d7ffa23a18 100755 --- a/spring-integration-core/src/main/java/org/springframework/integration/aggregator/MessageCountReleaseStrategy.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/aggregator/MessageCountReleaseStrategy.java @@ -19,24 +19,17 @@ package org.springframework.integration.aggregator; import org.springframework.integration.store.MessageGroup; /** - * A {@link ReleaseStrategy} that releases only the first n messages, where n is a threshold. + * A {@link ReleaseStrategy} that releases only the first {@code n} messages, where {@code n} is a threshold. * * @author Dave Syer * @author Oleg Zhurakousky + * @author Artem Bilan * */ public class MessageCountReleaseStrategy implements ReleaseStrategy { private final int threshold; - /** - * @param threshold the number of messages to accept before releasing - */ - public MessageCountReleaseStrategy(int threshold) { - super(); - this.threshold = threshold; - } - /** * Convenient constructor is only one message is required (threshold=1). */ @@ -44,6 +37,14 @@ public class MessageCountReleaseStrategy implements ReleaseStrategy { this(1); } + /** + * Construct an instance based on the provided threshold. + * @param threshold the number of messages to accept before releasing + */ + public MessageCountReleaseStrategy(int threshold) { + this.threshold = threshold; + } + /** * Release the group if it has more messages than the threshold and has not previously been released. * It is possible that more messages than the threshold could be released, but only if multiple consumers diff --git a/spring-integration-core/src/main/java/org/springframework/integration/channel/ChannelUtils.java b/spring-integration-core/src/main/java/org/springframework/integration/channel/ChannelUtils.java index 17e52cfc45..2a25fed80c 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/channel/ChannelUtils.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/channel/ChannelUtils.java @@ -35,7 +35,6 @@ public final class ChannelUtils { public static final String MESSAGE_PUBLISHING_ERROR_HANDLER_BEAN_NAME = "integrationMessagePublishingErrorHandler"; private ChannelUtils() { - super(); } /** @@ -56,5 +55,4 @@ public final class ChannelUtils { return beanFactory.getBean(MESSAGE_PUBLISHING_ERROR_HANDLER_BEAN_NAME, ErrorHandler.class); } - } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/channel/MessageChannelReactiveUtils.java b/spring-integration-core/src/main/java/org/springframework/integration/channel/MessageChannelReactiveUtils.java index a08f51cafa..534855bb8d 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/channel/MessageChannelReactiveUtils.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/channel/MessageChannelReactiveUtils.java @@ -40,7 +40,6 @@ import reactor.core.scheduler.Schedulers; public final class MessageChannelReactiveUtils { private MessageChannelReactiveUtils() { - super(); } @SuppressWarnings("unchecked") diff --git a/spring-integration-core/src/main/java/org/springframework/integration/config/MessagingGatewayRegistrar.java b/spring-integration-core/src/main/java/org/springframework/integration/config/MessagingGatewayRegistrar.java index 14f171064e..9980d73903 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/config/MessagingGatewayRegistrar.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/config/MessagingGatewayRegistrar.java @@ -58,6 +58,8 @@ import org.springframework.util.StringUtils; */ public class MessagingGatewayRegistrar implements ImportBeanDefinitionRegistrar { + private static final String PROXY_DEFAULT_METHODS_ATTR = "proxyDefaultMethods"; + @Override public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) { if (importingClassMetadata != null && importingClassMetadata.isAnnotated(MessagingGateway.class.getName())) { @@ -68,7 +70,8 @@ public class MessagingGatewayRegistrar implements ImportBeanDefinitionRegistrar importingClassMetadata.getAnnotationAttributes(MessagingGateway.class.getName()); replaceEmptyOverrides(valuesHierarchy, annotationAttributes); // NOSONAR never null annotationAttributes.put("serviceInterface", importingClassMetadata.getClassName()); - annotationAttributes.put("proxyDefaultMethods", "" + annotationAttributes.remove("proxyDefaultMethods")); + annotationAttributes.put(PROXY_DEFAULT_METHODS_ATTR, + "" + annotationAttributes.remove(PROXY_DEFAULT_METHODS_ATTR)); BeanDefinitionReaderUtils.registerBeanDefinition(parse(annotationAttributes), registry); } } @@ -84,7 +87,7 @@ public class MessagingGatewayRegistrar implements ImportBeanDefinitionRegistrar String errorChannel = (String) gatewayAttributes.get("errorChannel"); String asyncExecutor = (String) gatewayAttributes.get("asyncExecutor"); String mapper = (String) gatewayAttributes.get("mapper"); - String proxyDefaultMethods = (String) gatewayAttributes.get("proxyDefaultMethods"); + String proxyDefaultMethods = (String) gatewayAttributes.get(PROXY_DEFAULT_METHODS_ATTR); boolean hasMapper = StringUtils.hasText(mapper); boolean hasDefaultPayloadExpression = StringUtils.hasText(defaultPayloadExpression); @@ -154,7 +157,7 @@ public class MessagingGatewayRegistrar implements ImportBeanDefinitionRegistrar gatewayProxyBuilder.addPropertyReference("mapper", mapper); } if (StringUtils.hasText(proxyDefaultMethods)) { - gatewayProxyBuilder.addPropertyValue("proxyDefaultMethods", proxyDefaultMethods); + gatewayProxyBuilder.addPropertyValue(PROXY_DEFAULT_METHODS_ATTR, proxyDefaultMethods); } gatewayProxyBuilder.addPropertyValue("defaultRequestTimeoutExpressionString", diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/Channels.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/Channels.java index 386ae7a54e..07f97ac96e 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/Channels.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/Channels.java @@ -132,7 +132,6 @@ public final class Channels { } private Channels() { - super(); } } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/DirectChannelSpec.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/DirectChannelSpec.java index 195b24e627..7c2fb599d1 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/DirectChannelSpec.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/DirectChannelSpec.java @@ -38,7 +38,6 @@ public class DirectChannelSpec extends LoadBalancingChannelSpec { IntegrationFlowBuilder() { - super(); } @Override diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/LoadBalancingChannelSpec.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/LoadBalancingChannelSpec.java index 73105958e0..6f6c4252f6 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/LoadBalancingChannelSpec.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/LoadBalancingChannelSpec.java @@ -39,7 +39,6 @@ public abstract class LoadBalancingChannelSpec, C e private MessageConverter messageConverter; protected MessageChannelSpec() { - super(); } public S datatype(Class... types) { @@ -118,7 +117,7 @@ public abstract class MessageChannelSpec, C e @Override protected C doGet() { - this.channel.setDatatypes(this.datatypes.toArray(new Class[this.datatypes.size()])); + this.channel.setDatatypes(this.datatypes.toArray(new Class[0])); this.channel.setBeanName(getId()); this.channel.setInterceptors(this.interceptors); this.channel.setMessageConverter(this.messageConverter); diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/MessageChannels.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/MessageChannels.java index aa0ea6c45a..72ca43eb42 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/MessageChannels.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/MessageChannels.java @@ -133,7 +133,6 @@ public final class MessageChannels { } private MessageChannels() { - super(); } } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/PollerFactory.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/PollerFactory.java index 7fb4cadaf6..5c47f292f0 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/PollerFactory.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/PollerFactory.java @@ -81,7 +81,6 @@ public final class PollerFactory { } PollerFactory() { - super(); } } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/PriorityChannelSpec.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/PriorityChannelSpec.java index 610337c712..84aad87957 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/PriorityChannelSpec.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/PriorityChannelSpec.java @@ -38,7 +38,6 @@ public class PriorityChannelSpec extends MessageChannelSpec { protected PublishSubscribeChannelSpec() { - this.channel = new PublishSubscribeChannel(); + this(null); } - protected PublishSubscribeChannelSpec(Executor executor) { + protected PublishSubscribeChannelSpec(@Nullable Executor executor) { this.channel = new PublishSubscribeChannel(executor); } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/dsl/PublishSubscribeSpec.java b/spring-integration-core/src/main/java/org/springframework/integration/dsl/PublishSubscribeSpec.java index 9a654f26cd..e9108290a5 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/dsl/PublishSubscribeSpec.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/dsl/PublishSubscribeSpec.java @@ -20,6 +20,7 @@ import java.util.LinkedHashMap; import java.util.Map; import java.util.concurrent.Executor; +import org.springframework.lang.Nullable; import org.springframework.messaging.MessageChannel; import org.springframework.util.Assert; @@ -36,10 +37,9 @@ public class PublishSubscribeSpec extends PublishSubscribeChannelSpec> queue) { @@ -73,7 +72,6 @@ public class QueueChannelSpec extends MessageChannelSpec> delegate = ReactiveStreamsConsumer.this.subscriber; DelegatingSubscriber() { - super(); } @Override diff --git a/spring-integration-core/src/main/java/org/springframework/integration/expression/ExpressionEvalMap.java b/spring-integration-core/src/main/java/org/springframework/integration/expression/ExpressionEvalMap.java index 57453d9acc..425c09faf6 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/expression/ExpressionEvalMap.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/expression/ExpressionEvalMap.java @@ -303,7 +303,6 @@ public final class ExpressionEvalMap extends AbstractMap { private class ExpressionEvalMapFinalBuilderImpl implements ExpressionEvalMapFinalBuilder { ExpressionEvalMapFinalBuilderImpl() { - super(); } @Override @@ -327,7 +326,6 @@ public final class ExpressionEvalMap extends AbstractMap { implements ExpressionEvalMapComponentsBuilder { ExpressionEvalMapComponentsBuilderImpl() { - super(); } @Override diff --git a/spring-integration-core/src/main/java/org/springframework/integration/expression/ExpressionUtils.java b/spring-integration-core/src/main/java/org/springframework/integration/expression/ExpressionUtils.java index 958dedc8b4..c20f29f3b5 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/expression/ExpressionUtils.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/expression/ExpressionUtils.java @@ -60,7 +60,6 @@ public final class ExpressionUtils { private static final Log LOGGER = LogFactory.getLog(ExpressionUtils.class); private ExpressionUtils() { - super(); } /** diff --git a/spring-integration-core/src/main/java/org/springframework/integration/expression/ReloadableResourceBundleExpressionSource.java b/spring-integration-core/src/main/java/org/springframework/integration/expression/ReloadableResourceBundleExpressionSource.java index e78bc29563..220f8a0634 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/expression/ReloadableResourceBundleExpressionSource.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/expression/ReloadableResourceBundleExpressionSource.java @@ -19,7 +19,6 @@ package org.springframework.integration.expression; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; -import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -53,7 +52,10 @@ import org.springframework.util.StringUtils; * @author Juergen Hoeller * @author Mark Fisher * @author Gary Russell + * @author Artem Bilan + * * @since 2.0 + * * @see #setCacheSeconds * @see #setBasenames * @see #setDefaultEncoding @@ -70,35 +72,40 @@ public class ReloadableResourceBundleExpressionSource implements ExpressionSourc private static final String XML_SUFFIX = ".xml"; - private static final Log logger = LogFactory.getLog(ReloadableResourceBundleExpressionSource.class); + private static final Log LOGGER = LogFactory.getLog(ReloadableResourceBundleExpressionSource.class); - private volatile String[] basenames = new String[0]; + /** + * Cache to hold filename lists per Locale + */ + private final Map>> cachedFilenames = new HashMap<>(); - private volatile String defaultEncoding; + /** + * Cache to hold already loaded properties per filename + */ + private final Map cachedProperties = new HashMap<>(); - private volatile Properties fileEncodings; - - private volatile boolean fallbackToSystemLocale = true; - - private volatile long cacheMillis = -1; - - private volatile PropertiesPersister propertiesPersister = new DefaultPropertiesPersister(); - - private volatile ResourceLoader resourceLoader = new DefaultResourceLoader(); - - /** Cache to hold filename lists per Locale */ - private final Map>> cachedFilenames = - new HashMap>>(); - - /** Cache to hold already loaded properties per filename */ - private final Map cachedProperties = new HashMap(); - - /** Cache to hold merged loaded properties per locale */ - private final Map cachedMergedProperties = new HashMap(); + /** + * Cache to hold merged loaded properties per locale + */ + private final Map cachedMergedProperties = new HashMap<>(); private final ExpressionParser parser = new SpelExpressionParser(new SpelParserConfiguration(true, true)); + private String[] basenames = { }; + + private String defaultEncoding; + + private Properties fileEncodings; + + private boolean fallbackToSystemLocale = true; + + private long cacheMillis = -1; + + private PropertiesPersister propertiesPersister = new DefaultPropertiesPersister(); + + private ResourceLoader resourceLoader = new DefaultResourceLoader(); + /** * Set a single basename, following the basic ResourceBundle convention of @@ -130,7 +137,7 @@ public class ReloadableResourceBundleExpressionSource implements ExpressionSourc * @see #setBasename * @see java.util.ResourceBundle */ - public void setBasenames(String[] basenames) { + public void setBasenames(@Nullable String[] basenames) { if (basenames != null) { this.basenames = new String[basenames.length]; for (int i = 0; i < basenames.length; i++) { @@ -182,7 +189,6 @@ public class ReloadableResourceBundleExpressionSource implements ExpressionSourc * desirable in an application server environment, where the system Locale * is not relevant to the application at all: Set this flag to "false" * in such a scenario. - * * @param fallbackToSystemLocale true to fall back. */ public void setFallbackToSystemLocale(boolean fallbackToSystemLocale) { @@ -202,7 +208,6 @@ public class ReloadableResourceBundleExpressionSource implements ExpressionSourc *
  • A value of "0" will check the last-modified timestamp of the file on * every expression access. Do not use this in a production environment! * - * * @param cacheSeconds The cache seconds. */ public void setCacheSeconds(int cacheSeconds) { @@ -212,12 +217,10 @@ public class ReloadableResourceBundleExpressionSource implements ExpressionSourc /** * Set the PropertiesPersister to use for parsing properties files. *

    The default is a DefaultPropertiesPersister. - * * @param propertiesPersister The properties persister. - * * @see org.springframework.util.DefaultPropertiesPersister */ - public void setPropertiesPersister(PropertiesPersister propertiesPersister) { + public void setPropertiesPersister(@Nullable PropertiesPersister propertiesPersister) { this.propertiesPersister = (propertiesPersister != null ? propertiesPersister : new DefaultPropertiesPersister()); } @@ -232,7 +235,7 @@ public class ReloadableResourceBundleExpressionSource implements ExpressionSourc * @see org.springframework.context.ResourceLoaderAware */ @Override - public void setResourceLoader(ResourceLoader resourceLoader) { + public void setResourceLoader(@Nullable ResourceLoader resourceLoader) { this.resourceLoader = (resourceLoader != null ? resourceLoader : new DefaultResourceLoader()); } @@ -253,10 +256,7 @@ public class ReloadableResourceBundleExpressionSource implements ExpressionSourc private String getExpressionString(String key, Locale locale) { if (this.cacheMillis < 0) { PropertiesHolder propHolder = getMergedProperties(locale); - String result = propHolder.getProperty(key); - if (result != null) { - return result; - } + return propHolder.getProperty(key); } else { for (String basename : this.basenames) { @@ -277,7 +277,7 @@ public class ReloadableResourceBundleExpressionSource implements ExpressionSourc * Get a PropertiesHolder that contains the actually visible properties * for a Locale, after merging all specified resource bundles. * Either fetches the holder from the cache or freshly loads it. - *

    Only used when caching resource bundle contents forever, i.e. + *

    Only used when caching resource bundle contents forever, i.e. * with cacheSeconds < 0. Therefore, merged properties are always * cached forever. */ @@ -323,7 +323,7 @@ public class ReloadableResourceBundleExpressionSource implements ExpressionSourc return filenames; } } - List filenames = new ArrayList(7); + List filenames = new ArrayList<>(7); filenames.addAll(calculateFilenamesForLocale(basename, locale)); if (this.fallbackToSystemLocale && !locale.equals(Locale.getDefault())) { List fallbackFilenames = calculateFilenamesForLocale(basename, Locale.getDefault()); @@ -339,7 +339,7 @@ public class ReloadableResourceBundleExpressionSource implements ExpressionSourc localeMap.put(locale, filenames); } else { - localeMap = new HashMap>(); + localeMap = new HashMap<>(); localeMap.put(locale, filenames); this.cachedFilenames.put(basename, localeMap); } @@ -358,7 +358,7 @@ public class ReloadableResourceBundleExpressionSource implements ExpressionSourc * @return the List of filenames to check */ private List calculateFilenamesForLocale(String basename, Locale locale) { - List result = new ArrayList(3); + List result = new ArrayList<>(3); String language = locale.getLanguage(); String country = locale.getCountry(); String variant = locale.getVariant(); @@ -423,8 +423,8 @@ public class ReloadableResourceBundleExpressionSource implements ExpressionSourc try { fileTimestamp = resource.lastModified(); if (propHolder != null && propHolder.getFileTimestamp() == fileTimestamp) { - if (logger.isDebugEnabled()) { - logger.debug("Re-caching properties for filename [" + filename + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Re-caching properties for filename [" + filename + "] - file hasn't been modified"); } propHolder.setRefreshTimestamp(refreshTimestamp); @@ -433,8 +433,8 @@ public class ReloadableResourceBundleExpressionSource implements ExpressionSourc } catch (IOException ex) { // Probably a class path resource: cache it forever. - if (logger.isDebugEnabled()) { - logger.debug(resource + if (LOGGER.isDebugEnabled()) { + LOGGER.debug(resource + " could not be resolved in the file system - assuming that is hasn't changed", ex); } fileTimestamp = -1; @@ -445,8 +445,8 @@ public class ReloadableResourceBundleExpressionSource implements ExpressionSourc else { // Resource does not exist. - if (logger.isDebugEnabled()) { - logger.debug("No properties file found for [" + filename + "] - neither plain properties nor XML"); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("No properties file found for [" + filename + "] - neither plain properties nor XML"); } // Empty holder representing "not found". propHolder = new PropertiesHolder(); @@ -472,8 +472,8 @@ public class ReloadableResourceBundleExpressionSource implements ExpressionSourc propHolder = new PropertiesHolder(props, fileTimestamp); } catch (IOException ex) { - if (logger.isWarnEnabled()) { - logger.warn("Could not parse properties file [" + resource.getFilename() + "]", ex); + if (LOGGER.isWarnEnabled()) { + LOGGER.warn("Could not parse properties file [" + resource.getFilename() + "]", ex); } // Empty holder representing "not valid". propHolder = new PropertiesHolder(); @@ -489,13 +489,12 @@ public class ReloadableResourceBundleExpressionSource implements ExpressionSourc * @throws IOException if properties loading failed */ private Properties loadProperties(Resource resource, String filename) throws IOException { - InputStream is = resource.getInputStream(); - Properties props = new Properties(); - try { + try (InputStream is = resource.getInputStream()) { + Properties props = new Properties(); String resourceFilename = resource.getFilename(); if (resourceFilename != null && resourceFilename.endsWith(XML_SUFFIX)) { - if (logger.isDebugEnabled()) { - logger.debug("Loading properties [" + resourceFilename + "]"); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Loading properties [" + resourceFilename + "]"); } this.propertiesPersister.loadFromXml(props, is); } @@ -504,13 +503,11 @@ public class ReloadableResourceBundleExpressionSource implements ExpressionSourc } return props; } - finally { - is.close(); - } } private void loadFromProperties(Resource resource, String filename, InputStream is, Properties props, - String resourceFilename) throws IOException, UnsupportedEncodingException { + @Nullable String resourceFilename) throws IOException { + String encoding = null; if (this.fileEncodings != null) { encoding = this.fileEncodings.getProperty(filename); @@ -519,16 +516,16 @@ public class ReloadableResourceBundleExpressionSource implements ExpressionSourc encoding = this.defaultEncoding; } if (encoding != null) { - if (logger.isDebugEnabled()) { - logger.debug("Loading properties [" + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Loading properties [" + (resourceFilename == null ? resource : resourceFilename) + "] with encoding '" + encoding + "'"); } this.propertiesPersister.load(props, new InputStreamReader(is, encoding)); } else { - if (logger.isDebugEnabled()) { - logger.debug("Loading properties [" + (resourceFilename == null ? resource : resourceFilename) + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("Loading properties [" + (resourceFilename == null ? resource : resourceFilename) + "]"); } this.propertiesPersister.load(props, is); @@ -541,7 +538,7 @@ public class ReloadableResourceBundleExpressionSource implements ExpressionSourc * Subsequent resolve calls will lead to reloading of the properties files. */ public void clearCache() { - logger.debug("Clearing entire resource bundle cache"); + LOGGER.debug("Clearing entire resource bundle cache"); synchronized (this.cachedProperties) { this.cachedProperties.clear(); } @@ -571,7 +568,6 @@ public class ReloadableResourceBundleExpressionSource implements ExpressionSourc private long refreshTimestamp = -1; PropertiesHolder() { - super(); } PropertiesHolder(Properties properties, long fileTimestamp) { @@ -579,6 +575,7 @@ public class ReloadableResourceBundleExpressionSource implements ExpressionSourc this.fileTimestamp = fileTimestamp; } + @Nullable public Properties getProperties() { return this.properties; } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/gateway/DefaultMethodInvokingMethodInterceptor.java b/spring-integration-core/src/main/java/org/springframework/integration/gateway/DefaultMethodInvokingMethodInterceptor.java index 15fe76794b..874ede2889 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/gateway/DefaultMethodInvokingMethodInterceptor.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/gateway/DefaultMethodInvokingMethodInterceptor.java @@ -85,7 +85,7 @@ class DefaultMethodInvokingMethodInterceptor implements MethodInterceptor { ENCAPSULATED { @Nullable - private final Method privateLookupIn = + private final transient Method privateLookupIn = ReflectionUtils.findMethod(MethodHandles.class, "privateLookupIn", Class.class, Lookup.class); @Override @@ -120,7 +120,7 @@ class DefaultMethodInvokingMethodInterceptor implements MethodInterceptor { OPEN { @Nullable - private final Constructor constructor; + private final transient Constructor constructor; { Constructor ctor = null; @@ -140,11 +140,13 @@ class DefaultMethodInvokingMethodInterceptor implements MethodInterceptor { @Override MethodHandle lookup(Method method) throws ReflectiveOperationException { - if (!isAvailable()) { + if (this.constructor != null) { + return this.constructor.newInstance(method.getDeclaringClass()) + .unreflectSpecial(method, method.getDeclaringClass()); + } + else { throw new IllegalStateException("Could not obtain MethodHandles.lookup constructor!"); } - return this.constructor.newInstance(method.getDeclaringClass()) - .unreflectSpecial(method, method.getDeclaringClass()); } @Override @@ -158,6 +160,7 @@ class DefaultMethodInvokingMethodInterceptor implements MethodInterceptor { * Fallback {@link MethodHandle} lookup using {@link MethodHandles#lookup() public lookup}. */ FALLBACK { + @Override MethodHandle lookup(Method method) throws ReflectiveOperationException { return doLookup(method, MethodHandles.lookup()); diff --git a/spring-integration-core/src/main/java/org/springframework/integration/gateway/GatewayProxyFactoryBean.java b/spring-integration-core/src/main/java/org/springframework/integration/gateway/GatewayProxyFactoryBean.java index fe242fb82c..6e996a597e 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/gateway/GatewayProxyFactoryBean.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/gateway/GatewayProxyFactoryBean.java @@ -509,7 +509,7 @@ public class GatewayProxyFactoryBean extends AbstractEndpoint try { return invocation.proceed(); } - catch (Throwable throwable) { + catch (Throwable throwable) { // NOSONAR throw new IllegalStateException(throwable); } } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/gateway/MessagingGatewaySupport.java b/spring-integration-core/src/main/java/org/springframework/integration/gateway/MessagingGatewaySupport.java index 38362936d7..24ccf7cd88 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/gateway/MessagingGatewaySupport.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/gateway/MessagingGatewaySupport.java @@ -843,7 +843,6 @@ public abstract class MessagingGatewaySupport extends AbstractEndpoint private volatile MessageBuilderFactory messageBuilderFactory = new DefaultMessageBuilderFactory(); DefaultRequestMapper() { - super(); } void setMessageBuilderFactory(MessageBuilderFactory messageBuilderFactory) { @@ -865,7 +864,6 @@ public abstract class MessagingGatewaySupport extends AbstractEndpoint private final MonoProcessor> replyMono = MonoProcessor.create(); MonoReplyChannel() { - super(); } @Override diff --git a/spring-integration-core/src/main/java/org/springframework/integration/graph/IntegrationGraphServer.java b/spring-integration-core/src/main/java/org/springframework/integration/graph/IntegrationGraphServer.java index 40365cb585..284c401564 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/graph/IntegrationGraphServer.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/graph/IntegrationGraphServer.java @@ -354,7 +354,6 @@ public class IntegrationGraphServer implements ApplicationContextAware, Applicat private final AtomicInteger nodeId = new AtomicInteger(); NodeFactory() { - super(); } MessageChannelNode channelNode(String name, MessageChannel channel) { diff --git a/spring-integration-core/src/main/java/org/springframework/integration/graph/IntegrationNode.java b/spring-integration-core/src/main/java/org/springframework/integration/graph/IntegrationNode.java index 77f5250be7..1064e262e1 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/graph/IntegrationNode.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/graph/IntegrationNode.java @@ -77,7 +77,7 @@ public abstract class IntegrationNode { IntegrationPatternType patternType = null; if (nodeObject instanceof IntegrationPattern) { - patternType = ((IntegrationPattern) nodeObject).getIntegrationPatternType(); + patternType = ((IntegrationPattern) nodeObject).getIntegrationPatternType(); // NOSONAR } else if (nodeObject instanceof MessageHandler) { patternType = IntegrationPatternType.service_activator; diff --git a/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractReactiveMessageHandler.java b/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractReactiveMessageHandler.java index 495dda14cf..ec7ab27845 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractReactiveMessageHandler.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractReactiveMessageHandler.java @@ -35,19 +35,22 @@ public abstract class AbstractReactiveMessageHandler extends MessageHandlerSuppo implements ReactiveMessageHandler { @Override - public Mono handleMessage(Message message) { - Assert.notNull(message, "Message must not be null"); + public Mono handleMessage(final Message message) { + Assert.notNull(message, "message must not be null"); if (isLoggingEnabled() && this.logger.isDebugEnabled()) { this.logger.debug(this + " received message: " + message); } + final Message messageToUse; if (shouldTrack()) { - message = MessageHistory.write(message, this, getMessageBuilderFactory()); + messageToUse = MessageHistory.write(message, this, getMessageBuilderFactory()); } - final Message msg = message; - return handleMessageInternal(msg) + else { + messageToUse = message; + } + return handleMessageInternal(messageToUse) .doOnError(e -> this.logger.error( - "An error occurred in message handler [" + this + "] on message [" + msg + "]", e)); + "An error occurred in message handler [" + this + "] on message [" + messageToUse + "]", e)); } protected abstract Mono handleMessageInternal(Message message); diff --git a/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractReplyProducingMessageHandler.java b/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractReplyProducingMessageHandler.java index 88140738a0..357fca5427 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractReplyProducingMessageHandler.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractReplyProducingMessageHandler.java @@ -127,9 +127,6 @@ public abstract class AbstractReplyProducingMessageHandler extends AbstractMessa protected void doInit() { } - /** - * {@inheritDoc} - */ @Override protected final void handleMessageInternal(Message message) { Object result; @@ -192,7 +189,6 @@ public abstract class AbstractReplyProducingMessageHandler extends AbstractMessa * {@code ((AbstractReplyProducingMessageHandler.RequestHandler) * invocation.getThis()).getAdvisedHandler().getComponentName()} * @return the outer class instance. - * * @since 4.3.2 */ AbstractReplyProducingMessageHandler getAdvisedHandler(); @@ -202,7 +198,6 @@ public abstract class AbstractReplyProducingMessageHandler extends AbstractMessa private class AdvisedRequestHandler implements RequestHandler { AdvisedRequestHandler() { - super(); } @Override diff --git a/spring-integration-core/src/main/java/org/springframework/integration/handler/DelayHandler.java b/spring-integration-core/src/main/java/org/springframework/integration/handler/DelayHandler.java index bc94fa441b..75b4ba4910 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/handler/DelayHandler.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/handler/DelayHandler.java @@ -602,7 +602,6 @@ public class DelayHandler extends AbstractReplyProducingMessageHandler implement private class ReleaseMessageHandler implements MessageHandler { ReleaseMessageHandler() { - super(); } @Override diff --git a/spring-integration-core/src/main/java/org/springframework/integration/handler/MessageHandlerChain.java b/spring-integration-core/src/main/java/org/springframework/integration/handler/MessageHandlerChain.java index 3b995a9f47..992bd147da 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/handler/MessageHandlerChain.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/handler/MessageHandlerChain.java @@ -238,7 +238,6 @@ public class MessageHandlerChain extends AbstractMessageProducingHandler private final class ReplyForwardingMessageChannel implements MessageChannel { ReplyForwardingMessageChannel() { - super(); } @Override diff --git a/spring-integration-core/src/main/java/org/springframework/integration/handler/advice/RequestHandlerCircuitBreakerAdvice.java b/spring-integration-core/src/main/java/org/springframework/integration/handler/advice/RequestHandlerCircuitBreakerAdvice.java index 0a7b47bf19..a03f018834 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/handler/advice/RequestHandlerCircuitBreakerAdvice.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/handler/advice/RequestHandlerCircuitBreakerAdvice.java @@ -40,7 +40,7 @@ public class RequestHandlerCircuitBreakerAdvice extends AbstractRequestHandlerAd private volatile long halfOpenAfter = 1000; - private final ConcurrentMap metadataMap = new ConcurrentHashMap(); + private final ConcurrentMap metadataMap = new ConcurrentHashMap<>(); public void setThreshold(int threshold) { this.threshold = threshold; @@ -88,7 +88,6 @@ public class RequestHandlerCircuitBreakerAdvice extends AbstractRequestHandlerAd private volatile long lastFailure; AdvisedMetadata() { - super(); } private long getLastFailure() { diff --git a/spring-integration-core/src/main/java/org/springframework/integration/json/SimpleJsonSerializer.java b/spring-integration-core/src/main/java/org/springframework/integration/json/SimpleJsonSerializer.java index 853df5e876..fe1eecfbc7 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/json/SimpleJsonSerializer.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/json/SimpleJsonSerializer.java @@ -43,7 +43,6 @@ public final class SimpleJsonSerializer { private static final Log logger = LogFactory.getLog(SimpleJsonSerializer.class); private SimpleJsonSerializer() { - super(); } /** diff --git a/spring-integration-core/src/main/java/org/springframework/integration/leader/DefaultCandidate.java b/spring-integration-core/src/main/java/org/springframework/integration/leader/DefaultCandidate.java index b527b290b3..3d4fab6255 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/leader/DefaultCandidate.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/leader/DefaultCandidate.java @@ -25,6 +25,7 @@ import org.apache.commons.logging.LogFactory; * * @author Janne Valkealahti * @author Artem Bilan + * * @since 4.2 */ public class DefaultCandidate extends AbstractCandidate { @@ -37,7 +38,6 @@ public class DefaultCandidate extends AbstractCandidate { * Instantiate a default candidate. */ public DefaultCandidate() { - super(); } /** diff --git a/spring-integration-core/src/main/java/org/springframework/integration/mapping/support/JsonHeaders.java b/spring-integration-core/src/main/java/org/springframework/integration/mapping/support/JsonHeaders.java index d7ffaf85d0..7d33d82570 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/mapping/support/JsonHeaders.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/mapping/support/JsonHeaders.java @@ -26,12 +26,12 @@ import java.util.Collections; * * @author Artem Bilan * @author Gary Russell + * * @since 3.0 */ public final class JsonHeaders { private JsonHeaders() { - super(); } public static final String PREFIX = "json"; diff --git a/spring-integration-core/src/main/java/org/springframework/integration/scheduling/PollSkipAdvice.java b/spring-integration-core/src/main/java/org/springframework/integration/scheduling/PollSkipAdvice.java index 6268ac7238..51927f04de 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/scheduling/PollSkipAdvice.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/scheduling/PollSkipAdvice.java @@ -27,6 +27,8 @@ import org.apache.commons.logging.LogFactory; * polling when some downstream condition exists in the flow. * * @author Gary Russell + * @author Artem Bilan + * * @since 4.1 * */ @@ -65,7 +67,6 @@ public class PollSkipAdvice implements MethodInterceptor { private static final class DefaultPollSkipStrategy implements PollSkipStrategy { DefaultPollSkipStrategy() { - super(); } @Override diff --git a/spring-integration-core/src/main/java/org/springframework/integration/store/AbstractMessageGroupStore.java b/spring-integration-core/src/main/java/org/springframework/integration/store/AbstractMessageGroupStore.java index 1bd3f79855..65451cb5a9 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/store/AbstractMessageGroupStore.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/store/AbstractMessageGroupStore.java @@ -52,7 +52,6 @@ public abstract class AbstractMessageGroupStore extends AbstractBatchingMessageG private boolean lazyLoadMessageGroups = true; protected AbstractMessageGroupStore() { - super(); } protected AbstractMessageGroupStore(boolean lazyLoadMessageGroups) { diff --git a/spring-integration-core/src/main/java/org/springframework/integration/store/PersistentMessageGroup.java b/spring-integration-core/src/main/java/org/springframework/integration/store/PersistentMessageGroup.java index 904e0aff6e..533d029a50 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/store/PersistentMessageGroup.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/store/PersistentMessageGroup.java @@ -173,7 +173,6 @@ class PersistentMessageGroup implements MessageGroup { private volatile Collection> collection; PersistentCollection() { - super(); } private void load() { diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/ErrorMessageUtils.java b/spring-integration-core/src/main/java/org/springframework/integration/support/ErrorMessageUtils.java index a018ec4f9f..0c2e0769ab 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/support/ErrorMessageUtils.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/support/ErrorMessageUtils.java @@ -25,6 +25,7 @@ import org.springframework.messaging.Message; * Utilities for building error messages. * * @author Gary Russell + * @author Artem Bilan * * @since 4.3.10 * @@ -41,7 +42,6 @@ public final class ErrorMessageUtils { public static final String INPUT_MESSAGE_CONTEXT_KEY = "inputMessage"; private ErrorMessageUtils() { - super(); } /** @@ -67,7 +67,6 @@ public final class ErrorMessageUtils { private static class ErrorMessageAttributes extends AttributeAccessorSupport { ErrorMessageAttributes() { - super(); } } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/channel/ChannelResolverUtils.java b/spring-integration-core/src/main/java/org/springframework/integration/support/channel/ChannelResolverUtils.java index a9b5d81cbe..f5e21bef6b 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/support/channel/ChannelResolverUtils.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/support/channel/ChannelResolverUtils.java @@ -26,6 +26,7 @@ import org.springframework.util.Assert; * * @author Artem Bilan * @author Gary Russell + * * @since 5.2 * */ @@ -34,7 +35,6 @@ public final class ChannelResolverUtils { public static final String CHANNEL_RESOLVER_BEAN_NAME = "integrationChannelResolver"; private ChannelResolverUtils() { - super(); } /** diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/converter/SimpleMessageConverter.java b/spring-integration-core/src/main/java/org/springframework/integration/support/converter/SimpleMessageConverter.java index 76b8a32be3..5c79b9e2d3 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/support/converter/SimpleMessageConverter.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/support/converter/SimpleMessageConverter.java @@ -130,11 +130,10 @@ public class SimpleMessageConverter implements MessageConverter, BeanFactoryAwar private class DefaultInboundMessageMapper implements InboundMessageMapper { DefaultInboundMessageMapper() { - super(); } @Override - public Message toMessage(Object object, @Nullable Map headers) { + public Message toMessage(@Nullable Object object, @Nullable Map headers) { if (object == null) { return null; } @@ -153,11 +152,10 @@ public class SimpleMessageConverter implements MessageConverter, BeanFactoryAwar private static class DefaultOutboundMessageMapper implements OutboundMessageMapper { DefaultOutboundMessageMapper() { - super(); } @Override - public Object fromMessage(Message message) { + public Object fromMessage(@Nullable Message message) { return (message != null) ? message.getPayload() : null; } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/json/JacksonJsonUtils.java b/spring-integration-core/src/main/java/org/springframework/integration/support/json/JacksonJsonUtils.java index f21555b5d8..64a95a9644 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/support/json/JacksonJsonUtils.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/support/json/JacksonJsonUtils.java @@ -52,7 +52,6 @@ import com.fasterxml.jackson.databind.module.SimpleModule; public final class JacksonJsonUtils { private JacksonJsonUtils() { - super(); } /** diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/json/JacksonPresent.java b/spring-integration-core/src/main/java/org/springframework/integration/support/json/JacksonPresent.java index 09aa266126..47b7cf3f8d 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/support/json/JacksonPresent.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/support/json/JacksonPresent.java @@ -47,7 +47,6 @@ public final class JacksonPresent { private JacksonPresent() { - super(); } } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/json/JsonObjectMapperProvider.java b/spring-integration-core/src/main/java/org/springframework/integration/support/json/JsonObjectMapperProvider.java index 47d5c72611..a2de31616d 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/support/json/JsonObjectMapperProvider.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/support/json/JsonObjectMapperProvider.java @@ -40,7 +40,6 @@ public final class JsonObjectMapperProvider { ClassUtils.isPresent("org.boon.json.ObjectMapper", classLoader); private JsonObjectMapperProvider() { - super(); } /** diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/leader/LockRegistryLeaderInitiator.java b/spring-integration-core/src/main/java/org/springframework/integration/support/leader/LockRegistryLeaderInitiator.java index f41323b211..6ff2db2ccf 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/support/leader/LockRegistryLeaderInitiator.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/support/leader/LockRegistryLeaderInitiator.java @@ -508,7 +508,6 @@ public class LockRegistryLeaderInitiator implements SmartLifecycle, DisposableBe private class LockContext implements Context { LockContext() { - super(); } @Override diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/locks/PassThruLockRegistry.java b/spring-integration-core/src/main/java/org/springframework/integration/support/locks/PassThruLockRegistry.java index 8ea96aef93..9292f02c60 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/support/locks/PassThruLockRegistry.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/support/locks/PassThruLockRegistry.java @@ -29,6 +29,7 @@ import java.util.concurrent.locks.Lock; * * @author Oleg Zhurakousky * @author Gary Russell + * * @since 2.2 * */ @@ -42,7 +43,6 @@ public final class PassThruLockRegistry implements LockRegistry { private static final class PassThruLock implements Lock { PassThruLock() { - super(); } @Override @@ -74,6 +74,7 @@ public final class PassThruLockRegistry implements LockRegistry { public void lock() { // noop } + } } 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 b12d0e745d..65010417eb 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 @@ -62,7 +62,6 @@ public final class IntegrationUtils { Boolean.parseBoolean(System.getenv("SI_FATAL_WHEN_NO_BEANFACTORY")); private IntegrationUtils() { - super(); } /** diff --git a/spring-integration-core/src/main/java/org/springframework/integration/transformer/ContentEnricher.java b/spring-integration-core/src/main/java/org/springframework/integration/transformer/ContentEnricher.java index d87db1b092..03a6b6698d 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/transformer/ContentEnricher.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/transformer/ContentEnricher.java @@ -20,6 +20,7 @@ import java.lang.reflect.Method; import java.util.HashMap; import java.util.Map; +import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.BeanFactoryAware; import org.springframework.beans.factory.BeanInitializationException; import org.springframework.context.Lifecycle; @@ -231,7 +232,6 @@ public class ContentEnricher extends AbstractReplyProducingMessageHandler implem * If more sophisticated logic is required (e.g. changing the message headers etc.) * please use additional downstream transformers. * @param requestPayloadExpression The request payload expression. - * */ public void setRequestPayloadExpression(Expression requestPayloadExpression) { this.requestPayloadExpression = requestPayloadExpression; @@ -283,6 +283,9 @@ public class ContentEnricher extends AbstractReplyProducingMessageHandler implem Assert.state(this.requestChannel != null || this.requestChannelName != null, "If the errorChannel is set, then the requestChannel must not be null"); } + + BeanFactory beanFactory = getBeanFactory(); + if (this.requestChannel != null || this.requestChannelName != null) { this.gateway = new Gateway(); if (this.requestChannel != null) { @@ -309,23 +312,24 @@ public class ContentEnricher extends AbstractReplyProducingMessageHandler implem this.gateway.setErrorChannelName(this.errorChannelName); } - if (this.getBeanFactory() != null) { - this.gateway.setBeanFactory(this.getBeanFactory()); + if (beanFactory != null) { + this.gateway.setBeanFactory(beanFactory); } this.gateway.afterPropertiesSet(); } + if (this.sourceEvaluationContext == null) { - this.sourceEvaluationContext = ExpressionUtils.createStandardEvaluationContext(getBeanFactory()); + this.sourceEvaluationContext = ExpressionUtils.createStandardEvaluationContext(beanFactory); } - StandardEvaluationContext targetContext = ExpressionUtils.createStandardEvaluationContext(getBeanFactory()); + StandardEvaluationContext targetContext = ExpressionUtils.createStandardEvaluationContext(beanFactory); // bean resolution is NOT allowed for the target of the enrichment targetContext.setBeanResolver(null); // NOSONAR (null) this.targetEvaluationContext = targetContext; - if (getBeanFactory() != null) { + if (beanFactory != null) { boolean checkReadOnlyHeaders = getMessageBuilderFactory() instanceof DefaultMessageBuilderFactory; for (Map.Entry> entry : this.headerExpressions.entrySet()) { @@ -337,7 +341,7 @@ public class ContentEnricher extends AbstractReplyProducingMessageHandler implem + "] configuration for " + getComponentName()); } if (entry.getValue() instanceof BeanFactoryAware) { - ((BeanFactoryAware) entry.getValue()).setBeanFactory(getBeanFactory()); + ((BeanFactoryAware) entry.getValue()).setBeanFactory(beanFactory); } } @@ -351,7 +355,7 @@ public class ContentEnricher extends AbstractReplyProducingMessageHandler implem + "] configuration for " + getComponentName()); } if (entry.getValue() instanceof BeanFactoryAware) { - ((BeanFactoryAware) entry.getValue()).setBeanFactory(getBeanFactory()); + ((BeanFactoryAware) entry.getValue()).setBeanFactory(beanFactory); } } } @@ -406,8 +410,7 @@ public class ContentEnricher extends AbstractReplyProducingMessageHandler implem return targetPayload; } else { - Map targetHeaders = new HashMap<>( - this.nullResultHeaderExpressions.size()); + Map targetHeaders = new HashMap<>(this.nullResultHeaderExpressions.size()); for (Map.Entry> entry : this.nullResultHeaderExpressions .entrySet()) { String header = entry.getKey(); @@ -435,7 +438,7 @@ public class ContentEnricher extends AbstractReplyProducingMessageHandler implem return targetPayload; } else { - Map targetHeaders = new HashMap(this.headerExpressions.size()); + Map targetHeaders = new HashMap<>(this.headerExpressions.size()); for (Map.Entry> entry : this.headerExpressions.entrySet()) { String header = entry.getKey(); HeaderValueMessageProcessor valueProcessor = entry.getValue(); @@ -490,7 +493,6 @@ public class ContentEnricher extends AbstractReplyProducingMessageHandler implem private static final class Gateway extends MessagingGatewaySupport { Gateway() { - super(); } @Override diff --git a/spring-integration-core/src/main/java/org/springframework/integration/transformer/HeaderEnricher.java b/spring-integration-core/src/main/java/org/springframework/integration/transformer/HeaderEnricher.java index f90bffde1a..4393c274f5 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/transformer/HeaderEnricher.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/transformer/HeaderEnricher.java @@ -20,6 +20,7 @@ import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; +import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.BeanFactoryAware; import org.springframework.beans.factory.BeanInitializationException; import org.springframework.integration.IntegrationPattern; @@ -103,7 +104,24 @@ public class HeaderEnricher extends IntegrationObjectSupport implements Transfor public void onInit() { boolean shouldOverwrite = this.defaultOverwrite; boolean checkReadOnlyHeaders = getMessageBuilderFactory() instanceof DefaultMessageBuilderFactory; + shouldOverwrite = initializeHeadersToAdd(shouldOverwrite, checkReadOnlyHeaders); + BeanFactory beanFactory = getBeanFactory(); + if (this.messageProcessor != null + && this.messageProcessor instanceof BeanFactoryAware + && beanFactory != null) { + ((BeanFactoryAware) this.messageProcessor).setBeanFactory(beanFactory); + } + + if (!shouldOverwrite && !this.shouldSkipNulls && logger.isWarnEnabled()) { + logger.warn(getComponentName() + + " is configured to not overwrite existing headers. 'shouldSkipNulls = false' will have no effect"); + } + } + + private boolean initializeHeadersToAdd(boolean shouldOverwrite, boolean checkReadOnlyHeaders) { + boolean overwrite = shouldOverwrite; + BeanFactory beanFactory = getBeanFactory(); for (Entry> entry : this.headersToAdd.entrySet()) { if (checkReadOnlyHeaders && (MessageHeaders.ID.equals(entry.getKey()) || MessageHeaders.TIMESTAMP.equals(entry.getKey()))) { @@ -114,25 +132,15 @@ public class HeaderEnricher extends IntegrationObjectSupport implements Transfor } HeaderValueMessageProcessor processor = entry.getValue(); - if (processor instanceof BeanFactoryAware && getBeanFactory() != null) { - ((BeanFactoryAware) processor).setBeanFactory(getBeanFactory()); + if (processor instanceof BeanFactoryAware && beanFactory != null) { + ((BeanFactoryAware) processor).setBeanFactory(beanFactory); } Boolean processorOverwrite = processor.isOverwrite(); if (processorOverwrite != null) { - shouldOverwrite |= processorOverwrite; + overwrite |= processorOverwrite; } } - - if (this.messageProcessor != null - && this.messageProcessor instanceof BeanFactoryAware - && getBeanFactory() != null) { - ((BeanFactoryAware) this.messageProcessor).setBeanFactory(getBeanFactory()); - } - - if (!shouldOverwrite && !this.shouldSkipNulls && logger.isWarnEnabled()) { - logger.warn(getComponentName() + - " is configured to not overwrite existing headers. 'shouldSkipNulls = false' will have no effect"); - } + return overwrite; } @Override diff --git a/spring-integration-core/src/main/java/org/springframework/integration/transformer/support/AvroHeaders.java b/spring-integration-core/src/main/java/org/springframework/integration/transformer/support/AvroHeaders.java index b4cf4975a5..334454996c 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/transformer/support/AvroHeaders.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/transformer/support/AvroHeaders.java @@ -27,7 +27,6 @@ package org.springframework.integration.transformer.support; public final class AvroHeaders { private AvroHeaders() { - super(); } /** diff --git a/spring-integration-core/src/main/java/org/springframework/integration/util/JavaUtils.java b/spring-integration-core/src/main/java/org/springframework/integration/util/JavaUtils.java index 400f8f9639..68d12d88f8 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/util/JavaUtils.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/util/JavaUtils.java @@ -41,7 +41,6 @@ public final class JavaUtils { public static final JavaUtils INSTANCE = new JavaUtils(); private JavaUtils() { - super(); } /** diff --git a/spring-integration-feed/src/main/java/org/springframework/integration/feed/dsl/Feed.java b/spring-integration-feed/src/main/java/org/springframework/integration/feed/dsl/Feed.java index cc9ce66268..a004342fa4 100644 --- a/spring-integration-feed/src/main/java/org/springframework/integration/feed/dsl/Feed.java +++ b/spring-integration-feed/src/main/java/org/springframework/integration/feed/dsl/Feed.java @@ -24,6 +24,7 @@ import org.springframework.core.io.Resource; * The Spring Integration Feed components Factory. * * @author Artem Bilan + * * @since 5.0 */ public final class Feed { @@ -37,7 +38,6 @@ public final class Feed { } private Feed() { - super(); } } diff --git a/spring-integration-feed/src/main/java/org/springframework/integration/feed/inbound/FeedEntryMessageSource.java b/spring-integration-feed/src/main/java/org/springframework/integration/feed/inbound/FeedEntryMessageSource.java index 0edcae2047..d3798ced66 100644 --- a/spring-integration-feed/src/main/java/org/springframework/integration/feed/inbound/FeedEntryMessageSource.java +++ b/spring-integration-feed/src/main/java/org/springframework/integration/feed/inbound/FeedEntryMessageSource.java @@ -19,7 +19,6 @@ package org.springframework.integration.feed.inbound; import java.io.Reader; import java.io.Serializable; import java.net.URL; -import java.util.Collections; import java.util.Comparator; import java.util.Date; import java.util.List; @@ -71,11 +70,11 @@ public class FeedEntryMessageSource extends AbstractMessageSource { private final Object feedMonitor = new Object(); - private volatile SyndFeedInput syndFeedInput = new SyndFeedInput(); + private SyndFeedInput syndFeedInput = new SyndFeedInput(); private boolean syndFeedInputSet; - private volatile MetadataStore metadataStore; + private MetadataStore metadataStore; private volatile long lastTime = -1; @@ -148,7 +147,7 @@ public class FeedEntryMessageSource extends AbstractMessageSource { protected void onInit() { if (this.metadataStore == null) { // first try to look for a 'messageStore' in the context - BeanFactory beanFactory = this.getBeanFactory(); + BeanFactory beanFactory = getBeanFactory(); if (beanFactory != null) { this.metadataStore = IntegrationContextUtils.getMetadataStore(beanFactory); } @@ -204,7 +203,7 @@ public class FeedEntryMessageSource extends AbstractMessageSource { List retrievedEntries = syndFeed.getEntries(); if (!CollectionUtils.isEmpty(retrievedEntries)) { boolean withinNewEntries = false; - Collections.sort(retrievedEntries, this.syndEntryComparator); + retrievedEntries.sort(this.syndEntryComparator); for (SyndEntry entry : retrievedEntries) { Date entryDate = getLastModifiedDate(entry); if ((entryDate != null && entryDate.getTime() > this.lastTime) @@ -259,7 +258,6 @@ public class FeedEntryMessageSource extends AbstractMessageSource { private static final class SyndEntryPublishedDateComparator implements Comparator, Serializable { SyndEntryPublishedDateComparator() { - super(); } @Override diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/FileWritingMessageHandler.java b/spring-integration-file/src/main/java/org/springframework/integration/file/FileWritingMessageHandler.java index f60c340f60..8b87af7fa4 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/FileWritingMessageHandler.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/FileWritingMessageHandler.java @@ -1091,7 +1091,6 @@ public class FileWritingMessageHandler extends AbstractReplyProducingMessageHand private final class Flusher implements Runnable { Flusher() { - super(); } @Override @@ -1170,7 +1169,6 @@ public class FileWritingMessageHandler extends AbstractReplyProducingMessageHand private static final class DefaultFlushPredicate implements MessageFlushPredicate { DefaultFlushPredicate() { - super(); } @Override diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/filters/ChainFileListFilter.java b/spring-integration-file/src/main/java/org/springframework/integration/file/filters/ChainFileListFilter.java index aaef37c95a..eadcc72672 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/filters/ChainFileListFilter.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/filters/ChainFileListFilter.java @@ -40,7 +40,6 @@ import org.springframework.util.Assert; public class ChainFileListFilter extends CompositeFileListFilter { public ChainFileListFilter() { - super(); } public ChainFileListFilter(Collection> fileFilters) { diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/locking/FileChannelCache.java b/spring-integration-file/src/main/java/org/springframework/integration/file/locking/FileChannelCache.java index ed7a4ad46e..adbc63110d 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/locking/FileChannelCache.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/locking/FileChannelCache.java @@ -33,6 +33,8 @@ import org.springframework.lang.Nullable; * @author Iwein Fuld * @author Gary Russell * @author Emmanuel Roux + * @author Artem Bilan + * * @since 2.0 */ final class FileChannelCache { @@ -41,12 +43,11 @@ final class FileChannelCache { private FileChannelCache() { - super(); } /** * Try to get a lock for this file while guaranteeing that the same channel will be used for all file locks in this - * VM. If the lock could not be acquired this method will return null. + * VM. If the lock could not be acquired this method will return {@code null}. *

    * Locks acquired through this method should be passed back to #closeChannelFor to prevent memory leaks. *

    diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/remote/RemoteFileUtils.java b/spring-integration-file/src/main/java/org/springframework/integration/file/remote/RemoteFileUtils.java index 00db0afc35..ff9f8e52ca 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/remote/RemoteFileUtils.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/remote/RemoteFileUtils.java @@ -26,14 +26,15 @@ import org.springframework.integration.file.remote.session.Session; /** * Utility methods for supporting remote file operations. + * * @author Gary Russell + * * @since 3.0 * */ public final class RemoteFileUtils { private RemoteFileUtils() { - super(); } /** @@ -53,7 +54,7 @@ public final class RemoteFileUtils { int nextSeparatorIndex = path.lastIndexOf(remoteFileSeparator); if (nextSeparatorIndex > -1) { - List pathsToCreate = new LinkedList(); + List pathsToCreate = new LinkedList<>(); while (nextSeparatorIndex > -1) { String pathSegment = path.substring(0, nextSeparatorIndex); if (pathSegment.length() == 0 || session.exists(pathSegment)) { diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/support/FileUtils.java b/spring-integration-file/src/main/java/org/springframework/integration/file/support/FileUtils.java index 3b732f907c..72e198735d 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/support/FileUtils.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/support/FileUtils.java @@ -29,6 +29,7 @@ import org.springframework.util.ObjectUtils; * Utilities for operations on Files. * * @author Gary Russell + * * @since 5.0 * */ @@ -48,6 +49,7 @@ public final class FileUtils { @SuppressWarnings("unchecked") public static F[] purgeUnwantedElements(F[] fileArray, Predicate predicate, @Nullable Comparator comparator) { + if (ObjectUtils.isEmpty(fileArray)) { return fileArray; } @@ -67,7 +69,6 @@ public final class FileUtils { } private FileUtils() { - super(); } } diff --git a/spring-integration-file/src/test/java/org/springframework/integration/file/remote/synchronizer/AbstractRemoteFileSynchronizerTests.java b/spring-integration-file/src/test/java/org/springframework/integration/file/remote/synchronizer/AbstractRemoteFileSynchronizerTests.java index 36eea32837..5c73e12878 100644 --- a/spring-integration-file/src/test/java/org/springframework/integration/file/remote/synchronizer/AbstractRemoteFileSynchronizerTests.java +++ b/spring-integration-file/src/test/java/org/springframework/integration/file/remote/synchronizer/AbstractRemoteFileSynchronizerTests.java @@ -292,7 +292,6 @@ public class AbstractRemoteFileSynchronizerTests { private static class StringSession implements Session { StringSession() { - super(); } @Override diff --git a/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/dsl/Ftp.java b/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/dsl/Ftp.java index b27b997f92..bbf8b5248f 100644 --- a/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/dsl/Ftp.java +++ b/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/dsl/Ftp.java @@ -34,6 +34,7 @@ import org.springframework.integration.ftp.session.FtpRemoteFileTemplate; * * @author Artem Bilan * @author Gary Russell + * * @since 5.0 */ public final class Ftp { @@ -55,6 +56,7 @@ public final class Ftp { */ public static FtpInboundChannelAdapterSpec inboundAdapter(SessionFactory sessionFactory, Comparator receptionOrderComparator) { + return new FtpInboundChannelAdapterSpec(sessionFactory, receptionOrderComparator); } @@ -66,6 +68,7 @@ public final class Ftp { */ public static FtpStreamingInboundChannelAdapterSpec inboundStreamingAdapter( RemoteFileTemplate remoteFileTemplate) { + return inboundStreamingAdapter(remoteFileTemplate, null); } @@ -79,6 +82,7 @@ public final class Ftp { public static FtpStreamingInboundChannelAdapterSpec inboundStreamingAdapter( RemoteFileTemplate remoteFileTemplate, Comparator receptionOrderComparator) { + return new FtpStreamingInboundChannelAdapterSpec(remoteFileTemplate, receptionOrderComparator); } @@ -99,6 +103,7 @@ public final class Ftp { */ public static FtpMessageHandlerSpec outboundAdapter(SessionFactory sessionFactory, FileExistsMode fileExistsMode) { + return outboundAdapter(new FtpRemoteFileTemplate(sessionFactory), fileExistsMode); } @@ -119,6 +124,7 @@ public final class Ftp { */ public static FtpMessageHandlerSpec outboundAdapter(RemoteFileTemplate remoteFileTemplate, FileExistsMode fileExistsMode) { + return new FtpMessageHandlerSpec(remoteFileTemplate, fileExistsMode); } @@ -133,6 +139,7 @@ public final class Ftp { */ public static FtpOutboundGatewaySpec outboundGateway(SessionFactory sessionFactory, AbstractRemoteFileOutboundGateway.Command command, String expression) { + return outboundGateway(sessionFactory, command.getCommand(), expression); } @@ -148,6 +155,7 @@ public final class Ftp { */ public static FtpOutboundGatewaySpec outboundGateway(SessionFactory sessionFactory, String command, String expression) { + return new FtpOutboundGatewaySpec(new FtpOutboundGateway(sessionFactory, command, expression)); } @@ -163,6 +171,7 @@ public final class Ftp { */ public static FtpOutboundGatewaySpec outboundGateway(RemoteFileTemplate remoteFileTemplate, AbstractRemoteFileOutboundGateway.Command command, String expression) { + return outboundGateway(remoteFileTemplate, command.getCommand(), expression); } @@ -178,6 +187,7 @@ public final class Ftp { */ public static FtpOutboundGatewaySpec outboundGateway(RemoteFileTemplate remoteFileTemplate, String command, String expression) { + return new FtpOutboundGatewaySpec(new FtpOutboundGateway(remoteFileTemplate, command, expression)); } @@ -193,11 +203,11 @@ public final class Ftp { */ public static FtpOutboundGatewaySpec outboundGateway(SessionFactory sessionFactory, MessageSessionCallback messageSessionCallback) { + return new FtpOutboundGatewaySpec(new FtpOutboundGateway(sessionFactory, messageSessionCallback)); } private Ftp() { - super(); } } diff --git a/spring-integration-gemfire/src/main/java/org/springframework/integration/gemfire/metadata/GemfireMetadataStore.java b/spring-integration-gemfire/src/main/java/org/springframework/integration/gemfire/metadata/GemfireMetadataStore.java index 0bc8ee1079..6630883014 100644 --- a/spring-integration-gemfire/src/main/java/org/springframework/integration/gemfire/metadata/GemfireMetadataStore.java +++ b/spring-integration-gemfire/src/main/java/org/springframework/integration/gemfire/metadata/GemfireMetadataStore.java @@ -116,7 +116,6 @@ public class GemfireMetadataStore implements ListenableMetadataStore { private final List listeners = new CopyOnWriteArrayList<>(); GemfireCacheListener() { - super(); } @Override diff --git a/spring-integration-groovy/src/main/java/org/springframework/integration/groovy/GroovyCommandMessageProcessor.java b/spring-integration-groovy/src/main/java/org/springframework/integration/groovy/GroovyCommandMessageProcessor.java index 36afb682f0..b894d36f75 100644 --- a/spring-integration-groovy/src/main/java/org/springframework/integration/groovy/GroovyCommandMessageProcessor.java +++ b/spring-integration-groovy/src/main/java/org/springframework/integration/groovy/GroovyCommandMessageProcessor.java @@ -62,7 +62,6 @@ public class GroovyCommandMessageProcessor extends AbstractScriptExecutingMessag * {@link org.springframework.integration.scripting.DefaultScriptVariableGenerator}. */ public GroovyCommandMessageProcessor() { - super(); } /** diff --git a/spring-integration-http/src/main/java/org/springframework/integration/http/config/HttpContextUtils.java b/spring-integration-http/src/main/java/org/springframework/integration/http/config/HttpContextUtils.java index 7a4faa6def..319329a24b 100644 --- a/spring-integration-http/src/main/java/org/springframework/integration/http/config/HttpContextUtils.java +++ b/spring-integration-http/src/main/java/org/springframework/integration/http/config/HttpContextUtils.java @@ -30,12 +30,12 @@ import org.springframework.web.bind.annotation.RequestMapping; * * @author Artem Bilan * @author Gary Russell + * * @since 3.0 */ public final class HttpContextUtils { private HttpContextUtils() { - super(); } /** diff --git a/spring-integration-http/src/main/java/org/springframework/integration/http/dsl/Http.java b/spring-integration-http/src/main/java/org/springframework/integration/http/dsl/Http.java index d195386bc8..939839fbd9 100644 --- a/spring-integration-http/src/main/java/org/springframework/integration/http/dsl/Http.java +++ b/spring-integration-http/src/main/java/org/springframework/integration/http/dsl/Http.java @@ -26,7 +26,6 @@ import org.springframework.integration.http.inbound.HttpRequestHandlingControlle import org.springframework.integration.http.inbound.HttpRequestHandlingMessagingGateway; import org.springframework.messaging.Message; import org.springframework.util.Assert; -import org.springframework.util.StringUtils; import org.springframework.web.client.RestTemplate; /** @@ -111,6 +110,7 @@ public final class Http { */ public static

    HttpMessageHandlerSpec outboundChannelAdapter(Function, ?> uriFunction, RestTemplate restTemplate) { + return outboundChannelAdapter(new FunctionExpression<>(uriFunction), restTemplate); } @@ -198,6 +198,7 @@ public final class Http { */ public static

    HttpMessageHandlerSpec outboundGateway(Function, ?> uriFunction, RestTemplate restTemplate) { + return outboundGateway(new FunctionExpression<>(uriFunction), restTemplate); } @@ -221,7 +222,7 @@ public final class Http { * @return the HttpControllerEndpointSpec instance */ public static HttpControllerEndpointSpec inboundControllerAdapter(String viewName, String... path) { - Assert.isTrue(StringUtils.hasText(viewName), "View name must not be empty"); + Assert.hasText(viewName, "View name must not be empty"); return inboundControllerAdapter(new LiteralExpression(viewName), path); } @@ -246,7 +247,7 @@ public final class Http { * @return the HttpControllerEndpointSpec instance */ public static HttpControllerEndpointSpec inboundControllerGateway(String viewName, String... path) { - Assert.isTrue(StringUtils.hasText(viewName), "View name must not be empty"); + Assert.hasText(viewName, "View name must not be empty"); return inboundControllerGateway(new LiteralExpression(viewName), path); } @@ -285,7 +286,6 @@ public final class Http { } private Http() { - super(); } } diff --git a/spring-integration-http/src/main/java/org/springframework/integration/http/dsl/HttpInboundEndpointSupportSpec.java b/spring-integration-http/src/main/java/org/springframework/integration/http/dsl/HttpInboundEndpointSupportSpec.java index 09fbecee14..b18179c502 100644 --- a/spring-integration-http/src/main/java/org/springframework/integration/http/dsl/HttpInboundEndpointSupportSpec.java +++ b/spring-integration-http/src/main/java/org/springframework/integration/http/dsl/HttpInboundEndpointSupportSpec.java @@ -190,7 +190,7 @@ public abstract class HttpInboundEndpointSupportSpec "The 'mappedRequestHeaders' must be specified on the provided 'headerMapper': " + this.explicitHeaderMapper); ((DefaultHttpHeaderMapper) this.headerMapper).setInboundHeaderNames(patterns); return _this(); @@ -204,7 +204,7 @@ public abstract class HttpInboundEndpointSupportSpec "The 'mappedRequestHeaders' must be specified on the provided 'headerMapper': " + this.explicitHeaderMapper); ((DefaultHttpHeaderMapper) this.headerMapper).setOutboundHeaderNames(patterns); return _this(); @@ -214,7 +214,7 @@ public abstract class HttpInboundEndpointSupportSpecbyte[].class. + * result in String while all others default to {@code byte[].class}. * @param requestPayloadType The payload type. * @return the current Spec. */ @@ -227,7 +227,7 @@ public abstract class HttpInboundEndpointSupportSpecbyte[].class. + * result in String while all others default to {@code byte[].class}. * @param requestPayloadType The payload type. * @return the current Spec. */ @@ -373,7 +373,6 @@ public abstract class HttpInboundEndpointSupportSpec the target {@link AbstractUdpOutboundChannelAdapterSpec} implementation type. * * @author Gary Russell + * * @since 5.0 * */ @@ -37,7 +38,6 @@ public abstract class AbstractUdpOutboundChannelAdapterSpec { protected AbstractUdpOutboundChannelAdapterSpec() { - super(); } protected AbstractUdpOutboundChannelAdapterSpec(String host, int port) { diff --git a/spring-integration-ip/src/main/java/org/springframework/integration/ip/dsl/Tcp.java b/spring-integration-ip/src/main/java/org/springframework/integration/ip/dsl/Tcp.java index 861aadb164..03f32c06d8 100644 --- a/spring-integration-ip/src/main/java/org/springframework/integration/ip/dsl/Tcp.java +++ b/spring-integration-ip/src/main/java/org/springframework/integration/ip/dsl/Tcp.java @@ -31,23 +31,7 @@ import org.springframework.integration.ip.tcp.connection.AbstractConnectionFacto */ public final class Tcp { - /** - * Boolean indicating the connection factory should use NIO. - * @deprecated This isn't used anymore within the framework and will be removed in a future release. - */ - @Deprecated - public static final boolean NIO = true; - - /** - * Boolean indicating the connection factory should not use NIO - * (default). - * @deprecated This isn't used anymore within the framework and will be removed in a future release. - */ - @Deprecated - public static final boolean NET = false; - private Tcp() { - super(); } /** diff --git a/spring-integration-ip/src/main/java/org/springframework/integration/ip/dsl/Udp.java b/spring-integration-ip/src/main/java/org/springframework/integration/ip/dsl/Udp.java index 6873c32c4d..6f4c1fb686 100644 --- a/spring-integration-ip/src/main/java/org/springframework/integration/ip/dsl/Udp.java +++ b/spring-integration-ip/src/main/java/org/springframework/integration/ip/dsl/Udp.java @@ -24,13 +24,13 @@ import org.springframework.messaging.Message; * Factory methods for UDP. * * @author Gary Russell + * * @since 5.0 * */ public final class Udp { private Udp() { - super(); } /** @@ -109,8 +109,9 @@ public final class Udp { * @param destinationFunction function that will provide the destination based on the message. * @return the spec. */ - public static UdpMulticastOutboundChannelAdapterSpec outboundMulticastAdapter(Function, ?> - destinationFunction) { + public static UdpMulticastOutboundChannelAdapterSpec outboundMulticastAdapter( + Function, ?> destinationFunction) { + return new UdpMulticastOutboundChannelAdapterSpec(destinationFunction); } diff --git a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/TcpConnectionInterceptorSupport.java b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/TcpConnectionInterceptorSupport.java index b7e831fb66..bad62d5295 100644 --- a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/TcpConnectionInterceptorSupport.java +++ b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/TcpConnectionInterceptorSupport.java @@ -25,10 +25,11 @@ import org.springframework.messaging.Message; import org.springframework.messaging.support.ErrorMessage; /** - * Base class for TcpConnectionIntercepters; passes all method calls through + * Base class for {@link TcpConnectionInterceptor}s; passes all method calls through * to the underlying {@link TcpConnection}. * * @author Gary Russell + * * @since 2.0 */ public abstract class TcpConnectionInterceptorSupport extends TcpConnectionSupport implements TcpConnectionInterceptor { @@ -42,7 +43,6 @@ public abstract class TcpConnectionInterceptorSupport extends TcpConnectionSuppo private Boolean realSender; public TcpConnectionInterceptorSupport() { - super(); } public TcpConnectionInterceptorSupport(ApplicationEventPublisher applicationEventPublisher) { @@ -221,7 +221,7 @@ public abstract class TcpConnectionInterceptorSupport extends TcpConnectionSuppo if (this.realSender != null) { return this.realSender; } - TcpSender sender = this.getSender(); + TcpSender sender = getSender(); while (sender instanceof TcpConnectionInterceptorSupport) { sender = ((TcpConnectionInterceptorSupport) sender).getSender(); } diff --git a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/serializer/SoftEndOfStreamException.java b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/serializer/SoftEndOfStreamException.java index 868d8b0a6e..4ee15c4536 100644 --- a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/serializer/SoftEndOfStreamException.java +++ b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/serializer/SoftEndOfStreamException.java @@ -21,6 +21,7 @@ package org.springframework.integration.ip.tcp.serializer; * messages. * * @author Gary Russell + * * @since 2.0 * */ @@ -32,7 +33,6 @@ public class SoftEndOfStreamException extends RuntimeException { * Default constructor. */ public SoftEndOfStreamException() { - super(); } /** diff --git a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/serializer/TcpCodecs.java b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/serializer/TcpCodecs.java index c17fa06a37..059ec00195 100644 --- a/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/serializer/TcpCodecs.java +++ b/spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/serializer/TcpCodecs.java @@ -24,11 +24,12 @@ package org.springframework.integration.ip.tcp.serializer; *

      * TcpNetServerConnectionFactory server = new TcpNetServerConnectionFactory(1234);
      * server.setSerializer(TcpCodecs.lf());
    - * server.setDserializer(TcpCodecs.lf());
    + * server.setDeserializer(TcpCodecs.lf());
      * ...
      * 
    * * @author Gary Russell + * * @since 5.0 * */ @@ -41,7 +42,6 @@ public final class TcpCodecs { private static ByteArrayLengthHeaderSerializer fourByteLHS; private TcpCodecs() { - super(); } /** diff --git a/spring-integration-ip/src/main/java/org/springframework/integration/ip/util/RegexUtils.java b/spring-integration-ip/src/main/java/org/springframework/integration/ip/util/RegexUtils.java index e6dad40f4c..a982b48fb0 100644 --- a/spring-integration-ip/src/main/java/org/springframework/integration/ip/util/RegexUtils.java +++ b/spring-integration-ip/src/main/java/org/springframework/integration/ip/util/RegexUtils.java @@ -20,9 +20,11 @@ package org.springframework.integration.ip.util; * Regular Expression Utilities. * * @author Gary Russell + * @author Artem Bilan + * * @since 2.0 */ -public abstract class RegexUtils { +public final class RegexUtils { /** * Escapes (precedes with \) any characters in the parameter in the set @@ -38,11 +40,10 @@ public abstract class RegexUtils { // In the following, we look for all the specials and any we find // are escaped in the output string, allowing that string to // be used as a pattern containing the literal specials. - String out = stringToEscape.replaceAll( - "(\\.|\\$|\\[|\\]|\\^|\\*|\\+|\\{|\\}|\\(|\\)|\\\\|\\?|\\|)", - "\\\\$1"); - return out; + return stringToEscape.replaceAll("([.$\\[\\]^*+{}()\\\\?|])", "\\\\$1"); + } + + private RegexUtils() { } - private RegexUtils() { } } diff --git a/spring-integration-ip/src/main/java/org/springframework/integration/ip/util/TestingUtilities.java b/spring-integration-ip/src/main/java/org/springframework/integration/ip/util/TestingUtilities.java index c34946068f..7ca72039c6 100644 --- a/spring-integration-ip/src/main/java/org/springframework/integration/ip/util/TestingUtilities.java +++ b/spring-integration-ip/src/main/java/org/springframework/integration/ip/util/TestingUtilities.java @@ -27,13 +27,13 @@ import org.springframework.lang.Nullable; * use in user test code, samples etc. * * @author Gary Russell + * * @since 2.2 * */ public final class TestingUtilities { private TestingUtilities() { - super(); } /** diff --git a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/storedproc/ProcedureParameter.java b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/storedproc/ProcedureParameter.java index 9d7099fc7c..a0741e2004 100644 --- a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/storedproc/ProcedureParameter.java +++ b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/storedproc/ProcedureParameter.java @@ -27,46 +27,27 @@ import org.springframework.util.Assert; * and SpEl Expression based parameters. * * @author Gunnar Hillert + * @author Artem Bilan + * * @since 2.1 * */ public class ProcedureParameter { private String name; - private Object value; - private String expression; - public String getName() { - return this.name; - } - public void setName(String name) { - this.name = name; - } - public Object getValue() { - return this.value; - } - public void setValue(Object value) { - this.value = value; - } - public String getExpression() { - return this.expression; - } - public void setExpression(String expression) { - this.expression = expression; - } + private Object value; + + private String expression; /** * Instantiates a new Procedure Parameter. - * * @param name Name of the procedure parameter, must not be null or empty * @param value If null, the expression property must be set * @param expression If null, the value property must be set */ public ProcedureParameter(String name, Object value, String expression) { - super(); - Assert.hasText(name, "'name' must not be empty."); - this.name = name; this.value = value; this.expression = expression; @@ -76,35 +57,53 @@ public class ProcedureParameter { * Default constructor. */ public ProcedureParameter() { - super(); + } + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + } + + public Object getValue() { + return this.value; + } + + public void setValue(Object value) { + this.value = value; + } + + public String getExpression() { + return this.expression; + } + + public void setExpression(String expression) { + this.expression = expression; } @Override public String toString() { - StringBuilder builder = new StringBuilder(); - builder.append("ProcedureParameter [name=").append(this.name) - .append(", value=").append(this.value) - .append(", expression=").append(this.expression) - .append("]"); - return builder.toString(); + return "ProcedureParameter [name=" + this.name + + ", value=" + this.value + + ", expression=" + this.expression + + "]"; } /** * Utility method that converts a Collection of {@link ProcedureParameter} to * a Map containing only expression parameters. - * * @param procedureParameters Must not be null. * @return Map containing only the Expression bound parameters. Will never be null. */ public static Map convertExpressions(Collection procedureParameters) { - Assert.notNull(procedureParameters, "The Collection of procedureParameters must not be null."); - for (ProcedureParameter parameter : procedureParameters) { Assert.notNull(parameter, "'procedureParameters' must not contain null values."); } - Map staticParameters = new HashMap(); + Map staticParameters = new HashMap<>(); for (ProcedureParameter parameter : procedureParameters) { if (parameter.getExpression() != null) { @@ -118,19 +117,17 @@ public class ProcedureParameter { /** * Utility method that converts a Collection of {@link ProcedureParameter} to * a Map containing only static parameters. - * * @param procedureParameters Must not be null. * @return Map containing only the static parameters. Will never be null. */ public static Map convertStaticParameters(Collection procedureParameters) { - Assert.notNull(procedureParameters, "The Collection of procedureParameters must not be null."); for (ProcedureParameter parameter : procedureParameters) { Assert.notNull(parameter, "'procedureParameters' must not contain null values."); } - Map staticParameters = new HashMap(); + Map staticParameters = new HashMap<>(); for (ProcedureParameter parameter : procedureParameters) { if (parameter.getValue() != null) { diff --git a/spring-integration-jms/src/main/java/org/springframework/integration/jms/ChannelPublishingJmsMessageListener.java b/spring-integration-jms/src/main/java/org/springframework/integration/jms/ChannelPublishingJmsMessageListener.java index 1a687c7fe6..4c35858a74 100644 --- a/spring-integration-jms/src/main/java/org/springframework/integration/jms/ChannelPublishingJmsMessageListener.java +++ b/spring-integration-jms/src/main/java/org/springframework/integration/jms/ChannelPublishingJmsMessageListener.java @@ -502,7 +502,6 @@ public class ChannelPublishingJmsMessageListener private class GatewayDelegate extends MessagingGatewaySupport { GatewayDelegate() { - super(); } @Override diff --git a/spring-integration-jms/src/main/java/org/springframework/integration/jms/JmsOutboundGateway.java b/spring-integration-jms/src/main/java/org/springframework/integration/jms/JmsOutboundGateway.java index 57e5022d12..f991ef70f7 100644 --- a/spring-integration-jms/src/main/java/org/springframework/integration/jms/JmsOutboundGateway.java +++ b/spring-integration-jms/src/main/java/org/springframework/integration/jms/JmsOutboundGateway.java @@ -1341,7 +1341,6 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler imp private volatile Destination replyDestination; GatewayReplyListenerContainer() { - super(); } @Override @@ -1452,14 +1451,11 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler imp private class LateReplyReaper implements Runnable { LateReplyReaper() { - super(); } @Override public void run() { - if (logger.isTraceEnabled()) { - logger.trace("Running late reply reaper"); - } + logger.trace("Running late reply reaper"); Iterator> lateReplyIterator = JmsOutboundGateway.this.earlyOrLateReplies.entrySet().iterator(); long now = System.currentTimeMillis(); @@ -1485,7 +1481,6 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler imp private class IdleContainerStopper implements Runnable { IdleContainerStopper() { - super(); } @Override @@ -1494,6 +1489,7 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler imp if (System.currentTimeMillis() - JmsOutboundGateway.this.lastSend > JmsOutboundGateway.this.idleReplyContainerTimeout && JmsOutboundGateway.this.replies.size() == 0) { + if (JmsOutboundGateway.this.replyContainer.isRunning()) { if (logger.isDebugEnabled()) { logger.debug(getComponentName() + ": Stopping idle reply container."); diff --git a/spring-integration-jmx/src/main/java/org/springframework/integration/monitor/IntegrationMBeanExporter.java b/spring-integration-jmx/src/main/java/org/springframework/integration/monitor/IntegrationMBeanExporter.java index 4e8e47aa34..3e330b0d02 100644 --- a/spring-integration-jmx/src/main/java/org/springframework/integration/monitor/IntegrationMBeanExporter.java +++ b/spring-integration-jmx/src/main/java/org/springframework/integration/monitor/IntegrationMBeanExporter.java @@ -165,7 +165,6 @@ public class IntegrationMBeanExporter extends MBeanExporter private volatile boolean singletonsInstantiated; public IntegrationMBeanExporter() { - super(); // Shouldn't be necessary, but to be on the safe side... setAutodetect(false); setNamingStrategy(this.defaultNamingStrategy); @@ -181,7 +180,7 @@ public class IntegrationMBeanExporter extends MBeanExporter } /** - * The JMX domain to use for MBeans registered. Defaults to spring.application (which is useful in + * The JMX domain to use for MBeans registered. Defaults to {@code spring.application} (which is useful in * SpringSource HQ). * @param domain the domain name to set */ @@ -209,6 +208,7 @@ public class IntegrationMBeanExporter extends MBeanExporter @Override public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + Assert.notNull(applicationContext, "ApplicationContext may not be null"); this.applicationContext = applicationContext; } diff --git a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/dsl/Jpa.java b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/dsl/Jpa.java index 77f369824b..aaa2be629e 100644 --- a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/dsl/Jpa.java +++ b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/dsl/Jpa.java @@ -170,7 +170,6 @@ public final class Jpa { } private Jpa() { - super(); } } diff --git a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/support/JpaParameter.java b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/support/JpaParameter.java index fa4ce0c4a9..c72d3cfb8c 100644 --- a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/support/JpaParameter.java +++ b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/support/JpaParameter.java @@ -29,6 +29,7 @@ import org.springframework.util.Assert; * @author Gunnar Hillert * @author Artem Bilan * @author Gary Russell + * * @since 2.2 * */ @@ -50,21 +51,16 @@ public class JpaParameter { * Default constructor. */ public JpaParameter() { - super(); } /** * Instantiates a new Jpa Parameter. - * * @param name Name of the JPA parameter, must not be null or empty * @param value If null, the expression property must be set * @param expression If null, the value property must be set */ public JpaParameter(String name, @Nullable Object value, @Nullable String expression) { - super(); - Assert.hasText(name, "'name' must not be empty."); - this.name = name; this.value = value; setExpression(expression); @@ -73,7 +69,6 @@ public class JpaParameter { /** * Instantiates a new Jpa Parameter without a name. This is useful for specifying * positional Jpa parameters. - * * @param value If null, the expression property must be set * @param expression If null, the value property must be set */ @@ -124,12 +119,10 @@ public class JpaParameter { @Override public String toString() { - StringBuilder builder = new StringBuilder(); - builder.append("JpaParameter [name=").append(this.name) - .append(", value=").append(this.value) - .append(", expression=").append(this.expression) - .append("]"); - return builder.toString(); + return "JpaParameter [name=" + this.name + + ", value=" + this.value + + ", expression=" + this.expression + + "]"; } } diff --git a/spring-integration-mail/src/main/java/org/springframework/integration/mail/ImapIdleChannelAdapter.java b/spring-integration-mail/src/main/java/org/springframework/integration/mail/ImapIdleChannelAdapter.java index cc9867e5ea..e451dfb067 100755 --- a/spring-integration-mail/src/main/java/org/springframework/integration/mail/ImapIdleChannelAdapter.java +++ b/spring-integration-mail/src/main/java/org/springframework/integration/mail/ImapIdleChannelAdapter.java @@ -239,7 +239,6 @@ public class ImapIdleChannelAdapter extends MessageProducerSupport implements Be private class ReceivingTask implements Runnable { ReceivingTask() { - super(); } @Override @@ -266,7 +265,6 @@ public class ImapIdleChannelAdapter extends MessageProducerSupport implements Be private class IdleTask implements Runnable { IdleTask() { - super(); } @Override @@ -310,7 +308,6 @@ public class ImapIdleChannelAdapter extends MessageProducerSupport implements Be ExceptionAwarePeriodicTrigger() { - super(); } @Override diff --git a/spring-integration-mail/src/main/java/org/springframework/integration/mail/ImapMailReceiver.java b/spring-integration-mail/src/main/java/org/springframework/integration/mail/ImapMailReceiver.java index 7820f85fbf..73ebfec130 100755 --- a/spring-integration-mail/src/main/java/org/springframework/integration/mail/ImapMailReceiver.java +++ b/spring-integration-mail/src/main/java/org/springframework/integration/mail/ImapMailReceiver.java @@ -78,7 +78,6 @@ public class ImapMailReceiver extends AbstractMailReceiver { private volatile ScheduledFuture pingTask; public ImapMailReceiver() { - super(); setProtocol(PROTOCOL); } @@ -259,7 +258,6 @@ public class ImapMailReceiver extends AbstractMailReceiver { private class IdleCanceler implements Runnable { IdleCanceler() { - super(); } @Override @@ -284,7 +282,6 @@ public class ImapMailReceiver extends AbstractMailReceiver { private static class SimpleMessageCountListener extends MessageCountAdapter { SimpleMessageCountListener() { - super(); } @Override @@ -301,7 +298,6 @@ public class ImapMailReceiver extends AbstractMailReceiver { private class DefaultSearchTermStrategy implements SearchTermStrategy { DefaultSearchTermStrategy() { - super(); } @Override diff --git a/spring-integration-mail/src/main/java/org/springframework/integration/mail/Pop3MailReceiver.java b/spring-integration-mail/src/main/java/org/springframework/integration/mail/Pop3MailReceiver.java index c3e636e0a3..cdfb579003 100755 --- a/spring-integration-mail/src/main/java/org/springframework/integration/mail/Pop3MailReceiver.java +++ b/spring-integration-mail/src/main/java/org/springframework/integration/mail/Pop3MailReceiver.java @@ -36,7 +36,6 @@ public class Pop3MailReceiver extends AbstractMailReceiver { public static final String PROTOCOL = "pop3"; public Pop3MailReceiver() { - super(); setProtocol(PROTOCOL); } diff --git a/spring-integration-mail/src/main/java/org/springframework/integration/mail/dsl/Mail.java b/spring-integration-mail/src/main/java/org/springframework/integration/mail/dsl/Mail.java index 821e0d5948..5870bbb7f2 100644 --- a/spring-integration-mail/src/main/java/org/springframework/integration/mail/dsl/Mail.java +++ b/spring-integration-mail/src/main/java/org/springframework/integration/mail/dsl/Mail.java @@ -201,7 +201,6 @@ public final class Mail { private Mail() { - super(); } } diff --git a/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/config/MongoParserUtils.java b/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/config/MongoParserUtils.java index d1052dfab4..26353913c5 100644 --- a/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/config/MongoParserUtils.java +++ b/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/config/MongoParserUtils.java @@ -23,28 +23,31 @@ import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.xml.ParserContext; import org.springframework.integration.config.xml.IntegrationNamespaceUtils; import org.springframework.util.StringUtils; + /** * Utility class used by mongo parsers * * @author Oleg Zhurakousky * @author Gary Russell + * @author Artem Bilan + * * @since 2.2 */ final class MongoParserUtils { private MongoParserUtils() { - super(); } /** * Will parse and validate * 'mongodb-template', 'mongodb-factory', 'collection-name', 'collection-name-expression' and 'mongo-converter' - * - * @param element - * @param parserContext - * @param builder + * @param element the element to parse + * @param parserContext the context for parsing + * @param builder the bean definition builder */ - public static void processCommonAttributes(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { + public static void processCommonAttributes(Element element, ParserContext parserContext, + BeanDefinitionBuilder builder) { + String mongoDbTemplate = element.getAttribute("mongo-template"); String mongoDbFactory = element.getAttribute("mongodb-factory"); @@ -69,13 +72,13 @@ final class MongoParserUtils { } BeanDefinition collectionNameExpressionDef = - IntegrationNamespaceUtils.createExpressionDefinitionFromValueOrExpression("collection-name", "collection-name-expression", - parserContext, element, false); + IntegrationNamespaceUtils.createExpressionDefinitionFromValueOrExpression("collection-name", + "collection-name-expression", parserContext, element, false); if (collectionNameExpressionDef != null) { builder.addPropertyValue("collectionNameExpression", collectionNameExpressionDef); } - } + } diff --git a/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/dsl/MongoDb.java b/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/dsl/MongoDb.java index 400de9eb0e..c94def96d0 100644 --- a/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/dsl/MongoDb.java +++ b/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/dsl/MongoDb.java @@ -23,7 +23,8 @@ import org.springframework.data.mongodb.core.convert.MongoConverter; /** * Factory class for building MongoDb components * - * @author Xavier Padr? + * @author Xavier Padro + * * @since 5.0 */ public final class MongoDb { @@ -52,7 +53,6 @@ public final class MongoDb { } private MongoDb() { - super(); } } diff --git a/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/metadata/MongoDbMetadataStore.java b/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/metadata/MongoDbMetadataStore.java index 38faa485d0..3f43ed9f28 100644 --- a/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/metadata/MongoDbMetadataStore.java +++ b/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/metadata/MongoDbMetadataStore.java @@ -27,7 +27,6 @@ import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Query; import org.springframework.data.mongodb.core.query.Update; -import org.springframework.data.mongodb.core.query.UpdateDefinition; import org.springframework.integration.metadata.ConcurrentMetadataStore; import org.springframework.util.Assert; @@ -40,6 +39,7 @@ import org.springframework.util.Assert; * @author Senthil Arumugam, Samiraj Panneer Selvam * @author Artem Bilan * @author Gary Russell + * * @since 4.2 * */ @@ -188,7 +188,7 @@ public class MongoDbMetadataStore implements ConcurrentMetadataStore { * @param oldValue the metadata entry old value to replace * @param newValue the metadata entry new value to put * @return {@code true} if replace was successful, {@code false} otherwise. - * @see MongoTemplate#updateFirst(Query, UpdateDefinition, String) + * @see MongoTemplate#updateFirst(Query, org.springframework.data.mongodb.core.query.UpdateDefinition, String) */ @Override public boolean replace(String key, String oldValue, String newValue) { diff --git a/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/outbound/ReactiveMongoDbStoringMessageHandler.java b/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/outbound/ReactiveMongoDbStoringMessageHandler.java index b75ae6dec3..389a17fd8d 100644 --- a/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/outbound/ReactiveMongoDbStoringMessageHandler.java +++ b/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/outbound/ReactiveMongoDbStoringMessageHandler.java @@ -16,9 +16,7 @@ package org.springframework.integration.mongodb.outbound; -import org.springframework.data.mongodb.MongoDatabaseFactory; import org.springframework.data.mongodb.ReactiveMongoDatabaseFactory; -import org.springframework.data.mongodb.core.MongoOperations; import org.springframework.data.mongodb.core.ReactiveMongoOperations; import org.springframework.data.mongodb.core.ReactiveMongoTemplate; import org.springframework.data.mongodb.core.convert.MongoConverter; @@ -77,7 +75,7 @@ public class ReactiveMongoDbStoringMessageHandler extends AbstractReactiveMessag /** * Provide a custom {@link MongoConverter} used to assist in serialization of * data written to MongoDb. Only allowed if this instance was constructed with a - * {@link MongoDatabaseFactory}. + * {@link ReactiveMongoDatabaseFactory}. * @param mongoConverter The mongo converter. */ public void setMongoConverter(MongoConverter mongoConverter) { @@ -88,7 +86,7 @@ public class ReactiveMongoDbStoringMessageHandler extends AbstractReactiveMessag /** * Set a SpEL {@link Expression} that should resolve to a collection name used by - * {@link MongoOperations} to store data + * {@link ReactiveMongoOperations} to store data * @param collectionNameExpression The collection name expression. */ public void setCollectionNameExpression(Expression collectionNameExpression) { @@ -103,6 +101,7 @@ public class ReactiveMongoDbStoringMessageHandler extends AbstractReactiveMessag @Override protected void onInit() { + super.onInit(); this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(getBeanFactory()); if (this.mongoTemplate == null) { this.mongoTemplate = new ReactiveMongoTemplate(this.mongoDbFactory, this.mongoConverter); diff --git a/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/store/MongoDbMessageStore.java b/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/store/MongoDbMessageStore.java index 20dff75a67..917a74708f 100644 --- a/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/store/MongoDbMessageStore.java +++ b/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/store/MongoDbMessageStore.java @@ -673,7 +673,6 @@ public class MongoDbMessageStore extends AbstractMessageGroupStore private static class MessageHistoryToDocumentConverter implements Converter { MessageHistoryToDocumentConverter() { - super(); } @Override @@ -697,7 +696,6 @@ public class MongoDbMessageStore extends AbstractMessageGroupStore private class DocumentToGenericMessageConverter implements Converter> { DocumentToGenericMessageConverter() { - super(); } @Override @@ -718,7 +716,6 @@ public class MongoDbMessageStore extends AbstractMessageGroupStore private final class DocumentToMutableMessageConverter implements Converter> { DocumentToMutableMessageConverter() { - super(); } @Override @@ -739,7 +736,6 @@ public class MongoDbMessageStore extends AbstractMessageGroupStore private class DocumentToAdviceMessageConverter implements Converter> { DocumentToAdviceMessageConverter() { - super(); } @Override @@ -779,7 +775,6 @@ public class MongoDbMessageStore extends AbstractMessageGroupStore private final WhiteListDeserializingConverter deserializingConverter = new WhiteListDeserializingConverter(); DocumentToErrorMessageConverter() { - super(); } @Override @@ -803,7 +798,6 @@ public class MongoDbMessageStore extends AbstractMessageGroupStore private final Converter serializingConverter = new SerializingConverter(); ThrowableToBytesConverter() { - super(); } @Override diff --git a/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/support/MongoHeaders.java b/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/support/MongoHeaders.java index 300f6b9f3d..ae9c6bf707 100644 --- a/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/support/MongoHeaders.java +++ b/spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/support/MongoHeaders.java @@ -21,12 +21,12 @@ package org.springframework.integration.mongodb.support; * for dealing with headers required by Mongo components * * @author Gary Russell + * * @since 2.2 */ public final class MongoHeaders { private MongoHeaders() { - super(); } public static final String PREFIX = "mongo_"; diff --git a/spring-integration-redis/src/main/java/org/springframework/integration/redis/channel/SubscribableRedisChannel.java b/spring-integration-redis/src/main/java/org/springframework/integration/redis/channel/SubscribableRedisChannel.java index f6a0994544..5a9bcde72c 100644 --- a/spring-integration-redis/src/main/java/org/springframework/integration/redis/channel/SubscribableRedisChannel.java +++ b/spring-integration-redis/src/main/java/org/springframework/integration/redis/channel/SubscribableRedisChannel.java @@ -208,7 +208,6 @@ public class SubscribableRedisChannel extends AbstractMessageChannel private class MessageListenerDelegate { MessageListenerDelegate() { - super(); } @SuppressWarnings({ "unused" }) diff --git a/spring-integration-redis/src/main/java/org/springframework/integration/redis/inbound/RedisInboundChannelAdapter.java b/spring-integration-redis/src/main/java/org/springframework/integration/redis/inbound/RedisInboundChannelAdapter.java index c6438a44bf..0b4de82a09 100644 --- a/spring-integration-redis/src/main/java/org/springframework/integration/redis/inbound/RedisInboundChannelAdapter.java +++ b/spring-integration-redis/src/main/java/org/springframework/integration/redis/inbound/RedisInboundChannelAdapter.java @@ -164,7 +164,6 @@ public class RedisInboundChannelAdapter extends MessageProducerSupport { private class MessageListenerDelegate { MessageListenerDelegate() { - super(); } @SuppressWarnings("unused") diff --git a/spring-integration-redis/src/main/java/org/springframework/integration/redis/inbound/RedisQueueInboundGateway.java b/spring-integration-redis/src/main/java/org/springframework/integration/redis/inbound/RedisQueueInboundGateway.java index 4f57c43248..450354e3ec 100644 --- a/spring-integration-redis/src/main/java/org/springframework/integration/redis/inbound/RedisQueueInboundGateway.java +++ b/spring-integration-redis/src/main/java/org/springframework/integration/redis/inbound/RedisQueueInboundGateway.java @@ -359,7 +359,6 @@ public class RedisQueueInboundGateway extends MessagingGatewaySupport private class ListenerTask implements SchedulingAwareRunnable { ListenerTask() { - super(); } @Override diff --git a/spring-integration-redis/src/main/java/org/springframework/integration/redis/inbound/RedisQueueMessageDrivenEndpoint.java b/spring-integration-redis/src/main/java/org/springframework/integration/redis/inbound/RedisQueueMessageDrivenEndpoint.java index cb935584a5..b4adc2e3a4 100644 --- a/spring-integration-redis/src/main/java/org/springframework/integration/redis/inbound/RedisQueueMessageDrivenEndpoint.java +++ b/spring-integration-redis/src/main/java/org/springframework/integration/redis/inbound/RedisQueueMessageDrivenEndpoint.java @@ -336,7 +336,6 @@ public class RedisQueueMessageDrivenEndpoint extends MessageProducerSupport private class ListenerTask implements SchedulingAwareRunnable { ListenerTask() { - super(); } @Override diff --git a/spring-integration-redis/src/main/java/org/springframework/integration/redis/outbound/RedisOutboundGateway.java b/spring-integration-redis/src/main/java/org/springframework/integration/redis/outbound/RedisOutboundGateway.java index 7ad1403d49..2cc37ee5f9 100644 --- a/spring-integration-redis/src/main/java/org/springframework/integration/redis/outbound/RedisOutboundGateway.java +++ b/spring-integration-redis/src/main/java/org/springframework/integration/redis/outbound/RedisOutboundGateway.java @@ -143,7 +143,6 @@ public class RedisOutboundGateway extends AbstractReplyProducingMessageHandler { private static class PayloadArgumentsStrategy implements ArgumentsStrategy { PayloadArgumentsStrategy() { - super(); } @Override diff --git a/spring-integration-redis/src/main/java/org/springframework/integration/redis/support/RedisHeaders.java b/spring-integration-redis/src/main/java/org/springframework/integration/redis/support/RedisHeaders.java index 8e9556bfce..28d62788d5 100644 --- a/spring-integration-redis/src/main/java/org/springframework/integration/redis/support/RedisHeaders.java +++ b/spring-integration-redis/src/main/java/org/springframework/integration/redis/support/RedisHeaders.java @@ -29,7 +29,6 @@ package org.springframework.integration.redis.support; public final class RedisHeaders { private RedisHeaders() { - super(); } public static final String PREFIX = "redis_"; diff --git a/spring-integration-rsocket/src/main/java/org/springframework/integration/rsocket/dsl/RSockets.java b/spring-integration-rsocket/src/main/java/org/springframework/integration/rsocket/dsl/RSockets.java index 75ef513547..9216dba835 100644 --- a/spring-integration-rsocket/src/main/java/org/springframework/integration/rsocket/dsl/RSockets.java +++ b/spring-integration-rsocket/src/main/java/org/springframework/integration/rsocket/dsl/RSockets.java @@ -74,7 +74,6 @@ public final class RSockets { } private RSockets() { - super(); } } diff --git a/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/jsr223/ScriptExecutorFactory.java b/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/jsr223/ScriptExecutorFactory.java index 6050f01d65..479a84da6b 100644 --- a/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/jsr223/ScriptExecutorFactory.java +++ b/spring-integration-scripting/src/main/java/org/springframework/integration/scripting/jsr223/ScriptExecutorFactory.java @@ -65,7 +65,6 @@ public final class ScriptExecutorFactory { } private ScriptExecutorFactory() { - super(); } } diff --git a/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/dsl/Sftp.java b/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/dsl/Sftp.java index a6b191eae4..2c966eb8df 100644 --- a/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/dsl/Sftp.java +++ b/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/dsl/Sftp.java @@ -35,6 +35,7 @@ import com.jcraft.jsch.ChannelSftp.LsEntry; * * @author Artem Bilan * @author Gary Russell + * * @since 5.0 */ public final class Sftp { @@ -56,6 +57,7 @@ public final class Sftp { */ public static SftpInboundChannelAdapterSpec inboundAdapter(SessionFactory sessionFactory, Comparator receptionOrderComparator) { + return new SftpInboundChannelAdapterSpec(sessionFactory, receptionOrderComparator); } @@ -67,6 +69,7 @@ public final class Sftp { */ public static SftpStreamingInboundChannelAdapterSpec inboundStreamingAdapter( RemoteFileTemplate remoteFileTemplate) { + return inboundStreamingAdapter(remoteFileTemplate, null); } @@ -80,6 +83,7 @@ public final class Sftp { public static SftpStreamingInboundChannelAdapterSpec inboundStreamingAdapter( RemoteFileTemplate remoteFileTemplate, Comparator receptionOrderComparator) { + return new SftpStreamingInboundChannelAdapterSpec(remoteFileTemplate, receptionOrderComparator); } @@ -100,6 +104,7 @@ public final class Sftp { */ public static SftpMessageHandlerSpec outboundAdapter(SessionFactory sessionFactory, FileExistsMode fileExistsMode) { + return outboundAdapter(new SftpRemoteFileTemplate(sessionFactory), fileExistsMode); } @@ -120,6 +125,7 @@ public final class Sftp { */ public static SftpMessageHandlerSpec outboundAdapter(RemoteFileTemplate remoteFileTemplate, FileExistsMode fileExistsMode) { + return new SftpMessageHandlerSpec(remoteFileTemplate, fileExistsMode); } @@ -134,6 +140,7 @@ public final class Sftp { */ public static SftpOutboundGatewaySpec outboundGateway(SessionFactory sessionFactory, AbstractRemoteFileOutboundGateway.Command command, String expression) { + return outboundGateway(sessionFactory, command.getCommand(), expression); } @@ -149,6 +156,7 @@ public final class Sftp { */ public static SftpOutboundGatewaySpec outboundGateway(SessionFactory sessionFactory, String command, String expression) { + return new SftpOutboundGatewaySpec(new SftpOutboundGateway(sessionFactory, command, expression)); } @@ -163,6 +171,7 @@ public final class Sftp { */ public static SftpOutboundGatewaySpec outboundGateway(RemoteFileTemplate remoteFileTemplate, AbstractRemoteFileOutboundGateway.Command command, String expression) { + return outboundGateway(remoteFileTemplate, command.getCommand(), expression); } @@ -177,6 +186,7 @@ public final class Sftp { */ public static SftpOutboundGatewaySpec outboundGateway(RemoteFileTemplate remoteFileTemplate, String command, String expression) { + return new SftpOutboundGatewaySpec(new SftpOutboundGateway(remoteFileTemplate, command, expression)); } @@ -190,10 +200,11 @@ public final class Sftp { */ public static SftpOutboundGatewaySpec outboundGateway(SessionFactory sessionFactory, MessageSessionCallback messageSessionCallback) { + return new SftpOutboundGatewaySpec(new SftpOutboundGateway(sessionFactory, messageSessionCallback)); } private Sftp() { - super(); } + } diff --git a/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/session/DefaultSftpSessionFactory.java b/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/session/DefaultSftpSessionFactory.java index ec9c3718f0..4732aef9fb 100644 --- a/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/session/DefaultSftpSessionFactory.java +++ b/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/session/DefaultSftpSessionFactory.java @@ -59,7 +59,7 @@ import com.jcraft.jsch.UserInfo; */ public class DefaultSftpSessionFactory implements SessionFactory, SharedSessionCapable { - private static final Log logger = LogFactory.getLog(DefaultSftpSessionFactory.class); + private static final Log LOGGER = LogFactory.getLog(DefaultSftpSessionFactory.class); static { JSch.setLogger(new JschLogger()); @@ -472,7 +472,6 @@ public class DefaultSftpSessionFactory implements SessionFactory, Share private class UserInfoWrapper implements UserInfo, UIKeyboardInteractive { UserInfoWrapper() { - super(); } /** @@ -521,8 +520,8 @@ public class DefaultSftpSessionFactory implements SessionFactory, Share return getDelegate().promptPassword(message); } else { - if (logger.isDebugEnabled()) { - logger.debug("No UserInfo provided - " + message + ", returning: true"); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("No UserInfo provided - " + message + ", returning: true"); } return true; } @@ -534,8 +533,8 @@ public class DefaultSftpSessionFactory implements SessionFactory, Share return getDelegate().promptPassphrase(message); } else { - if (logger.isDebugEnabled()) { - logger.debug("No UserInfo provided - " + message + ", returning: true"); + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("No UserInfo provided - " + message + ", returning: true"); } return true; } @@ -543,13 +542,13 @@ public class DefaultSftpSessionFactory implements SessionFactory, Share @Override public boolean promptYesNo(String message) { - logger.info(message); + LOGGER.info(message); if (hasDelegate()) { return getDelegate().promptYesNo(message); } else { - if (logger.isDebugEnabled()) { - logger.debug("No UserInfo provided - " + message + ", returning:" + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("No UserInfo provided - " + message + ", returning:" + DefaultSftpSessionFactory.this.allowUnknownKeys); } return DefaultSftpSessionFactory.this.allowUnknownKeys; @@ -562,7 +561,7 @@ public class DefaultSftpSessionFactory implements SessionFactory, Share getDelegate().showMessage(message); } else { - logger.debug(message); + LOGGER.debug(message); } } @@ -575,8 +574,8 @@ public class DefaultSftpSessionFactory implements SessionFactory, Share instruction, prompt, echo); } else { - if (logger.isDebugEnabled()) { - logger.debug("No UIKeyboardInteractive provided - " + destination + ":" + name + ":" + instruction + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("No UIKeyboardInteractive provided - " + destination + ":" + name + ":" + instruction + ":" + Arrays.asList(prompt) + ":" + Arrays.toString(echo)); } return null; diff --git a/spring-integration-stomp/src/main/java/org/springframework/integration/stomp/AbstractStompSessionManager.java b/spring-integration-stomp/src/main/java/org/springframework/integration/stomp/AbstractStompSessionManager.java index 521827f08b..a732614024 100644 --- a/spring-integration-stomp/src/main/java/org/springframework/integration/stomp/AbstractStompSessionManager.java +++ b/spring-integration-stomp/src/main/java/org/springframework/integration/stomp/AbstractStompSessionManager.java @@ -91,22 +91,22 @@ public abstract class AbstractStompSessionManager implements StompSessionManager private ApplicationEventPublisher applicationEventPublisher; - private volatile StompHeaders connectHeaders; + private StompHeaders connectHeaders; - private volatile ListenableFuture stompSessionListenableFuture; + private boolean autoReceipt; - private volatile boolean autoReceipt; + private long recoveryInterval = DEFAULT_RECOVERY_INTERVAL; + + private String name; private volatile boolean connecting; private volatile boolean connected; - private volatile long recoveryInterval = DEFAULT_RECOVERY_INTERVAL; + private volatile ListenableFuture stompSessionListenableFuture; private volatile ScheduledFuture reconnectFuture; - private String name; - public AbstractStompSessionManager(StompClientSupport stompClient) { Assert.notNull(stompClient, "'stompClient' is required."); this.stompClient = stompClient; @@ -359,7 +359,6 @@ public abstract class AbstractStompSessionManager implements StompSessionManager private volatile StompSession session; CompositeStompSessionHandler() { - super(); } void addHandler(StompSessionHandler delegate) { diff --git a/spring-integration-stomp/src/main/java/org/springframework/integration/stomp/outbound/StompMessageHandler.java b/spring-integration-stomp/src/main/java/org/springframework/integration/stomp/outbound/StompMessageHandler.java index e1e2676c6c..f2c4538f89 100644 --- a/spring-integration-stomp/src/main/java/org/springframework/integration/stomp/outbound/StompMessageHandler.java +++ b/spring-integration-stomp/src/main/java/org/springframework/integration/stomp/outbound/StompMessageHandler.java @@ -87,7 +87,7 @@ public class StompMessageHandler extends AbstractMessageHandler implements Appli public void setDestination(String destination) { Assert.hasText(destination, "'destination' must not be empty."); - this.destinationExpression = new ValueExpression(destination); + this.destinationExpression = new ValueExpression<>(destination); } public void setDestinationExpression(Expression destinationExpression) { @@ -142,9 +142,9 @@ public class StompMessageHandler extends AbstractMessageHandler implements Appli StompHeaders stompHeaders = new StompHeaders(); this.headerMapper.fromHeaders(message.getHeaders(), stompHeaders); if (stompHeaders.getDestination() == null) { - Assert.state(this.destinationExpression != null, "One of 'destination' or 'destinationExpression' must " + - "be" + - " provided, if message header doesn't supply 'destination' STOMP header."); + Assert.state(this.destinationExpression != null, + "One of 'destination' or 'destinationExpression' must be provided, " + + "if message header doesn't supply 'destination' STOMP header."); String destination = this.destinationExpression.getValue(this.evaluationContext, message, String.class); stompHeaders.setDestination(destination); } @@ -219,7 +219,6 @@ public class StompMessageHandler extends AbstractMessageHandler implements Appli private class IntegrationOutboundStompSessionHandler extends StompSessionHandlerAdapter { IntegrationOutboundStompSessionHandler() { - super(); } @Override diff --git a/spring-integration-syslog/src/main/java/org/springframework/integration/syslog/SyslogHeaders.java b/spring-integration-syslog/src/main/java/org/springframework/integration/syslog/SyslogHeaders.java index 32a7248503..db3eab997b 100644 --- a/spring-integration-syslog/src/main/java/org/springframework/integration/syslog/SyslogHeaders.java +++ b/spring-integration-syslog/src/main/java/org/springframework/integration/syslog/SyslogHeaders.java @@ -21,14 +21,15 @@ import org.springframework.integration.transformer.SyslogToMapTransformer; /** * Headers in a {@code Map} generated by the @link {@link SyslogToMapTransformer} that * will be added to Spring Integration messages as headers, prefixed by {@link #PREFIX}. + * * @author Gary Russell + * * @since 3.0 * */ public final class SyslogHeaders { private SyslogHeaders() { - super(); } public static final String PREFIX = "syslog_"; diff --git a/spring-integration-test-support/src/main/java/org/springframework/integration/test/matcher/HeaderMatcher.java b/spring-integration-test-support/src/main/java/org/springframework/integration/test/matcher/HeaderMatcher.java index 12c8fc7039..133a4f47b5 100644 --- a/spring-integration-test-support/src/main/java/org/springframework/integration/test/matcher/HeaderMatcher.java +++ b/spring-integration-test-support/src/main/java/org/springframework/integration/test/matcher/HeaderMatcher.java @@ -78,7 +78,6 @@ public final class HeaderMatcher extends TypeSafeMatcher> { * @param matcher the target matcher to delegate */ private HeaderMatcher(Matcher matcher) { - super(); this.matcher = matcher; } diff --git a/spring-integration-test-support/src/main/java/org/springframework/integration/test/matcher/MockitoMessageMatchers.java b/spring-integration-test-support/src/main/java/org/springframework/integration/test/matcher/MockitoMessageMatchers.java index bdae50ae28..338be446fb 100644 --- a/spring-integration-test-support/src/main/java/org/springframework/integration/test/matcher/MockitoMessageMatchers.java +++ b/spring-integration-test-support/src/main/java/org/springframework/integration/test/matcher/MockitoMessageMatchers.java @@ -67,7 +67,6 @@ import org.springframework.messaging.Message; public final class MockitoMessageMatchers { private MockitoMessageMatchers() { - super(); } public static Message messageWithPayload(Matcher payloadMatcher) { diff --git a/spring-integration-test-support/src/main/java/org/springframework/integration/test/matcher/PayloadMatcher.java b/spring-integration-test-support/src/main/java/org/springframework/integration/test/matcher/PayloadMatcher.java index a9ff6f0054..953fda54a5 100644 --- a/spring-integration-test-support/src/main/java/org/springframework/integration/test/matcher/PayloadMatcher.java +++ b/spring-integration-test-support/src/main/java/org/springframework/integration/test/matcher/PayloadMatcher.java @@ -68,7 +68,6 @@ public final class PayloadMatcher extends TypeSafeMatcher> { * Create a PayloadMatcher that matches the payload of messages against the given matcher */ private PayloadMatcher(Matcher matcher) { - super(); this.matcher = matcher; } diff --git a/spring-integration-test-support/src/main/java/org/springframework/integration/test/util/OnlyOnceTrigger.java b/spring-integration-test-support/src/main/java/org/springframework/integration/test/util/OnlyOnceTrigger.java index 65db11d1fe..e60b65407d 100644 --- a/spring-integration-test-support/src/main/java/org/springframework/integration/test/util/OnlyOnceTrigger.java +++ b/spring-integration-test-support/src/main/java/org/springframework/integration/test/util/OnlyOnceTrigger.java @@ -43,8 +43,7 @@ public class OnlyOnceTrigger implements Trigger { public OnlyOnceTrigger() { - super(); - executionTime = new Date(); + this.executionTime = new Date(); } @Override @@ -61,8 +60,7 @@ public class OnlyOnceTrigger implements Trigger { public int hashCode() { final int prime = 31; int result = 1; - result = prime * result - + ((executionTime == null) ? 0 : executionTime.hashCode()); + result = prime * result + this.executionTime.hashCode(); return result; } @@ -78,15 +76,7 @@ public class OnlyOnceTrigger implements Trigger { return false; } OnlyOnceTrigger other = (OnlyOnceTrigger) obj; - if (executionTime == null) { - if (other.executionTime != null) { - return false; - } - } - else if (!executionTime.equals(other.executionTime)) { - return false; - } - return true; + return this.executionTime.equals(other.executionTime); } public void reset() { diff --git a/spring-integration-test-support/src/main/java/org/springframework/integration/test/util/TestUtils.java b/spring-integration-test-support/src/main/java/org/springframework/integration/test/util/TestUtils.java index 35a86c7a8b..851a1ba611 100644 --- a/spring-integration-test-support/src/main/java/org/springframework/integration/test/util/TestUtils.java +++ b/spring-integration-test-support/src/main/java/org/springframework/integration/test/util/TestUtils.java @@ -162,7 +162,6 @@ public abstract class TestUtils { public static class TestApplicationContext extends GenericApplicationContext { TestApplicationContext() { - super(); } public void registerChannel(@Nullable String channelNameArg, final MessageChannel channel) { diff --git a/spring-integration-webflux/src/main/java/org/springframework/integration/webflux/dsl/WebFlux.java b/spring-integration-webflux/src/main/java/org/springframework/integration/webflux/dsl/WebFlux.java index 7d57450124..707d77c5d1 100644 --- a/spring-integration-webflux/src/main/java/org/springframework/integration/webflux/dsl/WebFlux.java +++ b/spring-integration-webflux/src/main/java/org/springframework/integration/webflux/dsl/WebFlux.java @@ -110,6 +110,7 @@ public final class WebFlux { */ public static

    WebFluxMessageHandlerSpec outboundChannelAdapter(Function, ?> uriFunction, WebClient webClient) { + return outboundChannelAdapter(new FunctionExpression<>(uriFunction), webClient); } @@ -123,6 +124,7 @@ public final class WebFlux { */ public static WebFluxMessageHandlerSpec outboundChannelAdapter(Expression uriExpression, WebClient webClient) { + return new WebFluxMessageHandlerSpec(uriExpression, webClient) .expectReply(false); } @@ -201,6 +203,7 @@ public final class WebFlux { */ public static

    WebFluxMessageHandlerSpec outboundGateway(Function, ?> uriFunction, WebClient webClient) { + return outboundGateway(new FunctionExpression<>(uriFunction), webClient); } @@ -214,6 +217,7 @@ public final class WebFlux { */ public static WebFluxMessageHandlerSpec outboundGateway(Expression uriExpression, WebClient webClient) { + return new WebFluxMessageHandlerSpec(uriExpression, webClient); } @@ -239,7 +243,6 @@ public final class WebFlux { } private WebFlux() { - super(); } } diff --git a/spring-integration-webflux/src/main/java/org/springframework/integration/webflux/support/WebFluxContextUtils.java b/spring-integration-webflux/src/main/java/org/springframework/integration/webflux/support/WebFluxContextUtils.java index 7b5e42f163..90b5bfb6b6 100644 --- a/spring-integration-webflux/src/main/java/org/springframework/integration/webflux/support/WebFluxContextUtils.java +++ b/spring-integration-webflux/src/main/java/org/springframework/integration/webflux/support/WebFluxContextUtils.java @@ -28,7 +28,6 @@ package org.springframework.integration.webflux.support; public final class WebFluxContextUtils { private WebFluxContextUtils() { - super(); } /** diff --git a/spring-integration-websocket/src/main/java/org/springframework/integration/websocket/IntegrationWebSocketContainer.java b/spring-integration-websocket/src/main/java/org/springframework/integration/websocket/IntegrationWebSocketContainer.java index 1132265337..3983e707b9 100644 --- a/spring-integration-websocket/src/main/java/org/springframework/integration/websocket/IntegrationWebSocketContainer.java +++ b/spring-integration-websocket/src/main/java/org/springframework/integration/websocket/IntegrationWebSocketContainer.java @@ -73,11 +73,11 @@ public abstract class IntegrationWebSocketContainer implements DisposableBean { private final List supportedProtocols = new ArrayList<>(); - private volatile WebSocketListener messageListener; + private WebSocketListener messageListener; - private volatile int sendTimeLimit = DEFAULT_SEND_TIME_LIMIT; + private int sendTimeLimit = DEFAULT_SEND_TIME_LIMIT; - private volatile int sendBufferSizeLimit = DEFAULT_SEND_BUFFER_SIZE; + private int sendBufferSizeLimit = DEFAULT_SEND_BUFFER_SIZE; public void setSendTimeLimit(int sendTimeLimit) { this.sendTimeLimit = sendTimeLimit; @@ -159,7 +159,6 @@ public abstract class IntegrationWebSocketContainer implements DisposableBean { private class IntegrationWebSocketHandler implements WebSocketHandler, SubProtocolCapable { IntegrationWebSocketHandler() { - super(); } @Override diff --git a/spring-integration-websocket/src/main/java/org/springframework/integration/websocket/config/WebSocketIntegrationConfigurationInitializer.java b/spring-integration-websocket/src/main/java/org/springframework/integration/websocket/config/WebSocketIntegrationConfigurationInitializer.java index e800882da8..b3172bfba9 100644 --- a/spring-integration-websocket/src/main/java/org/springframework/integration/websocket/config/WebSocketIntegrationConfigurationInitializer.java +++ b/spring-integration-websocket/src/main/java/org/springframework/integration/websocket/config/WebSocketIntegrationConfigurationInitializer.java @@ -156,7 +156,6 @@ public class WebSocketIntegrationConfigurationInitializer implements Integration private static class IntegrationServletWebSocketHandlerRegistry extends ServletWebSocketHandlerRegistry { IntegrationServletWebSocketHandlerRegistry() { - super(); } @Override diff --git a/spring-integration-ws/src/main/java/org/springframework/integration/ws/SimpleWebServiceInboundGateway.java b/spring-integration-ws/src/main/java/org/springframework/integration/ws/SimpleWebServiceInboundGateway.java index 2a8bd4930a..08f2333a62 100644 --- a/spring-integration-ws/src/main/java/org/springframework/integration/ws/SimpleWebServiceInboundGateway.java +++ b/spring-integration-ws/src/main/java/org/springframework/integration/ws/SimpleWebServiceInboundGateway.java @@ -42,7 +42,7 @@ public class SimpleWebServiceInboundGateway extends AbstractWebServiceInboundGat private final TransformerSupportDelegate transformerSupportDelegate = new TransformerSupportDelegate(); - private volatile boolean extractPayload = true; + private boolean extractPayload = true; public void setExtractPayload(boolean extractPayload) { this.extractPayload = extractPayload; @@ -50,16 +50,15 @@ public class SimpleWebServiceInboundGateway extends AbstractWebServiceInboundGat @Override protected void doInvoke(MessageContext messageContext) { - WebServiceMessage request = messageContext.getRequest(); Assert.notNull(request, "Invalid message context: request was null."); - AbstractIntegrationMessageBuilder builder = this.getMessageBuilderFactory().withPayload( + AbstractIntegrationMessageBuilder builder = getMessageBuilderFactory().withPayload( (this.extractPayload) ? request.getPayloadSource() : request); - this.fromSoapHeaders(messageContext, builder); + fromSoapHeaders(messageContext, builder); - Message replyMessage = this.sendAndReceiveMessage(builder.build()); + Message replyMessage = sendAndReceiveMessage(builder.build()); if (replyMessage != null) { Object replyPayload = replyMessage.getPayload(); @@ -101,11 +100,10 @@ public class SimpleWebServiceInboundGateway extends AbstractWebServiceInboundGat private static class TransformerSupportDelegate extends TransformerObjectSupport { TransformerSupportDelegate() { - super(); } void transformSourceToResult(Source source, Result result) throws TransformerException { - this.transform(source, result); + transform(source, result); } } diff --git a/spring-integration-ws/src/main/java/org/springframework/integration/ws/SimpleWebServiceOutboundGateway.java b/spring-integration-ws/src/main/java/org/springframework/integration/ws/SimpleWebServiceOutboundGateway.java index 8aaf7dce41..42f16e2391 100644 --- a/spring-integration-ws/src/main/java/org/springframework/integration/ws/SimpleWebServiceOutboundGateway.java +++ b/spring-integration-ws/src/main/java/org/springframework/integration/ws/SimpleWebServiceOutboundGateway.java @@ -53,7 +53,7 @@ public class SimpleWebServiceOutboundGateway extends AbstractWebServiceOutboundG private final SourceExtractor sourceExtractor; - private volatile boolean extractPayload = true; + private boolean extractPayload = true; public SimpleWebServiceOutboundGateway(DestinationProvider destinationProvider) { this(destinationProvider, null, null); @@ -61,11 +61,13 @@ public class SimpleWebServiceOutboundGateway extends AbstractWebServiceOutboundG public SimpleWebServiceOutboundGateway(DestinationProvider destinationProvider, SourceExtractor sourceExtractor) { + this(destinationProvider, sourceExtractor, null); } public SimpleWebServiceOutboundGateway(DestinationProvider destinationProvider, SourceExtractor sourceExtractor, WebServiceMessageFactory messageFactory) { + super(destinationProvider, messageFactory); this.sourceExtractor = (sourceExtractor != null) ? sourceExtractor : new DefaultSourceExtractor(); } @@ -80,6 +82,7 @@ public class SimpleWebServiceOutboundGateway extends AbstractWebServiceOutboundG public SimpleWebServiceOutboundGateway(String uri, SourceExtractor sourceExtractor, WebServiceMessageFactory messageFactory) { + super(uri, messageFactory); this.sourceExtractor = (sourceExtractor != null) ? sourceExtractor : new DefaultSourceExtractor(); } @@ -104,6 +107,7 @@ public class SimpleWebServiceOutboundGateway extends AbstractWebServiceOutboundG @Override protected Object doHandle(String uri, final Message requestMessage, final WebServiceMessageCallback requestCallback) { + Object requestPayload = requestMessage.getPayload(); Result responseResultInstance = null; if (requestPayload instanceof String) { @@ -178,12 +182,11 @@ public class SimpleWebServiceOutboundGateway extends AbstractWebServiceOutboundG private final Result result; SimpleResponseMessageExtractor(Result result) { - super(); this.result = result; } @Override - public Object doExtractData(WebServiceMessage message) throws IOException, TransformerException { + public Object doExtractData(WebServiceMessage message) throws TransformerException { if (!SimpleWebServiceOutboundGateway.this.extractPayload) { return message; } @@ -213,11 +216,10 @@ public class SimpleWebServiceOutboundGateway extends AbstractWebServiceOutboundG private static class DefaultSourceExtractor extends TransformerObjectSupport implements SourceExtractor { DefaultSourceExtractor() { - super(); } @Override - public DOMSource extractData(Source source) throws IOException, TransformerException { + public DOMSource extractData(Source source) throws TransformerException { if (source instanceof DOMSource) { return (DOMSource) source; } diff --git a/spring-integration-xml/src/main/java/org/springframework/integration/xml/router/XPathRouter.java b/spring-integration-xml/src/main/java/org/springframework/integration/xml/router/XPathRouter.java index e123de2382..c9a80e9b0d 100644 --- a/spring-integration-xml/src/main/java/org/springframework/integration/xml/router/XPathRouter.java +++ b/spring-integration-xml/src/main/java/org/springframework/integration/xml/router/XPathRouter.java @@ -41,18 +41,17 @@ import org.springframework.xml.xpath.XPathExpressionFactory; */ public class XPathRouter extends AbstractMappingMessageRouter { - private volatile NodeMapper nodeMapper = new TextContentNodeMapper(); - private final XPathExpression xPathExpression; - private volatile XmlPayloadConverter converter = new DefaultXmlPayloadConverter(); + private NodeMapper nodeMapper = new TextContentNodeMapper(); - private volatile boolean evaluateAsString = false; + private XmlPayloadConverter converter = new DefaultXmlPayloadConverter(); + + private boolean evaluateAsString = false; /** * Create a router that uses an XPath expression. The expression may * contain zero or more namespace prefixes. - * * @param expression the XPath expression as a String * @param namespaces map of namespaces with prefixes as the map keys */ @@ -64,14 +63,13 @@ public class XPathRouter extends AbstractMappingMessageRouter { /** * Create a router uses an XPath expression with one namespace. For example, * expression='/ns1:one/@type' prefix='ns1' namespace='www.example.org' - * * @param expression the XPath expression as a String * @param prefix namespace prefix * @param namespace namespace uri */ public XPathRouter(String expression, String prefix, String namespace) { Assert.hasText(expression, "expression must not be empty"); - Map namespaces = new HashMap(); + Map namespaces = new HashMap<>(); namespaces.put(prefix, namespace); this.xPathExpression = XPathExpressionFactory.createXPathExpression(expression, namespaces); } @@ -79,7 +77,6 @@ public class XPathRouter extends AbstractMappingMessageRouter { /** * Create a router that uses an XPath expression with no namespaces. * For example '/one/@type' - * * @param expression the XPath expression as a String */ public XPathRouter(String expression) { @@ -89,7 +86,6 @@ public class XPathRouter extends AbstractMappingMessageRouter { /** * Create a router that uses the provided XPath expression. - * * @param expression the XPath expression */ public XPathRouter(XPathExpression expression) { @@ -103,7 +99,6 @@ public class XPathRouter extends AbstractMappingMessageRouter { /** * Specify the Converter to use when converting payloads prior to XPath evaluation. - * * @param converter The payload converter. */ public void setConverter(XmlPayloadConverter converter) { @@ -120,7 +115,7 @@ public class XPathRouter extends AbstractMappingMessageRouter { protected List getChannelKeys(Message message) { Node node = this.converter.convertToNode(message.getPayload()); if (this.evaluateAsString) { - return Collections.singletonList((Object) this.xPathExpression.evaluateAsString(node)); + return Collections.singletonList(this.xPathExpression.evaluateAsString(node)); } else { return this.xPathExpression.evaluate(node, this.nodeMapper); @@ -131,13 +126,13 @@ public class XPathRouter extends AbstractMappingMessageRouter { private static class TextContentNodeMapper implements NodeMapper { TextContentNodeMapper() { - super(); } @Override public Object mapNode(Node node, int nodeNum) throws DOMException { return node.getTextContent(); } + } } diff --git a/spring-integration-xmpp/src/main/java/org/springframework/integration/xmpp/XmppHeaders.java b/spring-integration-xmpp/src/main/java/org/springframework/integration/xmpp/XmppHeaders.java index f334a0d36c..d0f35ed1fe 100644 --- a/spring-integration-xmpp/src/main/java/org/springframework/integration/xmpp/XmppHeaders.java +++ b/spring-integration-xmpp/src/main/java/org/springframework/integration/xmpp/XmppHeaders.java @@ -23,12 +23,12 @@ package org.springframework.integration.xmpp; * @author Mario Gray * @author Josh Long * @author Oleg Zhurakousky + * * @since 2.0 */ public final class XmppHeaders { private XmppHeaders() { - super(); } public static final String PREFIX = "xmpp_"; diff --git a/spring-integration-xmpp/src/main/java/org/springframework/integration/xmpp/config/XmppConnectionFactoryBean.java b/spring-integration-xmpp/src/main/java/org/springframework/integration/xmpp/config/XmppConnectionFactoryBean.java index aeed7f5b3e..b2f9bb0058 100644 --- a/spring-integration-xmpp/src/main/java/org/springframework/integration/xmpp/config/XmppConnectionFactoryBean.java +++ b/spring-integration-xmpp/src/main/java/org/springframework/integration/xmpp/config/XmppConnectionFactoryBean.java @@ -51,23 +51,23 @@ public class XmppConnectionFactoryBean extends AbstractFactoryBean getComponentName() + " [" + getComponentType() + "] must be initialized"); getXmppConnection().addAsyncStanzaListener(this.stanzaListener, this.stanzaFilter); } @@ -120,14 +118,14 @@ public class ChatMessageListeningEndpoint extends AbstractXmppConnectionAwareEnd private class ChatMessagePublishingStanzaListener implements StanzaListener { ChatMessagePublishingStanzaListener() { - super(); } @Override public void processStanza(Stanza packet) { if (packet instanceof org.jivesoftware.smack.packet.Message) { org.jivesoftware.smack.packet.Message xmppMessage = (org.jivesoftware.smack.packet.Message) packet; - Map mappedHeaders = ChatMessageListeningEndpoint.this.headerMapper.toHeadersFromRequest(xmppMessage); + Map mappedHeaders = + ChatMessageListeningEndpoint.this.headerMapper.toHeadersFromRequest(xmppMessage); Object messageBody = xmppMessage.getBody(); diff --git a/spring-integration-xmpp/src/main/java/org/springframework/integration/xmpp/inbound/PresenceListeningEndpoint.java b/spring-integration-xmpp/src/main/java/org/springframework/integration/xmpp/inbound/PresenceListeningEndpoint.java index ebb8aa2dce..7317976104 100644 --- a/spring-integration-xmpp/src/main/java/org/springframework/integration/xmpp/inbound/PresenceListeningEndpoint.java +++ b/spring-integration-xmpp/src/main/java/org/springframework/integration/xmpp/inbound/PresenceListeningEndpoint.java @@ -38,6 +38,7 @@ import org.springframework.util.StringUtils; * @author Mark Fisher * @author Artem Bilan * @author Gary Russell + * * @since 2.0 */ public class PresenceListeningEndpoint extends AbstractXmppConnectionAwareEndpoint { @@ -46,7 +47,6 @@ public class PresenceListeningEndpoint extends AbstractXmppConnectionAwareEndpoi public PresenceListeningEndpoint() { - super(); } public PresenceListeningEndpoint(XMPPConnection xmppConnection) { @@ -61,7 +61,7 @@ public class PresenceListeningEndpoint extends AbstractXmppConnectionAwareEndpoi @Override protected void doStart() { - Assert.isTrue(isInitialized(), this.getComponentName() + " [" + this.getComponentType() + "] must be initialized"); + Assert.isTrue(isInitialized(), () -> getComponentName() + " [" + getComponentType() + "] must be initialized"); Roster roster = Roster.getInstanceFor(getXmppConnection()); roster.addRosterListener(this.rosterListener); } @@ -83,7 +83,6 @@ public class PresenceListeningEndpoint extends AbstractXmppConnectionAwareEndpoi private class PresencePublishingRosterListener implements RosterListener { PresencePublishingRosterListener() { - super(); } @Override diff --git a/spring-integration-xmpp/src/main/java/org/springframework/integration/xmpp/outbound/ChatMessageSendingMessageHandler.java b/spring-integration-xmpp/src/main/java/org/springframework/integration/xmpp/outbound/ChatMessageSendingMessageHandler.java index 5e57c4db5d..5191d73592 100644 --- a/spring-integration-xmpp/src/main/java/org/springframework/integration/xmpp/outbound/ChatMessageSendingMessageHandler.java +++ b/spring-integration-xmpp/src/main/java/org/springframework/integration/xmpp/outbound/ChatMessageSendingMessageHandler.java @@ -56,7 +56,6 @@ public class ChatMessageSendingMessageHandler extends AbstractXmppConnectionAwar private ExtensionElementProvider extensionProvider; public ChatMessageSendingMessageHandler() { - super(); } public ChatMessageSendingMessageHandler(XMPPConnection xmppConnection) { @@ -87,10 +86,10 @@ public class ChatMessageSendingMessageHandler extends AbstractXmppConnectionAwar @Override protected void handleMessageInternal(Message message) { Assert.isTrue(isInitialized(), - () -> getComponentName() + "#" + this.getComponentType() + " must be initialized"); + () -> getComponentName() + "#" + getComponentType() + " must be initialized"); try { Object payload = message.getPayload(); - org.jivesoftware.smack.packet.Message xmppMessage = null; + org.jivesoftware.smack.packet.Message xmppMessage; if (payload instanceof org.jivesoftware.smack.packet.Message) { xmppMessage = (org.jivesoftware.smack.packet.Message) payload; } diff --git a/spring-integration-xmpp/src/main/java/org/springframework/integration/xmpp/outbound/PresenceSendingMessageHandler.java b/spring-integration-xmpp/src/main/java/org/springframework/integration/xmpp/outbound/PresenceSendingMessageHandler.java index 386958d07a..0957ccf2f5 100644 --- a/spring-integration-xmpp/src/main/java/org/springframework/integration/xmpp/outbound/PresenceSendingMessageHandler.java +++ b/spring-integration-xmpp/src/main/java/org/springframework/integration/xmpp/outbound/PresenceSendingMessageHandler.java @@ -37,7 +37,6 @@ import org.springframework.util.Assert; public class PresenceSendingMessageHandler extends AbstractXmppConnectionAwareMessageHandler { public PresenceSendingMessageHandler() { - super(); } public PresenceSendingMessageHandler(XMPPConnection xmppConnection) { diff --git a/spring-integration-zookeeper/src/main/java/org/springframework/integration/zookeeper/leader/LeaderInitiator.java b/spring-integration-zookeeper/src/main/java/org/springframework/integration/zookeeper/leader/LeaderInitiator.java index 342fafd24e..d8f7ba6f95 100644 --- a/spring-integration-zookeeper/src/main/java/org/springframework/integration/zookeeper/leader/LeaderInitiator.java +++ b/spring-integration-zookeeper/src/main/java/org/springframework/integration/zookeeper/leader/LeaderInitiator.java @@ -43,7 +43,7 @@ import org.springframework.util.StringUtils; */ public class LeaderInitiator implements SmartLifecycle { - private static final Log logger = LogFactory.getLog(LeaderInitiator.class); + private static final Log LOGGER = LogFactory.getLog(LeaderInitiator.class); private static final String DEFAULT_NAMESPACE = "/spring-integration/leader/"; @@ -75,27 +75,6 @@ public class LeaderInitiator implements SmartLifecycle { private final Object lifecycleMonitor = new Object(); - /** - * Curator utility for selecting leaders. - */ - private volatile LeaderSelector leaderSelector; - - /** - * @see SmartLifecycle - */ - private volatile boolean autoStartup = true; - - /** - * @see SmartLifecycle which is an extension of org.springframework.context.Phased - */ - private volatile int phase = Integer.MAX_VALUE - 1000; - - /** - * Flag that indicates whether the leadership election for - * this {@link #candidate} is running. - */ - private volatile boolean running; - /** * Base path in a zookeeper */ @@ -104,7 +83,28 @@ public class LeaderInitiator implements SmartLifecycle { /** * Leader event publisher if set */ - private volatile LeaderEventPublisher leaderEventPublisher; + private LeaderEventPublisher leaderEventPublisher; + + /** + * @see SmartLifecycle + */ + private boolean autoStartup = true; + + /** + * @see SmartLifecycle which is an extension of org.springframework.context.Phased + */ + private int phase = Integer.MAX_VALUE - 1000; // NOSONAR + + /** + * Curator utility for selecting leaders. + */ + private volatile LeaderSelector leaderSelector; + + /** + * Flag that indicates whether the leadership election for + * this {@link #candidate} is running. + */ + private volatile boolean running; /** * Construct a {@link LeaderInitiator}. @@ -181,7 +181,7 @@ public class LeaderInitiator implements SmartLifecycle { this.leaderSelector.start(); this.running = true; - logger.debug("Started LeaderInitiator"); + LOGGER.debug("Started LeaderInitiator"); } } } @@ -196,7 +196,7 @@ public class LeaderInitiator implements SmartLifecycle { if (this.running) { this.leaderSelector.close(); this.running = false; - logger.debug("Stopped LeaderInitiator"); + LOGGER.debug("Stopped LeaderInitiator"); } } } @@ -226,7 +226,7 @@ public class LeaderInitiator implements SmartLifecycle { */ private String buildLeaderPath() { String ns = StringUtils.hasText(this.namespace) ? this.namespace : DEFAULT_NAMESPACE; - if (!ns.startsWith("/")) { + if (ns.charAt(0) != '/') { ns = '/' + ns; } if (!ns.endsWith("/")) { @@ -250,7 +250,7 @@ public class LeaderInitiator implements SmartLifecycle { LeaderInitiator.this.context, LeaderInitiator.this.candidate.getRole()); } catch (Exception e) { - logger.warn("Error publishing OnGranted event.", e); + LOGGER.warn("Error publishing OnGranted event.", e); } } @@ -272,7 +272,7 @@ public class LeaderInitiator implements SmartLifecycle { LeaderInitiator.this.context, LeaderInitiator.this.candidate.getRole()); } catch (Exception e) { - logger.warn("Error publishing OnRevoked event.", e); + LOGGER.warn("Error publishing OnRevoked event.", e); } } } @@ -286,7 +286,6 @@ public class LeaderInitiator implements SmartLifecycle { private class CuratorContext implements Context { CuratorContext() { - super(); } @Override diff --git a/spring-integration-zookeeper/src/main/java/org/springframework/integration/zookeeper/metadata/ZookeeperMetadataStore.java b/spring-integration-zookeeper/src/main/java/org/springframework/integration/zookeeper/metadata/ZookeeperMetadataStore.java index 0d04b9714b..46299637f2 100644 --- a/spring-integration-zookeeper/src/main/java/org/springframework/integration/zookeeper/metadata/ZookeeperMetadataStore.java +++ b/spring-integration-zookeeper/src/main/java/org/springframework/integration/zookeeper/metadata/ZookeeperMetadataStore.java @@ -97,7 +97,7 @@ public class ZookeeperMetadataStore implements ListenableMetadataStore, SmartLif */ public void setRoot(String root) { Assert.notNull(root, "'root' must not be null."); - Assert.isTrue(root.startsWith("/"), "'root' must start with '/'"); + Assert.isTrue(root.charAt(0) == '/', "'root' must start with '/'"); // remove trailing slash, if not root this.root = "/".equals(root) || !root.endsWith("/") ? root : root.substring(0, root.length() - 1); } @@ -259,7 +259,7 @@ public class ZookeeperMetadataStore implements ListenableMetadataStore, SmartLif } public String getPath(String key) { - return "".equals(key) ? this.root : this.root + "/" + key; + return "".equals(key) ? this.root : this.root + '/' + key; } @@ -318,7 +318,7 @@ public class ZookeeperMetadataStore implements ListenableMetadataStore, SmartLif } private String getKey(String path) { - return path.replace(this.root + "/", ""); + return path.replace(this.root + '/', ""); } @@ -346,7 +346,6 @@ public class ZookeeperMetadataStore implements ListenableMetadataStore, SmartLif private class MetadataStoreListenerInvokingPathChildrenCacheListener implements PathChildrenCacheListener { MetadataStoreListenerInvokingPathChildrenCacheListener() { - super(); } @Override diff --git a/src/reference/asciidoc/jdbc.adoc b/src/reference/asciidoc/jdbc.adoc index ad15350f7a..30390a7563 100644 --- a/src/reference/asciidoc/jdbc.adoc +++ b/src/reference/asciidoc/jdbc.adoc @@ -463,10 +463,6 @@ The following example uses the default implementation of `setValues` to store co ---- public class JsonPreparedStatementSetter extends ChannelMessageStorePreparedStatementSetter { - public JsonPreparedStatementSetter() { - super(); - } - @Override public void setValues(PreparedStatement preparedStatement, Message requestMessage, Object groupId, String region, boolean priorityEnabled) throws SQLException {