GH-3132: Remove usage of super();

Fixes https://github.com/spring-projects/spring-integration/issues/3132

It turns out that Checkstyle EmptyBlock doesn't complain about
empty default ctor.
Plus a new check for `super();` call treats it as a violation

* Remove `super();` from all the no-arg ctors
* Code style clean up in the affected classes according
IDEA suggestions

* Fix new Sonar smells
This commit is contained in:
Artem Bilan
2019-12-27 13:04:10 -05:00
committed by Gary Russell
parent 9c68ae4a7d
commit 5ac262f866
127 changed files with 386 additions and 490 deletions

View File

@@ -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);
}
}

View File

@@ -38,7 +38,6 @@ import org.springframework.util.MimeType;
public final class MappingUtils {
private MappingUtils() {
super();
}
/**

View File

@@ -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<IntegrationPatternType> getPatternTypes() {

View File

@@ -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

View File

@@ -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)");
}
/**

View File

@@ -960,7 +960,6 @@ public abstract class AbstractCorrelatingMessageHandler extends AbstractMessageP
private class ForceReleaseMessageGroupProcessor implements MessageGroupProcessor {
ForceReleaseMessageGroupProcessor() {
super();
}
@Override

View File

@@ -19,24 +19,17 @@ package org.springframework.integration.aggregator;
import org.springframework.integration.store.MessageGroup;
/**
* A {@link ReleaseStrategy} that releases only the first <code>n</code> messages, where <code>n</code> 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

View File

@@ -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);
}
}

View File

@@ -40,7 +40,6 @@ import reactor.core.scheduler.Schedulers;
public final class MessageChannelReactiveUtils {
private MessageChannelReactiveUtils() {
super();
}
@SuppressWarnings("unchecked")

View File

@@ -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",

View File

@@ -132,7 +132,6 @@ public final class Channels {
}
private Channels() {
super();
}
}

View File

@@ -38,7 +38,6 @@ public class DirectChannelSpec extends LoadBalancingChannelSpec<DirectChannelSpe
}
DirectChannelSpec() {
super();
}
}

View File

@@ -28,7 +28,6 @@ import org.springframework.messaging.Message;
public final class IntegrationFlowBuilder extends IntegrationFlowDefinition<IntegrationFlowBuilder> {
IntegrationFlowBuilder() {
super();
}
@Override

View File

@@ -39,7 +39,6 @@ public abstract class LoadBalancingChannelSpec<S extends MessageChannelSpec<S, C
protected Integer maxSubscribers; // NOSONAR
protected LoadBalancingChannelSpec() {
super();
}
public S loadBalancer(LoadBalancingStrategy loadBalancingStrategyToSet) {

View File

@@ -54,7 +54,6 @@ public abstract class MessageChannelSpec<S extends MessageChannelSpec<S, C>, C e
private MessageConverter messageConverter;
protected MessageChannelSpec() {
super();
}
public S datatype(Class<?>... types) {
@@ -118,7 +117,7 @@ public abstract class MessageChannelSpec<S extends MessageChannelSpec<S, C>, 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);

View File

@@ -133,7 +133,6 @@ public final class MessageChannels {
}
private MessageChannels() {
super();
}
}

View File

@@ -81,7 +81,6 @@ public final class PollerFactory {
}
PollerFactory() {
super();
}
}

View File

@@ -38,7 +38,6 @@ public class PriorityChannelSpec extends MessageChannelSpec<PriorityChannelSpec,
private MessageGroupQueue messageGroupQueue;
PriorityChannelSpec() {
super();
}
public PriorityChannelSpec capacity(int capacity) {

View File

@@ -19,6 +19,7 @@ package org.springframework.integration.dsl;
import java.util.concurrent.Executor;
import org.springframework.integration.channel.PublishSubscribeChannel;
import org.springframework.lang.Nullable;
import org.springframework.util.ErrorHandler;
/**
@@ -33,10 +34,10 @@ public class PublishSubscribeChannelSpec<S extends PublishSubscribeChannelSpec<S
extends MessageChannelSpec<S, PublishSubscribeChannel> {
protected PublishSubscribeChannelSpec() {
this.channel = new PublishSubscribeChannel();
this(null);
}
protected PublishSubscribeChannelSpec(Executor executor) {
protected PublishSubscribeChannelSpec(@Nullable Executor executor) {
this.channel = new PublishSubscribeChannel(executor);
}

View File

@@ -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<PublishSub
private int order;
PublishSubscribeSpec() {
super();
}
PublishSubscribeSpec(Executor executor) {
PublishSubscribeSpec(@Nullable Executor executor) {
super(executor);
}

View File

@@ -36,7 +36,6 @@ public class QueueChannelSpec extends MessageChannelSpec<QueueChannelSpec, Queue
protected Integer capacity; // NOSONAR
QueueChannelSpec() {
super();
}
QueueChannelSpec(Queue<Message<?>> queue) {
@@ -73,7 +72,6 @@ public class QueueChannelSpec extends MessageChannelSpec<QueueChannelSpec, Queue
private Lock storeLock;
MessageStoreSpec(ChannelMessageStore messageGroupStore, Object groupId) {
super();
this.messageGroupStore = messageGroupStore;
this.groupId = groupId;
}

View File

@@ -150,7 +150,6 @@ public class ReactiveStreamsConsumer extends AbstractEndpoint implements Integra
private final Subscriber<Message<?>> delegate = ReactiveStreamsConsumer.this.subscriber;
DelegatingSubscriber() {
super();
}
@Override

View File

@@ -303,7 +303,6 @@ public final class ExpressionEvalMap extends AbstractMap<String, Object> {
private class ExpressionEvalMapFinalBuilderImpl implements ExpressionEvalMapFinalBuilder {
ExpressionEvalMapFinalBuilderImpl() {
super();
}
@Override
@@ -327,7 +326,6 @@ public final class ExpressionEvalMap extends AbstractMap<String, Object> {
implements ExpressionEvalMapComponentsBuilder {
ExpressionEvalMapComponentsBuilderImpl() {
super();
}
@Override

View File

@@ -60,7 +60,6 @@ public final class ExpressionUtils {
private static final Log LOGGER = LogFactory.getLog(ExpressionUtils.class);
private ExpressionUtils() {
super();
}
/**

View File

@@ -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<String, Map<Locale, List<String>>> cachedFilenames = new HashMap<>();
private volatile String defaultEncoding;
/**
* Cache to hold already loaded properties per filename
*/
private final Map<String, PropertiesHolder> 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<String, Map<Locale, List<String>>> cachedFilenames =
new HashMap<String, Map<Locale, List<String>>>();
/** Cache to hold already loaded properties per filename */
private final Map<String, PropertiesHolder> cachedProperties = new HashMap<String, PropertiesHolder>();
/** Cache to hold merged loaded properties per locale */
private final Map<Locale, PropertiesHolder> cachedMergedProperties = new HashMap<Locale, PropertiesHolder>();
/**
* Cache to hold merged loaded properties per locale
*/
private final Map<Locale, PropertiesHolder> 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
* <li>A value of "0" will check the last-modified timestamp of the file on
* every expression access. <b>Do not use this in a production environment!</b>
* </ul>
*
* @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.
* <p>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.
* <p>Only used when caching resource bundle contents forever, i.e.
* <p> 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<String> filenames = new ArrayList<String>(7);
List<String> filenames = new ArrayList<>(7);
filenames.addAll(calculateFilenamesForLocale(basename, locale));
if (this.fallbackToSystemLocale && !locale.equals(Locale.getDefault())) {
List<String> fallbackFilenames = calculateFilenamesForLocale(basename, Locale.getDefault());
@@ -339,7 +339,7 @@ public class ReloadableResourceBundleExpressionSource implements ExpressionSourc
localeMap.put(locale, filenames);
}
else {
localeMap = new HashMap<Locale, List<String>>();
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<String> calculateFilenamesForLocale(String basename, Locale locale) {
List<String> result = new ArrayList<String>(3);
List<String> 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;
}

View File

@@ -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<Lookup> constructor;
private final transient Constructor<Lookup> constructor;
{
Constructor<Lookup> 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());

View File

@@ -509,7 +509,7 @@ public class GatewayProxyFactoryBean extends AbstractEndpoint
try {
return invocation.proceed();
}
catch (Throwable throwable) {
catch (Throwable throwable) { // NOSONAR
throw new IllegalStateException(throwable);
}
}

View File

@@ -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<Message<?>> replyMono = MonoProcessor.create();
MonoReplyChannel() {
super();
}
@Override

View File

@@ -354,7 +354,6 @@ public class IntegrationGraphServer implements ApplicationContextAware, Applicat
private final AtomicInteger nodeId = new AtomicInteger();
NodeFactory() {
super();
}
MessageChannelNode channelNode(String name, MessageChannel channel) {

View File

@@ -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;

View File

@@ -35,19 +35,22 @@ public abstract class AbstractReactiveMessageHandler extends MessageHandlerSuppo
implements ReactiveMessageHandler {
@Override
public Mono<Void> handleMessage(Message<?> message) {
Assert.notNull(message, "Message must not be null");
public Mono<Void> 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<Void> handleMessageInternal(Message<?> message);

View File

@@ -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

View File

@@ -602,7 +602,6 @@ public class DelayHandler extends AbstractReplyProducingMessageHandler implement
private class ReleaseMessageHandler implements MessageHandler {
ReleaseMessageHandler() {
super();
}
@Override

View File

@@ -238,7 +238,6 @@ public class MessageHandlerChain extends AbstractMessageProducingHandler
private final class ReplyForwardingMessageChannel implements MessageChannel {
ReplyForwardingMessageChannel() {
super();
}
@Override

View File

@@ -40,7 +40,7 @@ public class RequestHandlerCircuitBreakerAdvice extends AbstractRequestHandlerAd
private volatile long halfOpenAfter = 1000;
private final ConcurrentMap<Object, AdvisedMetadata> metadataMap = new ConcurrentHashMap<Object, AdvisedMetadata>();
private final ConcurrentMap<Object, AdvisedMetadata> 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() {

View File

@@ -43,7 +43,6 @@ public final class SimpleJsonSerializer {
private static final Log logger = LogFactory.getLog(SimpleJsonSerializer.class);
private SimpleJsonSerializer() {
super();
}
/**

View File

@@ -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();
}
/**

View File

@@ -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";

View File

@@ -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

View File

@@ -52,7 +52,6 @@ public abstract class AbstractMessageGroupStore extends AbstractBatchingMessageG
private boolean lazyLoadMessageGroups = true;
protected AbstractMessageGroupStore() {
super();
}
protected AbstractMessageGroupStore(boolean lazyLoadMessageGroups) {

View File

@@ -173,7 +173,6 @@ class PersistentMessageGroup implements MessageGroup {
private volatile Collection<Message<?>> collection;
PersistentCollection() {
super();
}
private void load() {

View File

@@ -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();
}
}

View File

@@ -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();
}
/**

View File

@@ -130,11 +130,10 @@ public class SimpleMessageConverter implements MessageConverter, BeanFactoryAwar
private class DefaultInboundMessageMapper implements InboundMessageMapper<Object> {
DefaultInboundMessageMapper() {
super();
}
@Override
public Message<?> toMessage(Object object, @Nullable Map<String, Object> headers) {
public Message<?> toMessage(@Nullable Object object, @Nullable Map<String, Object> headers) {
if (object == null) {
return null;
}
@@ -153,11 +152,10 @@ public class SimpleMessageConverter implements MessageConverter, BeanFactoryAwar
private static class DefaultOutboundMessageMapper implements OutboundMessageMapper<Object> {
DefaultOutboundMessageMapper() {
super();
}
@Override
public Object fromMessage(Message<?> message) {
public Object fromMessage(@Nullable Message<?> message) {
return (message != null) ? message.getPayload() : null;
}

View File

@@ -52,7 +52,6 @@ import com.fasterxml.jackson.databind.module.SimpleModule;
public final class JacksonJsonUtils {
private JacksonJsonUtils() {
super();
}
/**

View File

@@ -47,7 +47,6 @@ public final class JacksonPresent {
private JacksonPresent() {
super();
}
}

View File

@@ -40,7 +40,6 @@ public final class JsonObjectMapperProvider {
ClassUtils.isPresent("org.boon.json.ObjectMapper", classLoader);
private JsonObjectMapperProvider() {
super();
}
/**

View File

@@ -508,7 +508,6 @@ public class LockRegistryLeaderInitiator implements SmartLifecycle, DisposableBe
private class LockContext implements Context {
LockContext() {
super();
}
@Override

View File

@@ -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
}
}
}

View File

@@ -62,7 +62,6 @@ public final class IntegrationUtils {
Boolean.parseBoolean(System.getenv("SI_FATAL_WHEN_NO_BEANFACTORY"));
private IntegrationUtils() {
super();
}
/**

View File

@@ -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<String, HeaderValueMessageProcessor<?>> 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<String, Object> targetHeaders = new HashMap<>(
this.nullResultHeaderExpressions.size());
Map<String, Object> targetHeaders = new HashMap<>(this.nullResultHeaderExpressions.size());
for (Map.Entry<String, HeaderValueMessageProcessor<?>> entry : this.nullResultHeaderExpressions
.entrySet()) {
String header = entry.getKey();
@@ -435,7 +438,7 @@ public class ContentEnricher extends AbstractReplyProducingMessageHandler implem
return targetPayload;
}
else {
Map<String, Object> targetHeaders = new HashMap<String, Object>(this.headerExpressions.size());
Map<String, Object> targetHeaders = new HashMap<>(this.headerExpressions.size());
for (Map.Entry<String, HeaderValueMessageProcessor<?>> 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

View File

@@ -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<String, ? extends HeaderValueMessageProcessor<?>> 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

View File

@@ -27,7 +27,6 @@ package org.springframework.integration.transformer.support;
public final class AvroHeaders {
private AvroHeaders() {
super();
}
/**

View File

@@ -41,7 +41,6 @@ public final class JavaUtils {
public static final JavaUtils INSTANCE = new JavaUtils();
private JavaUtils() {
super();
}
/**

View File

@@ -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();
}
}

View File

@@ -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<SyndEntry> {
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<SyndEntry> {
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<SyndEntry> {
List<SyndEntry> 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<SyndEntry> {
private static final class SyndEntryPublishedDateComparator implements Comparator<SyndEntry>, Serializable {
SyndEntryPublishedDateComparator() {
super();
}
@Override

View File

@@ -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

View File

@@ -40,7 +40,6 @@ import org.springframework.util.Assert;
public class ChainFileListFilter<F> extends CompositeFileListFilter<F> {
public ChainFileListFilter() {
super();
}
public ChainFileListFilter(Collection<? extends FileListFilter<F>> fileFilters) {

View File

@@ -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 <code>null</code>.
* VM. If the lock could not be acquired this method will return {@code null}.
* <p>
* Locks acquired through this method should be passed back to #closeChannelFor to prevent memory leaks.
* <p>

View File

@@ -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<String> pathsToCreate = new LinkedList<String>();
List<String> pathsToCreate = new LinkedList<>();
while (nextSeparatorIndex > -1) {
String pathSegment = path.substring(0, nextSeparatorIndex);
if (pathSegment.length() == 0 || session.exists(pathSegment)) {

View File

@@ -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> F[] purgeUnwantedElements(F[] fileArray, Predicate<F> predicate,
@Nullable Comparator<F> comparator) {
if (ObjectUtils.isEmpty(fileArray)) {
return fileArray;
}
@@ -67,7 +69,6 @@ public final class FileUtils {
}
private FileUtils() {
super();
}
}

View File

@@ -292,7 +292,6 @@ public class AbstractRemoteFileSynchronizerTests {
private static class StringSession implements Session<String> {
StringSession() {
super();
}
@Override

View File

@@ -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<FTPFile> sessionFactory,
Comparator<File> receptionOrderComparator) {
return new FtpInboundChannelAdapterSpec(sessionFactory, receptionOrderComparator);
}
@@ -66,6 +68,7 @@ public final class Ftp {
*/
public static FtpStreamingInboundChannelAdapterSpec inboundStreamingAdapter(
RemoteFileTemplate<FTPFile> remoteFileTemplate) {
return inboundStreamingAdapter(remoteFileTemplate, null);
}
@@ -79,6 +82,7 @@ public final class Ftp {
public static FtpStreamingInboundChannelAdapterSpec inboundStreamingAdapter(
RemoteFileTemplate<FTPFile> remoteFileTemplate,
Comparator<FTPFile> receptionOrderComparator) {
return new FtpStreamingInboundChannelAdapterSpec(remoteFileTemplate, receptionOrderComparator);
}
@@ -99,6 +103,7 @@ public final class Ftp {
*/
public static FtpMessageHandlerSpec outboundAdapter(SessionFactory<FTPFile> sessionFactory,
FileExistsMode fileExistsMode) {
return outboundAdapter(new FtpRemoteFileTemplate(sessionFactory), fileExistsMode);
}
@@ -119,6 +124,7 @@ public final class Ftp {
*/
public static FtpMessageHandlerSpec outboundAdapter(RemoteFileTemplate<FTPFile> remoteFileTemplate,
FileExistsMode fileExistsMode) {
return new FtpMessageHandlerSpec(remoteFileTemplate, fileExistsMode);
}
@@ -133,6 +139,7 @@ public final class Ftp {
*/
public static FtpOutboundGatewaySpec outboundGateway(SessionFactory<FTPFile> 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<FTPFile> 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<FTPFile> 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<FTPFile> 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<FTPFile> sessionFactory,
MessageSessionCallback<FTPFile, ?> messageSessionCallback) {
return new FtpOutboundGatewaySpec(new FtpOutboundGateway(sessionFactory, messageSessionCallback));
}
private Ftp() {
super();
}
}

View File

@@ -116,7 +116,6 @@ public class GemfireMetadataStore implements ListenableMetadataStore {
private final List<MetadataStoreListener> listeners = new CopyOnWriteArrayList<>();
GemfireCacheListener() {
super();
}
@Override

View File

@@ -62,7 +62,6 @@ public class GroovyCommandMessageProcessor extends AbstractScriptExecutingMessag
* {@link org.springframework.integration.scripting.DefaultScriptVariableGenerator}.
*/
public GroovyCommandMessageProcessor() {
super();
}
/**

View File

@@ -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();
}
/**

View File

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

View File

@@ -190,7 +190,7 @@ public abstract class HttpInboundEndpointSupportSpec<S extends HttpInboundEndpoi
*/
public S mappedRequestHeaders(String... patterns) {
Assert.isNull(this.explicitHeaderMapper,
"The 'mappedRequestHeaders' must be specified on the provided 'headerMapper': "
() -> "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<S extends HttpInboundEndpoi
*/
public S mappedResponseHeaders(String... patterns) {
Assert.isNull(this.explicitHeaderMapper,
"The 'mappedRequestHeaders' must be specified on the provided 'headerMapper': "
() -> "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 HttpInboundEndpointSupportSpec<S extends HttpInboundEndpoi
* Specify the type of payload to be generated when the inbound HTTP request content is read by the
* {@link org.springframework.http.converter.HttpMessageConverter}s.
* By default this value is null which means at runtime any "text" Content-Type will
* result in String while all others default to <code>byte[].class</code>.
* 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 HttpInboundEndpointSupportSpec<S extends HttpInboundEndpoi
* Specify the type of payload to be generated when the inbound HTTP request content is read by the
* {@link org.springframework.http.converter.HttpMessageConverter}s.
* By default this value is null which means at runtime any "text" Content-Type will
* result in String while all others default to <code>byte[].class</code>.
* 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<S extends HttpInboundEndpoi
private final CrossOrigin crossOrigin = new CrossOrigin();
CrossOriginSpec() {
super();
}
/**

View File

@@ -30,6 +30,7 @@ import org.springframework.messaging.Message;
* @param <S> the target {@link AbstractUdpOutboundChannelAdapterSpec} implementation type.
*
* @author Gary Russell
*
* @since 5.0
*
*/
@@ -37,7 +38,6 @@ public abstract class AbstractUdpOutboundChannelAdapterSpec<S extends AbstractUd
extends MessageHandlerSpec<S, UnicastSendingMessageHandler> {
protected AbstractUdpOutboundChannelAdapterSpec() {
super();
}
protected AbstractUdpOutboundChannelAdapterSpec(String host, int port) {

View File

@@ -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();
}
/**

View File

@@ -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<Message<?>, ?>
destinationFunction) {
public static UdpMulticastOutboundChannelAdapterSpec outboundMulticastAdapter(
Function<Message<?>, ?> destinationFunction) {
return new UdpMulticastOutboundChannelAdapterSpec(destinationFunction);
}

View File

@@ -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();
}

View File

@@ -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();
}
/**

View File

@@ -24,11 +24,12 @@ package org.springframework.integration.ip.tcp.serializer;
* <pre class="code">
* TcpNetServerConnectionFactory server = new TcpNetServerConnectionFactory(1234);
* server.setSerializer(TcpCodecs.lf());
* server.setDserializer(TcpCodecs.lf());
* server.setDeserializer(TcpCodecs.lf());
* ...
* </pre>
*
* @author Gary Russell
*
* @since 5.0
*
*/
@@ -41,7 +42,6 @@ public final class TcpCodecs {
private static ByteArrayLengthHeaderSerializer fourByteLHS;
private TcpCodecs() {
super();
}
/**

View File

@@ -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() { }
}

View File

@@ -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();
}
/**

View File

@@ -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<String, String> convertExpressions(Collection<ProcedureParameter> 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<String, String> staticParameters = new HashMap<String, String>();
Map<String, String> 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<String, Object> convertStaticParameters(Collection<ProcedureParameter> 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<String, Object> staticParameters = new HashMap<String, Object>();
Map<String, Object> staticParameters = new HashMap<>();
for (ProcedureParameter parameter : procedureParameters) {
if (parameter.getValue() != null) {

View File

@@ -502,7 +502,6 @@ public class ChannelPublishingJmsMessageListener
private class GatewayDelegate extends MessagingGatewaySupport {
GatewayDelegate() {
super();
}
@Override

View File

@@ -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<Entry<String, TimedReply>> 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.");

View File

@@ -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 <code>spring.application</code> (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;
}

View File

@@ -170,7 +170,6 @@ public final class Jpa {
}
private Jpa() {
super();
}
}

View File

@@ -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 +
"]";
}
}

View File

@@ -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

View File

@@ -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

View File

@@ -36,7 +36,6 @@ public class Pop3MailReceiver extends AbstractMailReceiver {
public static final String PROTOCOL = "pop3";
public Pop3MailReceiver() {
super();
setProtocol(PROTOCOL);
}

View File

@@ -201,7 +201,6 @@ public final class Mail {
private Mail() {
super();
}
}

View File

@@ -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);
}
}
}

View File

@@ -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();
}
}

View File

@@ -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) {

View File

@@ -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);

View File

@@ -673,7 +673,6 @@ public class MongoDbMessageStore extends AbstractMessageGroupStore
private static class MessageHistoryToDocumentConverter implements Converter<MessageHistory, Document> {
MessageHistoryToDocumentConverter() {
super();
}
@Override
@@ -697,7 +696,6 @@ public class MongoDbMessageStore extends AbstractMessageGroupStore
private class DocumentToGenericMessageConverter implements Converter<Document, GenericMessage<?>> {
DocumentToGenericMessageConverter() {
super();
}
@Override
@@ -718,7 +716,6 @@ public class MongoDbMessageStore extends AbstractMessageGroupStore
private final class DocumentToMutableMessageConverter implements Converter<Document, MutableMessage<?>> {
DocumentToMutableMessageConverter() {
super();
}
@Override
@@ -739,7 +736,6 @@ public class MongoDbMessageStore extends AbstractMessageGroupStore
private class DocumentToAdviceMessageConverter implements Converter<Document, AdviceMessage<?>> {
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<Object, byte[]> serializingConverter = new SerializingConverter();
ThrowableToBytesConverter() {
super();
}
@Override

View File

@@ -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_";

View File

@@ -208,7 +208,6 @@ public class SubscribableRedisChannel extends AbstractMessageChannel
private class MessageListenerDelegate {
MessageListenerDelegate() {
super();
}
@SuppressWarnings({ "unused" })

View File

@@ -164,7 +164,6 @@ public class RedisInboundChannelAdapter extends MessageProducerSupport {
private class MessageListenerDelegate {
MessageListenerDelegate() {
super();
}
@SuppressWarnings("unused")

View File

@@ -359,7 +359,6 @@ public class RedisQueueInboundGateway extends MessagingGatewaySupport
private class ListenerTask implements SchedulingAwareRunnable {
ListenerTask() {
super();
}
@Override

View File

@@ -336,7 +336,6 @@ public class RedisQueueMessageDrivenEndpoint extends MessageProducerSupport
private class ListenerTask implements SchedulingAwareRunnable {
ListenerTask() {
super();
}
@Override

View File

@@ -143,7 +143,6 @@ public class RedisOutboundGateway extends AbstractReplyProducingMessageHandler {
private static class PayloadArgumentsStrategy implements ArgumentsStrategy {
PayloadArgumentsStrategy() {
super();
}
@Override

View File

@@ -29,7 +29,6 @@ package org.springframework.integration.redis.support;
public final class RedisHeaders {
private RedisHeaders() {
super();
}
public static final String PREFIX = "redis_";

View File

@@ -74,7 +74,6 @@ public final class RSockets {
}
private RSockets() {
super();
}
}

View File

@@ -65,7 +65,6 @@ public final class ScriptExecutorFactory {
}
private ScriptExecutorFactory() {
super();
}
}

Some files were not shown because too many files have changed in this diff Show More