Sonar fixes
* use equals * inner assignment * local before return * unnecessary locals * catch and throw * uninstantiable with no statics * implement `Serializable` in `Comparator` to enable `TreeMap` serialization * exceptions as flow control
This commit is contained in:
committed by
Artem Bilan
parent
130e1bba31
commit
19b9944dd8
@@ -108,6 +108,7 @@ public class CorrelatingMessageBarrier extends AbstractMessageHandler implements
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Message<Object> receive() {
|
||||
for (Object key : this.correlationLocks.keySet()) {
|
||||
@@ -130,9 +131,7 @@ public class CorrelatingMessageBarrier extends AbstractMessageHandler implements
|
||||
else {
|
||||
remove(key);
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
Message<Object> result = (Message<Object>) nextMessage;
|
||||
return result;
|
||||
return (Message<Object>) nextMessage;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.integration.aggregator;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Comparator;
|
||||
|
||||
import org.springframework.integration.IntegrationMessageHeaderAccessor;
|
||||
@@ -25,8 +26,10 @@ import org.springframework.messaging.Message;
|
||||
* @author Mark Fisher
|
||||
* @author Dave Syer
|
||||
* @author Artem Bilan
|
||||
* @author Gary Russell
|
||||
*/
|
||||
public class MessageSequenceComparator implements Comparator<Message<?>> {
|
||||
@SuppressWarnings("serial")
|
||||
public class MessageSequenceComparator implements Comparator<Message<?>>, Serializable {
|
||||
|
||||
@Override
|
||||
public int compare(Message<?> o1, Message<?> o2) {
|
||||
|
||||
@@ -193,7 +193,7 @@ public class PublisherAnnotationAdvisor extends AbstractPointcutAdvisor implemen
|
||||
}
|
||||
// The method may be on an interface, so let's check on the target class as well.
|
||||
Method specificMethod = AopUtils.getMostSpecificMethod(method, targetClass);
|
||||
return (specificMethod != method &&
|
||||
return (!specificMethod.equals(method) &&
|
||||
(AnnotationUtils.getAnnotation(specificMethod, this.annotationType) != null));
|
||||
}
|
||||
|
||||
|
||||
@@ -106,7 +106,8 @@ public final class MessageChannelReactiveUtils {
|
||||
.<Message<T>>create(sink ->
|
||||
sink.onRequest(n -> {
|
||||
Message<?> m;
|
||||
while (!sink.isCancelled() && n-- > 0 && (m = this.channel.receive()) != null) {
|
||||
while (!sink.isCancelled() && n-- > 0
|
||||
&& (m = this.channel.receive()) != null) { // NOSONAR
|
||||
sink.next((Message<T>) m);
|
||||
}
|
||||
}),
|
||||
|
||||
@@ -39,7 +39,7 @@ public final class FixedSubscriberChannelBeanFactoryPostProcessor implements Bea
|
||||
|
||||
private final Map<String, String> candidateFixedChannelHandlerMap;
|
||||
|
||||
private FixedSubscriberChannelBeanFactoryPostProcessor(Map<String, String> candidateHandlers) {
|
||||
FixedSubscriberChannelBeanFactoryPostProcessor(Map<String, String> candidateHandlers) {
|
||||
this.candidateFixedChannelHandlerMap = candidateHandlers;
|
||||
}
|
||||
|
||||
|
||||
@@ -158,7 +158,7 @@ public abstract class AbstractMethodAnnotationPostProcessor<T extends Annotation
|
||||
orderable(method, handler);
|
||||
producerOrRouter(annotations, handler);
|
||||
|
||||
if (handler != sourceHandler) {
|
||||
if (!handler.equals(sourceHandler)) {
|
||||
String handlerBeanName = generateHandlerBeanName(beanName, method);
|
||||
if (handler instanceof ReplyProducingMessageHandlerWrapper
|
||||
&& StringUtils.hasText(MessagingAnnotationUtils.endpointIdValue(method))) {
|
||||
|
||||
@@ -52,7 +52,7 @@ public class PointToPointChannelParser extends AbstractChannelParser {
|
||||
|
||||
// configure a queue-based channel if any queue sub-element is defined
|
||||
String channel = element.getAttribute(ID_ATTRIBUTE);
|
||||
if ((queueElement = DomUtils.getChildElementByTagName(element, "queue")) != null) {
|
||||
if ((queueElement = DomUtils.getChildElementByTagName(element, "queue")) != null) { // NOSONAR inner assignment
|
||||
builder = BeanDefinitionBuilder.genericBeanDefinition(QueueChannel.class);
|
||||
boolean hasStoreRef = this.parseStoreRef(builder, queueElement, channel, false);
|
||||
boolean hasQueueRef = this.parseQueueRef(builder, queueElement);
|
||||
@@ -76,7 +76,7 @@ public class PointToPointChannelParser extends AbstractChannelParser {
|
||||
element);
|
||||
}
|
||||
}
|
||||
else if ((queueElement = DomUtils.getChildElementByTagName(element, "priority-queue")) != null) {
|
||||
else if ((queueElement = DomUtils.getChildElementByTagName(element, "priority-queue")) != null) { // NOSONAR
|
||||
builder = BeanDefinitionBuilder.genericBeanDefinition(PriorityChannel.class);
|
||||
boolean hasCapacity = this.parseQueueCapacity(builder, queueElement);
|
||||
String comparatorRef = queueElement.getAttribute("comparator");
|
||||
@@ -97,7 +97,7 @@ public class PointToPointChannelParser extends AbstractChannelParser {
|
||||
}
|
||||
|
||||
}
|
||||
else if ((queueElement = DomUtils.getChildElementByTagName(element, "rendezvous-queue")) != null) {
|
||||
else if ((queueElement = DomUtils.getChildElementByTagName(element, "rendezvous-queue")) != null) { // NOSONAR
|
||||
builder = BeanDefinitionBuilder.genericBeanDefinition(RendezvousChannel.class);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ import org.springframework.util.StringUtils;
|
||||
*
|
||||
* @author Mark Fisher
|
||||
* @author Iwein Fuld
|
||||
* @author Gary Russell
|
||||
*/
|
||||
public class SelectorChainParser extends AbstractSingleBeanDefinitionParser {
|
||||
|
||||
@@ -43,6 +44,7 @@ public class SelectorChainParser extends AbstractSingleBeanDefinitionParser {
|
||||
return MessageSelectorChain.class.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
|
||||
if (!StringUtils.hasText(element.getAttribute("id"))) {
|
||||
parserContext.getReaderContext().error("id is required", element);
|
||||
@@ -82,8 +84,7 @@ public class SelectorChainParser extends AbstractSingleBeanDefinitionParser {
|
||||
this.parseSelectorChain(nestedBuilder, (Element) child, parserContext);
|
||||
String nestedBeanName = BeanDefinitionReaderUtils.registerWithGeneratedName(nestedBuilder.getBeanDefinition(),
|
||||
parserContext.getRegistry());
|
||||
RuntimeBeanReference built = new RuntimeBeanReference(nestedBeanName);
|
||||
return built;
|
||||
return new RuntimeBeanReference(nestedBeanName);
|
||||
}
|
||||
|
||||
private RuntimeBeanReference buildMethodInvokingSelector(ParserContext parserContext, String ref, String method) {
|
||||
|
||||
@@ -59,7 +59,7 @@ public final class StandardIntegrationFlowContext implements IntegrationFlowCont
|
||||
|
||||
private BeanDefinitionRegistry beanDefinitionRegistry;
|
||||
|
||||
private StandardIntegrationFlowContext() {
|
||||
StandardIntegrationFlowContext() {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -137,7 +137,7 @@ public class RecipientListRouter extends AbstractMessageRouter implements Recipi
|
||||
addRecipient(channelName, selectorExpression, this.recipients);
|
||||
}
|
||||
|
||||
private void addRecipient(String channelName, String selectorExpression, Queue<Recipient> recipients) {
|
||||
private void addRecipient(String channelName, String selectorExpression, Queue<Recipient> recipientsToAdd) {
|
||||
Assert.hasText(channelName, "'channelName' must not be empty.");
|
||||
Assert.hasText(selectorExpression, "'selectorExpression' must not be empty.");
|
||||
ExpressionEvaluatingSelector expressionEvaluatingSelector =
|
||||
@@ -145,7 +145,7 @@ public class RecipientListRouter extends AbstractMessageRouter implements Recipi
|
||||
expressionEvaluatingSelector.setBeanFactory(getBeanFactory());
|
||||
Recipient recipient = new Recipient(channelName, expressionEvaluatingSelector);
|
||||
setupRecipient(recipient);
|
||||
recipients.add(recipient);
|
||||
recipientsToAdd.add(recipient);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -158,11 +158,11 @@ public class RecipientListRouter extends AbstractMessageRouter implements Recipi
|
||||
addRecipient(channelName, selector, this.recipients);
|
||||
}
|
||||
|
||||
private void addRecipient(String channelName, MessageSelector selector, Queue<Recipient> recipients) {
|
||||
private void addRecipient(String channelName, MessageSelector selector, Queue<Recipient> recipientsToAdd) {
|
||||
Assert.hasText(channelName, "'channelName' must not be empty.");
|
||||
Recipient recipient = new Recipient(channelName, selector);
|
||||
setupRecipient(recipient);
|
||||
recipients.add(recipient);
|
||||
recipientsToAdd.add(recipient);
|
||||
}
|
||||
|
||||
public void addRecipient(MessageChannel channel) {
|
||||
@@ -208,9 +208,9 @@ public class RecipientListRouter extends AbstractMessageRouter implements Recipi
|
||||
Recipient next = it.next();
|
||||
MessageSelector selector = next.getSelector();
|
||||
MessageChannel channel = next.getChannel();
|
||||
if (selector instanceof ExpressionEvaluatingSelector &&
|
||||
channel == targetChannel &&
|
||||
((ExpressionEvaluatingSelector) selector).getExpressionString().equals(selectorExpression)) {
|
||||
if (selector instanceof ExpressionEvaluatingSelector
|
||||
&& channel.equals(targetChannel)
|
||||
&& ((ExpressionEvaluatingSelector) selector).getExpressionString().equals(selectorExpression)) {
|
||||
it.remove();
|
||||
counter++;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public abstract class AbstractTransformer extends IntegrationObjectSupport imple
|
||||
return (result instanceof Message) ? (Message<?>) result
|
||||
: this.getMessageBuilderFactory().withPayload(result).copyHeaders(message.getHeaders()).build();
|
||||
}
|
||||
catch (MessageTransformationException e) {
|
||||
catch (MessageTransformationException e) { // NOSONAR - catch and throw
|
||||
throw e;
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
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;
|
||||
@@ -254,7 +255,8 @@ public class FeedEntryMessageSource extends AbstractMessageSource<SyndEntry> {
|
||||
}
|
||||
|
||||
|
||||
private static final class SyndEntryPublishedDateComparator implements Comparator<SyndEntry> {
|
||||
@SuppressWarnings("serial")
|
||||
private static final class SyndEntryPublishedDateComparator implements Comparator<SyndEntry>, Serializable {
|
||||
|
||||
SyndEntryPublishedDateComparator() {
|
||||
super();
|
||||
|
||||
@@ -920,20 +920,20 @@ public abstract class AbstractRemoteFileOutboundGateway<F> extends AbstractReply
|
||||
else {
|
||||
outputStream = new BufferedOutputStream(new FileOutputStream(tempFile));
|
||||
}
|
||||
if (replacing) {
|
||||
if (!localFile.delete() && this.logger.isWarnEnabled()) {
|
||||
this.logger.warn("Failed to delete " + localFile);
|
||||
}
|
||||
if (replacing && !localFile.delete() && this.logger.isWarnEnabled()) {
|
||||
this.logger.warn("Failed to delete " + localFile);
|
||||
}
|
||||
try {
|
||||
session.read(remoteFilePath, outputStream);
|
||||
}
|
||||
catch (Exception e) {
|
||||
/* Some operation systems acquire exclusive file-lock during file processing
|
||||
and the file can't be deleted without closing streams before.
|
||||
and the file can't be deleted without closing streams before.
|
||||
*/
|
||||
outputStream.close();
|
||||
tempFile.delete();
|
||||
if (!tempFile.delete() && this.logger.isWarnEnabled()) {
|
||||
this.logger.warn("Failed to delete tempFile " + tempFile);
|
||||
}
|
||||
|
||||
if (e instanceof RuntimeException) {
|
||||
throw (RuntimeException) e;
|
||||
@@ -953,11 +953,10 @@ public abstract class AbstractRemoteFileOutboundGateway<F> extends AbstractReply
|
||||
if (!appending && !tempFile.renameTo(localFile)) {
|
||||
throw new MessagingException("Failed to rename local file");
|
||||
}
|
||||
if (this.options.contains(Option.PRESERVE_TIMESTAMP)
|
||||
|| FileExistsMode.REPLACE_IF_MODIFIED.equals(existsMode)) {
|
||||
if (!localFile.setLastModified(getModified(fileInfo)) && this.logger.isWarnEnabled()) {
|
||||
logger.warn("Failed to set lastModified on " + localFile);
|
||||
}
|
||||
if ((this.options.contains(Option.PRESERVE_TIMESTAMP)
|
||||
|| FileExistsMode.REPLACE_IF_MODIFIED.equals(existsMode))
|
||||
&& (!localFile.setLastModified(getModified(fileInfo)) && this.logger.isWarnEnabled())) {
|
||||
logger.warn("Failed to set lastModified on " + localFile);
|
||||
}
|
||||
if (this.options.contains(Option.DELETE)) {
|
||||
boolean result = session.remove(remoteFilePath);
|
||||
|
||||
@@ -190,32 +190,14 @@ public abstract class AbstractInboundFileSynchronizingMessageSource<F>
|
||||
}
|
||||
}
|
||||
this.fileSource.setDirectory(this.localDirectory);
|
||||
if (this.localFileListFilter == null) {
|
||||
this.localFileListFilter =
|
||||
new FileSystemPersistentAcceptOnceFileListFilter(new SimpleMetadataStore(), getComponentName());
|
||||
}
|
||||
FileListFilter<File> filter = buildFilter();
|
||||
if (this.scannerExplicitlySet) {
|
||||
Assert.state(!this.fileSource.isUseWatchService(),
|
||||
"'useWatchService' and 'scanner' are mutually exclusive.");
|
||||
this.fileSource.getScanner()
|
||||
.setFilter(filter);
|
||||
}
|
||||
else if (!this.fileSource.isUseWatchService()) {
|
||||
DirectoryScanner directoryScanner = new DefaultDirectoryScanner();
|
||||
directoryScanner.setFilter(filter);
|
||||
this.fileSource.setScanner(directoryScanner);
|
||||
}
|
||||
else {
|
||||
this.fileSource.setFilter(filter);
|
||||
}
|
||||
initFiltersAndScanner();
|
||||
if (this.getBeanFactory() != null) {
|
||||
this.fileSource.setBeanFactory(this.getBeanFactory());
|
||||
}
|
||||
this.fileSource.afterPropertiesSet();
|
||||
this.synchronizer.afterPropertiesSet();
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
catch (RuntimeException e) { // NOSONAR catch and throw
|
||||
throw e;
|
||||
}
|
||||
catch (Exception e) {
|
||||
@@ -223,6 +205,28 @@ public abstract class AbstractInboundFileSynchronizingMessageSource<F>
|
||||
}
|
||||
}
|
||||
|
||||
private void initFiltersAndScanner() {
|
||||
if (this.localFileListFilter == null) {
|
||||
this.localFileListFilter =
|
||||
new FileSystemPersistentAcceptOnceFileListFilter(new SimpleMetadataStore(), getComponentName());
|
||||
}
|
||||
FileListFilter<File> filter = buildFilter();
|
||||
if (this.scannerExplicitlySet) {
|
||||
Assert.state(!this.fileSource.isUseWatchService(),
|
||||
"'useWatchService' and 'scanner' are mutually exclusive.");
|
||||
this.fileSource.getScanner()
|
||||
.setFilter(filter);
|
||||
}
|
||||
else if (!this.fileSource.isUseWatchService()) {
|
||||
DirectoryScanner directoryScanner = new DefaultDirectoryScanner();
|
||||
directoryScanner.setFilter(filter);
|
||||
this.fileSource.setScanner(directoryScanner);
|
||||
}
|
||||
else {
|
||||
this.fileSource.setFilter(filter);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
this.running = true;
|
||||
|
||||
@@ -205,7 +205,7 @@ public class FailoverClientConnectionFactory extends AbstractClientConnectionFac
|
||||
+ ", trying another");
|
||||
}
|
||||
if (!this.factoryIterator.hasNext()) {
|
||||
if (retried && lastFactoryToTry == null || lastFactoryToTry == nextFactory) {
|
||||
if (retried && (lastFactoryToTry == null || lastFactoryToTry.equals(nextFactory))) {
|
||||
/*
|
||||
* We've tried every factory including the
|
||||
* one the current connection was on.
|
||||
@@ -249,7 +249,7 @@ public class FailoverClientConnectionFactory extends AbstractClientConnectionFac
|
||||
success = true;
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
if (retried && lastFactoryTried == lastFactoryToTry) {
|
||||
if (retried && lastFactoryTried.equals(lastFactoryToTry)) {
|
||||
logger.error("All connection factories exhausted", e);
|
||||
this.open = false;
|
||||
throw e;
|
||||
|
||||
@@ -170,7 +170,7 @@ public class TcpNetServerConnectionFactory extends AbstractServerConnectionFacto
|
||||
try {
|
||||
socket.close();
|
||||
}
|
||||
catch (@SuppressWarnings("unused") IOException e1) {
|
||||
catch (@SuppressWarnings("unused") IOException e1) { // NOSONAR - exception as flow control
|
||||
// empty
|
||||
}
|
||||
}
|
||||
|
||||
@@ -444,9 +444,6 @@ public class TcpNioConnection extends TcpConnectionSupport {
|
||||
}
|
||||
sendToPipe(this.rawBuffer);
|
||||
}
|
||||
catch (RejectedExecutionException e) {
|
||||
throw e;
|
||||
}
|
||||
catch (IOException e) {
|
||||
publishConnectionExceptionEvent(e);
|
||||
throw e;
|
||||
@@ -508,9 +505,6 @@ public class TcpNioConnection extends TcpConnectionSupport {
|
||||
}
|
||||
closeConnection(true);
|
||||
}
|
||||
catch (RejectedExecutionException e) {
|
||||
throw e;
|
||||
}
|
||||
catch (Exception e) {
|
||||
logger.error("Exception on Read " +
|
||||
getConnectionId() + " " +
|
||||
|
||||
@@ -72,8 +72,8 @@ public class ByteArrayCrLfSerializer extends AbstractPooledBufferByteArraySerial
|
||||
}
|
||||
return n - 1; // trim \r
|
||||
}
|
||||
catch (SoftEndOfStreamException e) {
|
||||
throw e;
|
||||
catch (SoftEndOfStreamException e) { // NOSONAR catch and throw
|
||||
throw e; // it's an IO exception and we don't want an event for this
|
||||
}
|
||||
catch (IOException e) {
|
||||
publishEvent(e, buffer, n);
|
||||
|
||||
@@ -277,8 +277,8 @@ public class ByteArrayLengthHeaderSerializer extends AbstractByteArraySerializer
|
||||
}
|
||||
return messageLength;
|
||||
}
|
||||
catch (SoftEndOfStreamException e) {
|
||||
throw e;
|
||||
catch (SoftEndOfStreamException e) { // NOSONAR catch and throw
|
||||
throw e; // it's an IO exception and we don't want an event for this
|
||||
}
|
||||
catch (IOException e) {
|
||||
publishEvent(e, lengthPart, -1);
|
||||
|
||||
@@ -102,8 +102,8 @@ public class ByteArrayRawSerializer extends AbstractPooledBufferByteArraySeriali
|
||||
}
|
||||
return copyToSizedArray(buffer, n);
|
||||
}
|
||||
catch (SoftEndOfStreamException e) {
|
||||
throw e;
|
||||
catch (SoftEndOfStreamException e) { // NOSONAR catch and throw
|
||||
throw e; // it's an IO exception and we don't want an event for this
|
||||
}
|
||||
catch (IOException e) {
|
||||
publishEvent(e, buffer, n);
|
||||
|
||||
@@ -68,8 +68,8 @@ public class ByteArraySingleTerminatorSerializer extends AbstractPooledBufferByt
|
||||
}
|
||||
return copyToSizedArray(buffer, n);
|
||||
}
|
||||
catch (SoftEndOfStreamException e) {
|
||||
throw e;
|
||||
catch (SoftEndOfStreamException e) { // NOSONAR catch and throw
|
||||
throw e; // it's an IO exception and we don't want an event for this
|
||||
}
|
||||
catch (IOException e) {
|
||||
publishEvent(e, buffer, n);
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.springframework.jdbc.core.namedparam.SqlParameterSource;
|
||||
* reference bean properties in its input.
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Gary Russell
|
||||
* @since 2.0
|
||||
*/
|
||||
public class BeanPropertySqlParameterSourceFactory implements SqlParameterSourceFactory {
|
||||
@@ -51,8 +52,7 @@ public class BeanPropertySqlParameterSourceFactory implements SqlParameterSource
|
||||
|
||||
@Override
|
||||
public SqlParameterSource createParameterSource(Object input) {
|
||||
SqlParameterSource toReturn = new StaticBeanPropertySqlParameterSource(input, this.staticParameters);
|
||||
return toReturn;
|
||||
return new StaticBeanPropertySqlParameterSource(input, this.staticParameters);
|
||||
}
|
||||
|
||||
private static final class StaticBeanPropertySqlParameterSource extends AbstractSqlParameterSource implements
|
||||
|
||||
@@ -227,7 +227,7 @@ public class ExpressionEvaluatingSqlParameterSourceFactory extends AbstractExpre
|
||||
public boolean hasValue(String paramName) {
|
||||
try {
|
||||
Object value = doGetValue(paramName, true);
|
||||
if (value == ERROR) {
|
||||
if (value.equals(ERROR)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
public class DefaultJmsHeaderMapper extends JmsHeaderMapper {
|
||||
|
||||
private static List<Class<?>> SUPPORTED_PROPERTY_TYPES = Arrays.asList(new Class<?>[] {
|
||||
private static final List<Class<?>> SUPPORTED_PROPERTY_TYPES = Arrays.asList(new Class<?>[] {
|
||||
Boolean.class, Byte.class, Double.class, Float.class, Integer.class, Long.class, Short.class, String.class });
|
||||
|
||||
|
||||
|
||||
@@ -1036,7 +1036,7 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler imp
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
catch (JMSException e) {
|
||||
catch (JMSException e) { // NOSONAR - exception as flow control
|
||||
exception = e;
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Connection lost waiting for reply, retrying: " + e.getMessage());
|
||||
@@ -1047,7 +1047,7 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler imp
|
||||
consumerSession = createSession(consumerConnection);
|
||||
break;
|
||||
}
|
||||
catch (JMSException ee) {
|
||||
catch (JMSException ee) { // NOSONAR - exception as flow control
|
||||
exception = ee;
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Could not reconnect, retrying: " + ee.getMessage());
|
||||
@@ -1073,7 +1073,7 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler imp
|
||||
}
|
||||
}
|
||||
finally {
|
||||
if (consumerSession != session) {
|
||||
if (!consumerSession.equals(session)) {
|
||||
JmsUtils.closeSession(consumerSession);
|
||||
JmsUtils.closeConnection(consumerConnection);
|
||||
}
|
||||
|
||||
@@ -47,8 +47,7 @@ public class BeanPropertyParameterSourceFactory implements ParameterSourceFactor
|
||||
|
||||
@Override
|
||||
public ParameterSource createParameterSource(Object input) {
|
||||
ParameterSource toReturn = new StaticBeanPropertyParameterSource(input, this.staticParameters);
|
||||
return toReturn;
|
||||
return new StaticBeanPropertyParameterSource(input, this.staticParameters);
|
||||
}
|
||||
|
||||
private static final class StaticBeanPropertyParameterSource implements
|
||||
|
||||
@@ -319,7 +319,8 @@ public class RedisQueueInboundGateway extends MessagingGatewaySupport implements
|
||||
@Override
|
||||
protected void doStop() {
|
||||
super.doStop();
|
||||
this.active = this.listening = false;
|
||||
this.active = false;
|
||||
this.listening = false;
|
||||
}
|
||||
|
||||
public boolean isListening() {
|
||||
|
||||
@@ -239,7 +239,8 @@ public abstract class AbstractStompSessionManager implements StompSessionManager
|
||||
|
||||
private void scheduleReconnect(Throwable e) {
|
||||
this.epoch.incrementAndGet();
|
||||
this.connecting = this.connected = false;
|
||||
this.connecting = false;
|
||||
this.connected = false;
|
||||
if (e != null) {
|
||||
this.logger.error("STOMP connect error for " + this, e);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ public final class SyslogHeaders {
|
||||
super();
|
||||
}
|
||||
|
||||
public static String PREFIX = "syslog_";
|
||||
public static final String PREFIX = "syslog_";
|
||||
|
||||
public static final String FACILITY = PREFIX + SyslogToMapTransformer.FACILITY;
|
||||
|
||||
|
||||
@@ -106,9 +106,10 @@ public class RFC6587SyslogDeserializer implements Deserializer<Map<String, ?>> {
|
||||
|
||||
private int calculateLength(DataInputStream stream, int peek) throws IOException {
|
||||
int length = peek & 0xf;
|
||||
int c;
|
||||
while (isDigit((c = stream.read()))) {
|
||||
int c = stream.read();
|
||||
while (isDigit(c)) {
|
||||
length = length * 10 + (c & 0xf);
|
||||
c = stream.read();
|
||||
}
|
||||
return length;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.integration.test.util;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.DatagramSocket;
|
||||
import java.net.InetAddress;
|
||||
import java.net.ServerSocket;
|
||||
@@ -112,7 +113,8 @@ public final class SocketUtils {
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception e) {
|
||||
catch (@SuppressWarnings("unused") IOException e) {
|
||||
// empty
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,7 +175,11 @@ public final class SocketUtils {
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception e) {
|
||||
catch (@SuppressWarnings("unused") IOException e) {
|
||||
// empty
|
||||
}
|
||||
catch (@SuppressWarnings("unused") InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user