INT-3632: Sonar Improvements
JIRA: https://jira.spring.io/browse/INT-3632 - Use Map.entrySet() - Double check locking only works when the field(s) are volatile - Remove unnecessary instanceof tests
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
@@ -16,6 +16,7 @@ package org.springframework.integration.aggregator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
@@ -41,6 +42,7 @@ import org.springframework.util.Assert;
|
||||
* @author Alexander Peters
|
||||
* @author Mark Fisher
|
||||
* @author Dave Syer
|
||||
* @author Gary Russell
|
||||
* @since 2.0
|
||||
*/
|
||||
public abstract class AbstractAggregatingMessageGroupProcessor implements MessageGroupProcessor,
|
||||
@@ -84,13 +86,13 @@ public abstract class AbstractAggregatingMessageGroupProcessor implements Messag
|
||||
Map<String, Object> aggregatedHeaders = new HashMap<String, Object>();
|
||||
Set<String> conflictKeys = new HashSet<String>();
|
||||
for (Message<?> message : group.getMessages()) {
|
||||
MessageHeaders currentHeaders = message.getHeaders();
|
||||
for (String key : currentHeaders.keySet()) {
|
||||
for (Entry<String, Object> entry : message.getHeaders().entrySet()) {
|
||||
String key = entry.getKey();
|
||||
if (MessageHeaders.ID.equals(key) || MessageHeaders.TIMESTAMP.equals(key)
|
||||
|| IntegrationMessageHeaderAccessor.SEQUENCE_SIZE.equals(key) || IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER.equals(key)) {
|
||||
continue;
|
||||
}
|
||||
Object value = currentHeaders.get(key);
|
||||
Object value = entry.getValue();
|
||||
if (!aggregatedHeaders.containsKey(key)) {
|
||||
aggregatedHeaders.put(key, value);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,7 +21,6 @@ import java.lang.reflect.Method;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.BeanFactoryAware;
|
||||
import org.springframework.integration.handler.MessageProcessor;
|
||||
import org.springframework.integration.handler.MethodInvokingMessageProcessor;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -32,10 +31,11 @@ import org.springframework.util.Assert;
|
||||
* @author Marius Bogoevici
|
||||
* @author Dave Syer
|
||||
* @author Artem Bilan
|
||||
* @author Gary Russell
|
||||
*/
|
||||
public class MethodInvokingCorrelationStrategy implements CorrelationStrategy, BeanFactoryAware {
|
||||
|
||||
private final MessageProcessor<?> processor;
|
||||
private final MethodInvokingMessageProcessor<?> processor;
|
||||
|
||||
public MethodInvokingCorrelationStrategy(Object object, String methodName) {
|
||||
this.processor = new MethodInvokingMessageProcessor<Object>(object, methodName, true);
|
||||
@@ -50,8 +50,8 @@ public class MethodInvokingCorrelationStrategy implements CorrelationStrategy, B
|
||||
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
|
||||
if (beanFactory != null && this.processor instanceof BeanFactoryAware) {
|
||||
((BeanFactoryAware) this.processor).setBeanFactory(beanFactory);
|
||||
if (beanFactory != null) {
|
||||
this.processor.setBeanFactory(beanFactory);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,4 +59,5 @@ public class MethodInvokingCorrelationStrategy implements CorrelationStrategy, B
|
||||
public Object getCorrelationKey(Message<?> message) {
|
||||
return processor.processMessage(message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014 the original author or authors.
|
||||
* Copyright 2014-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,7 +21,6 @@ import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.factory.BeanNameAware;
|
||||
import org.springframework.integration.support.context.NamedComponent;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageDeliveryException;
|
||||
import org.springframework.messaging.MessageHandler;
|
||||
import org.springframework.messaging.MessagingException;
|
||||
import org.springframework.messaging.SubscribableChannel;
|
||||
@@ -70,16 +69,14 @@ public final class FixedSubscriberChannel implements SubscribableChannel, BeanNa
|
||||
this.handler.handleMessage(message);
|
||||
return true;
|
||||
}
|
||||
catch (Exception e) {
|
||||
RuntimeException runtimeException = (e instanceof RuntimeException)
|
||||
? (RuntimeException) e
|
||||
: new MessageDeliveryException(message,
|
||||
this.getComponentName() + " failed to deliver Message.", e);
|
||||
catch (RuntimeException e) {
|
||||
if (e instanceof MessagingException &&
|
||||
((MessagingException) e).getFailedMessage() == null) {
|
||||
runtimeException = new MessagingException(message, e);
|
||||
throw new MessagingException(message, e);
|
||||
}
|
||||
else {
|
||||
throw e;
|
||||
}
|
||||
throw runtimeException;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -70,7 +70,7 @@ final class GlobalChannelInterceptorProcessor implements BeanFactoryAware, Smart
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
|
||||
Assert.isInstanceOf(ListableBeanFactory.class, beanFactory);
|
||||
this.beanFactory = (ListableBeanFactory) beanFactory;
|
||||
this.beanFactory = (ListableBeanFactory) beanFactory;//NOSONAR (inconsistent sync)
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014 the original author or authors.
|
||||
* Copyright 2014-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -37,18 +37,19 @@ import org.springframework.util.PatternMatchUtils;
|
||||
* to {@link MessageHandler}s mapped by their {@code endpoint beanName}.
|
||||
*
|
||||
* @author Artem Bilan
|
||||
* @author Gary Russell
|
||||
* @since 4.1
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
class IdempotentReceiverAutoProxyCreator extends AbstractAutoProxyCreator {
|
||||
|
||||
private List<Map<String, String>> idempotentEndpointsMapping;
|
||||
private volatile List<Map<String, String>> idempotentEndpointsMapping;
|
||||
|
||||
private Map<String, List<String>> idempotentEndpoints;
|
||||
private volatile Map<String, List<String>> idempotentEndpoints; // double check locking requires volatile
|
||||
|
||||
public void setIdempotentEndpointsMapping(List<Map<String, String>> idempotentEndpointsMapping) {
|
||||
Assert.notEmpty(idempotentEndpointsMapping);
|
||||
this.idempotentEndpointsMapping = idempotentEndpointsMapping;
|
||||
this.idempotentEndpointsMapping = idempotentEndpointsMapping;//NOSONAR (inconsistent sync)
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -82,7 +83,7 @@ class IdempotentReceiverAutoProxyCreator extends AbstractAutoProxyCreator {
|
||||
}
|
||||
|
||||
private void initIdempotentEndpointsIfNecessary() {
|
||||
if (this.idempotentEndpoints == null) {
|
||||
if (this.idempotentEndpoints == null) {//NOSONAR (inconsistent sync)
|
||||
synchronized (this) {
|
||||
if (this.idempotentEndpoints == null) {
|
||||
this.idempotentEndpoints = new LinkedHashMap<String, List<String>>();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
@@ -300,8 +300,7 @@ public abstract class IntegrationNamespaceUtils {
|
||||
String ref = element.getAttribute(REF_ATTRIBUTE);
|
||||
if (StringUtils.hasText(ref) && innerComponentDefinition != null) {
|
||||
parserContext.getReaderContext().error(
|
||||
"Ambiguous definition. Inner bean " + (innerComponentDefinition == null ? innerComponentDefinition
|
||||
: innerComponentDefinition.getBeanDefinition().getBeanClassName())
|
||||
"Ambiguous definition. Inner bean " + (innerComponentDefinition.getBeanDefinition().getBeanClassName())
|
||||
+ " declaration and \"ref\" " + ref + " are not allowed together on element " +
|
||||
IntegrationNamespaceUtils.createElementDescription(element) + ".", parserContext.extractSource(element));
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ public class UnicastingDispatcher extends AbstractDispatcher {
|
||||
if (allExceptions != null && allExceptions.size() == 1) {
|
||||
throw allExceptions.get(0);
|
||||
}
|
||||
throw new AggregateMessageDeliveryException(message,
|
||||
throw new AggregateMessageDeliveryException(message,//NOSONAR - false positive
|
||||
"All attempts to deliver Message to MessageHandlers failed.", allExceptions);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -116,10 +116,6 @@ public abstract class AbstractPollingEndpoint extends AbstractEndpoint implement
|
||||
return;
|
||||
}
|
||||
Assert.notNull(this.trigger, "Trigger is required");
|
||||
Executor providedExecutor = this.taskExecutor;
|
||||
if (providedExecutor != null) {
|
||||
this.taskExecutor = providedExecutor;
|
||||
}
|
||||
if (this.taskExecutor != null) {
|
||||
if (!(this.taskExecutor instanceof ErrorHandlingTaskExecutor)) {
|
||||
if (this.errorHandler == null) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -22,7 +22,6 @@ import org.springframework.integration.history.MessageHistory;
|
||||
import org.springframework.integration.history.TrackableComponent;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.messaging.MessageDeliveryException;
|
||||
import org.springframework.messaging.MessagingException;
|
||||
import org.springframework.messaging.support.ErrorMessage;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -33,6 +32,7 @@ import org.springframework.util.Assert;
|
||||
*
|
||||
* @author Mark Fisher
|
||||
* @author Artem Bilan
|
||||
* @author Gary Russell
|
||||
*/
|
||||
public abstract class MessageProducerSupport extends AbstractEndpoint implements MessageProducer, TrackableComponent {
|
||||
|
||||
@@ -100,15 +100,12 @@ public abstract class MessageProducerSupport extends AbstractEndpoint implements
|
||||
try {
|
||||
this.messagingTemplate.send(this.outputChannel, message);
|
||||
}
|
||||
catch (Exception e) {
|
||||
catch (RuntimeException e) {
|
||||
if (this.errorChannel != null) {
|
||||
this.messagingTemplate.send(this.errorChannel, new ErrorMessage(e));
|
||||
}
|
||||
else if (e instanceof RuntimeException) {
|
||||
throw (RuntimeException) e;
|
||||
}
|
||||
else {
|
||||
throw new MessageDeliveryException(message, "failed to send message", e);
|
||||
else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
@@ -203,7 +204,8 @@ class GatewayMethodInboundMessageMapper implements InboundMessageMapper<Object[]
|
||||
|
||||
|
||||
private void copyHeaders(Map<?, ?> argumentValue, Map<String, Object> headers) {
|
||||
for (Object key : argumentValue.keySet()) {
|
||||
for (Entry<?, ?> entry : argumentValue.entrySet()) {
|
||||
Object key = entry.getKey();
|
||||
if (!(key instanceof String)) {
|
||||
if (this.logger.isWarnEnabled()){
|
||||
this.logger.warn("Invalid header name [" + key +
|
||||
@@ -211,8 +213,7 @@ class GatewayMethodInboundMessageMapper implements InboundMessageMapper<Object[]
|
||||
}
|
||||
}
|
||||
else {
|
||||
Object value = argumentValue.get(key);
|
||||
headers.put((String) key, value);
|
||||
headers.put((String) key, entry.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014 the original author or authors.
|
||||
* Copyright 2014-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -41,6 +41,7 @@ import org.springframework.util.StringUtils;
|
||||
*
|
||||
* @author David Liu
|
||||
* @author Artem Bilan
|
||||
* @author Gary Russell
|
||||
* since 4.1
|
||||
*/
|
||||
public abstract class AbstractMessageProducingHandler extends AbstractMessageHandler
|
||||
@@ -48,9 +49,9 @@ public abstract class AbstractMessageProducingHandler extends AbstractMessageHan
|
||||
|
||||
protected final MessagingTemplate messagingTemplate = new MessagingTemplate();
|
||||
|
||||
private MessageChannel outputChannel;
|
||||
private volatile MessageChannel outputChannel;
|
||||
|
||||
private String outputChannelName;
|
||||
private volatile String outputChannelName;
|
||||
|
||||
/**
|
||||
* Set the timeout for sending reply Messages.
|
||||
@@ -67,7 +68,7 @@ public abstract class AbstractMessageProducingHandler extends AbstractMessageHan
|
||||
|
||||
public void setOutputChannelName(String outputChannelName) {
|
||||
Assert.hasText(outputChannelName, "'outputChannelName' must not be empty");
|
||||
this.outputChannelName = outputChannelName;
|
||||
this.outputChannelName = outputChannelName;//NOSONAR (inconsistent sync)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,7 +83,7 @@ public abstract class AbstractMessageProducingHandler extends AbstractMessageHan
|
||||
@Override
|
||||
protected void onInit() throws Exception {
|
||||
super.onInit();
|
||||
Assert.state(!(this.outputChannelName != null && this.outputChannel != null),
|
||||
Assert.state(!(this.outputChannelName != null && this.outputChannel != null),//NOSONAR (inconsistent sync)
|
||||
"'outputChannelName' and 'outputChannel' are mutually exclusive.");
|
||||
if (getBeanFactory() != null) {
|
||||
this.messagingTemplate.setBeanFactory(getBeanFactory());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -22,7 +22,6 @@ import org.springframework.beans.factory.BeanFactoryAware;
|
||||
import org.springframework.context.Lifecycle;
|
||||
import org.springframework.integration.annotation.ServiceActivator;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageHandlingException;
|
||||
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
@@ -87,15 +86,7 @@ public class ServiceActivatingHandler extends AbstractReplyProducingMessageHandl
|
||||
|
||||
@Override
|
||||
protected Object handleRequestMessage(Message<?> message) {
|
||||
try {
|
||||
return this.processor.processMessage(message);
|
||||
}
|
||||
catch (Exception e) {
|
||||
if (e instanceof RuntimeException) {
|
||||
throw (RuntimeException) e;
|
||||
}
|
||||
throw new MessageHandlingException(message, "failure occurred in '" + this + "'", e);
|
||||
}
|
||||
return this.processor.processMessage(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -23,6 +23,7 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
@@ -40,6 +41,7 @@ import org.springframework.util.StringUtils;
|
||||
* @author Mark Fisher
|
||||
* @author Oleg Zhurakousky
|
||||
* @author Stephane Nicoll
|
||||
* @author Gary Russell
|
||||
* @since 2.1
|
||||
*/
|
||||
public abstract class AbstractHeaderMapper<T> implements RequestReplyHeaderMapper<T> {
|
||||
@@ -195,8 +197,9 @@ public abstract class AbstractHeaderMapper<T> implements RequestReplyHeaderMappe
|
||||
}
|
||||
|
||||
private void populateUserDefinedHeaders(Map<String, Object> headers, T target) {
|
||||
for (String headerName : headers.keySet()) {
|
||||
Object value = headers.get(headerName);
|
||||
for (Entry<String, Object> entry : headers.entrySet()) {
|
||||
String headerName = entry.getKey();
|
||||
Object value = entry.getValue();
|
||||
if (value != null && !isMessageChannel(headerName, value)) {
|
||||
try {
|
||||
if (!headerName.startsWith(this.standardHeaderPrefix)) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -27,9 +27,10 @@ import org.springframework.util.CollectionUtils;
|
||||
/**
|
||||
* A Message Router that resolves the {@link MessageChannel} based on the
|
||||
* {@link Message Message's} payload type.
|
||||
*
|
||||
*
|
||||
* @author Mark Fisher
|
||||
* @author Oleg Zhurakousky
|
||||
* @author Gary Russell
|
||||
*/
|
||||
public class PayloadTypeRouter extends AbstractMappingMessageRouter {
|
||||
|
||||
@@ -102,7 +103,7 @@ public class PayloadTypeRouter extends AbstractMappingMessageRouter {
|
||||
}
|
||||
for (Class<?> iface : type.getInterfaces()) {
|
||||
if (iface.getName().equals(candidate)) {
|
||||
return (level % 2 == 1) ? level + 2 : level + 1;
|
||||
return (level % 2 != 0) ? level + 2 : level + 1;
|
||||
}
|
||||
// no match at this level, continue up the hierarchy
|
||||
for (Class<?> superInterface : iface.getInterfaces()) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,6 +18,7 @@ package org.springframework.integration.transformer;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
@@ -40,6 +41,7 @@ import org.springframework.messaging.MessagingException;
|
||||
* @author Mark Fisher
|
||||
* @author David Turanski
|
||||
* @author Artem Bilan
|
||||
* @author Gary Russell
|
||||
*/
|
||||
public class HeaderEnricher extends IntegrationObjectSupport implements Transformer, BeanNameAware, InitializingBean {
|
||||
|
||||
@@ -127,16 +129,16 @@ public class HeaderEnricher extends IntegrationObjectSupport implements Transfor
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private void addHeadersFromMessageProcessor(Message<?> message, Map<String, Object> headerMap) {
|
||||
if (this.messageProcessor != null) {
|
||||
Object result = this.messageProcessor.processMessage(message);
|
||||
if (result instanceof Map) {
|
||||
Map resultMap = (Map) result;
|
||||
for (Object key : resultMap.keySet()) {
|
||||
Map<?, ?> resultMap = (Map<?, ?>) result;
|
||||
for (Entry<?, ?> entry : resultMap.entrySet()) {
|
||||
Object key = entry.getKey();
|
||||
if (key instanceof String) {
|
||||
if (this.defaultOverwrite || headerMap.get(key) == null) {
|
||||
headerMap.put((String) key, resultMap.get(key));
|
||||
headerMap.put((String) key, entry.getValue());
|
||||
}
|
||||
}
|
||||
else if (logger.isDebugEnabled()) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,9 +19,10 @@ package org.springframework.integration.transformer;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.springframework.integration.support.json.JsonObjectMapperProvider;
|
||||
import org.springframework.integration.support.json.JsonObjectMapper;
|
||||
import org.springframework.integration.support.json.JsonObjectMapperProvider;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@@ -50,6 +51,7 @@ import org.springframework.util.StringUtils;
|
||||
*
|
||||
* @author Oleg Zhurakousky
|
||||
* @author Artem Bilan
|
||||
* @author Gary Russell
|
||||
* @since 2.0
|
||||
*/
|
||||
public class ObjectToMapTransformer extends AbstractPayloadTransformer<Object, Map<?,?>> {
|
||||
@@ -104,9 +106,8 @@ public class ObjectToMapTransformer extends AbstractPayloadTransformer<Object, M
|
||||
if (StringUtils.hasText(propertyPrefix)) {
|
||||
propertyPrefix = propertyPrefix + ".";
|
||||
}
|
||||
for (String key : inputMap.keySet()) {
|
||||
Object value = inputMap.get(key);
|
||||
this.doProcessElement(propertyPrefix + key, value, resultMap);
|
||||
for (Entry<String, Object> entry : inputMap.entrySet()) {
|
||||
this.doProcessElement(propertyPrefix + entry.getKey(), entry.getValue(), resultMap);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014 the original author or authors.
|
||||
* Copyright 2014-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -42,6 +42,7 @@ import org.springframework.util.Assert;
|
||||
* with the {@code path} as {@code key} and {@code 0} as initial {@code routingSlipIndex}.
|
||||
*
|
||||
* @author Artem Bilan
|
||||
* @author Gary Russell
|
||||
* @since 4.1
|
||||
*/
|
||||
public class RoutingSlipHeaderValueMessageProcessor
|
||||
@@ -74,17 +75,21 @@ public class RoutingSlipHeaderValueMessageProcessor
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
|
||||
Assert.notNull(beanFactory, "BeanFactory must not be null");
|
||||
this.beanFactory = beanFactory;
|
||||
this.evaluationContext = IntegrationContextUtils.getEvaluationContext(beanFactory);
|
||||
this.beanFactory = beanFactory;//NOSONAR (inconsistent sync)
|
||||
this.evaluationContext = IntegrationContextUtils.getEvaluationContext(beanFactory);//NOSONAR (inconsistent sync)
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<List<Object>, Integer> processMessage(Message<?> message) {
|
||||
if (this.routingSlip == null) {
|
||||
// use a local variable to avoid the second access to volatile field on the happy path
|
||||
Map<List<Object>, Integer> routingSlip = this.routingSlip;
|
||||
if (routingSlip == null) {
|
||||
synchronized (this) {
|
||||
if (this.routingSlip == null) {
|
||||
List<Object> routingSlipValues = new ArrayList<Object>(this.routingSlipPath.size());
|
||||
for (Object path : this.routingSlipPath) {
|
||||
routingSlip = this.routingSlip;
|
||||
if (routingSlip == null) {
|
||||
List<Object> routingSlipPath = this.routingSlipPath;
|
||||
List<Object> routingSlipValues = new ArrayList<Object>(routingSlipPath.size());
|
||||
for (Object path : routingSlipPath) {
|
||||
if (path instanceof String) {
|
||||
String entry = (String) path;
|
||||
if (this.beanFactory.containsBean(entry)) {
|
||||
@@ -108,10 +113,11 @@ public class RoutingSlipHeaderValueMessageProcessor
|
||||
}
|
||||
|
||||
}
|
||||
this.routingSlip = Collections.singletonMap(Collections.unmodifiableList(routingSlipValues), 0);
|
||||
routingSlip = Collections.singletonMap(Collections.unmodifiableList(routingSlipValues), 0);
|
||||
this.routingSlip = routingSlip;
|
||||
}
|
||||
}
|
||||
}
|
||||
return this.routingSlip;
|
||||
return routingSlip;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ public class FeedEntryMessageSource extends IntegrationObjectSupport implements
|
||||
this.lastTime = next.getPublishedDate().getTime();
|
||||
}
|
||||
else {
|
||||
this.lastTime += 1;
|
||||
this.lastTime += 1;//NOSONAR - single poller thread
|
||||
}
|
||||
this.metadataStore.put(this.metadataKey, this.lastTime + "");
|
||||
return next;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -528,7 +528,7 @@ public abstract class AbstractRemoteFileOutboundGateway<F> extends AbstractReply
|
||||
String path = this.doPut(this.getMessageBuilderFactory().withPayload(filteredFile)
|
||||
.copyHeaders(requestMessage.getHeaders())
|
||||
.build(), subDirectory);
|
||||
if (path == null) {
|
||||
if (path == null) {//NOSONAR - false positive
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("File " + filteredFile.getAbsolutePath() + " removed before transfer; ignoring");
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.springframework.integration.file.remote.synchronizer;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
@@ -167,13 +166,11 @@ public abstract class AbstractInboundFileSynchronizingMessageSource<F>
|
||||
@Override
|
||||
public void stop() {
|
||||
this.running = false;
|
||||
if (this.synchronizer instanceof Closeable) {
|
||||
try {
|
||||
((Closeable) this.synchronizer).close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
logger.error("Error closing synchronizer", e);
|
||||
}
|
||||
try {
|
||||
this.synchronizer.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
logger.error("Error closing synchronizer", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -48,7 +48,7 @@ public abstract class BigMGetTests {
|
||||
for (int i = 0; i < FILES; i++) {
|
||||
File f = new File("/tmp/bigmget/file" + i);
|
||||
f.createNewFile();
|
||||
FileOutputStream fos = new FileOutputStream(f);
|
||||
FileOutputStream fos = new FileOutputStream(f);//NOSONAR
|
||||
fos.write(buff);
|
||||
fos.close();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,19 +17,22 @@
|
||||
package org.springframework.integration.ftp.session;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
|
||||
import javax.net.ssl.KeyManager;
|
||||
import javax.net.ssl.TrustManager;
|
||||
|
||||
import org.apache.commons.net.ftp.FTPSClient;
|
||||
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* SessionFactory for FTPS.
|
||||
*
|
||||
*
|
||||
* @author Josh Long
|
||||
* @author Iwein Fuld
|
||||
* @author Mark Fisher
|
||||
* @author Gary Russell
|
||||
* @since 2.0
|
||||
*/
|
||||
public class DefaultFtpsSessionFactory extends AbstractFtpSessionFactory<FTPSClient> {
|
||||
@@ -80,11 +83,11 @@ public class DefaultFtpsSessionFactory extends AbstractFtpSessionFactory<FTPSCli
|
||||
}
|
||||
|
||||
public void setCipherSuites(String[] cipherSuites) {
|
||||
this.cipherSuites = cipherSuites;
|
||||
this.cipherSuites = Arrays.copyOf(cipherSuites, cipherSuites.length);
|
||||
}
|
||||
|
||||
public void setProtocols(String[] protocols) {
|
||||
this.protocols = protocols;
|
||||
this.protocols = Arrays.copyOf(protocols, protocols.length);
|
||||
}
|
||||
|
||||
public void setKeyManager(KeyManager keyManager) {
|
||||
@@ -116,17 +119,17 @@ public class DefaultFtpsSessionFactory extends AbstractFtpSessionFactory<FTPSCli
|
||||
return new FTPSClient(this.implicit);
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
||||
/*
|
||||
This catch block is technically not necessary but it allows users
|
||||
to use the older Commons Net 2.0 if necessary, which requires you
|
||||
to catch a NoSuchAlgorithmException.
|
||||
|
||||
/*
|
||||
This catch block is technically not necessary but it allows users
|
||||
to use the older Commons Net 2.0 if necessary, which requires you
|
||||
to catch a NoSuchAlgorithmException.
|
||||
*/
|
||||
|
||||
if (e instanceof RuntimeException) {
|
||||
|
||||
if (e instanceof RuntimeException) {//NOSONAR false positive
|
||||
throw (RuntimeException) e;
|
||||
}
|
||||
|
||||
|
||||
throw new RuntimeException("Failed to create FTPS client.", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,6 +20,7 @@ import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.springframework.http.HttpInputMessage;
|
||||
import org.springframework.http.HttpOutputMessage;
|
||||
@@ -42,6 +43,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
* <code>multipart/form-data</code> content in an HTTP request.
|
||||
*
|
||||
* @author Mark Fisher
|
||||
* @author Gary Russell
|
||||
* @since 2.0
|
||||
*/
|
||||
public class MultipartAwareFormHttpMessageConverter implements HttpMessageConverter<MultiValueMap<String, ?>> {
|
||||
@@ -112,11 +114,10 @@ public class MultipartAwareFormHttpMessageConverter implements HttpMessageConver
|
||||
private MultiValueMap<String, ?> readMultipart(MultipartHttpInputMessage multipartRequest) throws IOException {
|
||||
MultiValueMap<String, Object> resultMap = new LinkedMultiValueMap<String, Object>();
|
||||
Map<?, ?> parameterMap = multipartRequest.getParameterMap();
|
||||
for (Object key : parameterMap.keySet()) {
|
||||
resultMap.add((String) key, parameterMap.get(key));
|
||||
for (Entry<?, ?> entry : parameterMap.entrySet()) {
|
||||
resultMap.add((String) entry.getKey(), entry.getValue());
|
||||
}
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> entry : fileMap.entrySet()) {
|
||||
for (Map.Entry<String, MultipartFile> entry : multipartRequest.getFileMap().entrySet()) {
|
||||
MultipartFile multipartFile = entry.getValue();
|
||||
if (multipartFile.isEmpty()) {
|
||||
continue;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -61,7 +61,7 @@ public class SerializingHttpMessageConverter extends AbstractHttpMessageConverte
|
||||
@SuppressWarnings("rawtypes")
|
||||
public Serializable readInternal(Class clazz, HttpInputMessage inputMessage) throws IOException {
|
||||
try {
|
||||
return (Serializable) new ObjectInputStream(inputMessage.getBody()).readObject();
|
||||
return (Serializable) new ObjectInputStream(inputMessage.getBody()).readObject();//NOSONAR
|
||||
}
|
||||
catch (ClassNotFoundException e) {
|
||||
throw new IllegalArgumentException(e);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -24,6 +24,7 @@ import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import javax.xml.transform.Source;
|
||||
|
||||
@@ -556,11 +557,11 @@ public class HttpRequestExecutingMessageHandler extends AbstractReplyProducingMe
|
||||
|
||||
private MultiValueMap<Object, Object> convertToMultiValueMap(Map<?, ?> simpleMap) {
|
||||
LinkedMultiValueMap<Object, Object> multipartValueMap = new LinkedMultiValueMap<Object, Object>();
|
||||
for (Object key : simpleMap.keySet()) {
|
||||
Object value = simpleMap.get(key);
|
||||
for (Entry<?, ?> entry : simpleMap.entrySet()) {
|
||||
Object key = entry.getKey();
|
||||
Object value = entry.getValue();
|
||||
if (value instanceof Object[]) {
|
||||
Object[] valueArray = (Object[]) value;
|
||||
value = Arrays.asList(valueArray);
|
||||
value = Arrays.asList((Object[]) value);
|
||||
}
|
||||
if (value instanceof Collection) {
|
||||
multipartValueMap.put(key, new ArrayList<Object>((Collection<?>) value));
|
||||
@@ -577,8 +578,7 @@ public class HttpRequestExecutingMessageHandler extends AbstractReplyProducingMe
|
||||
* the Map to be multipart/form-data
|
||||
*/
|
||||
private boolean isMultipart(Map<String, ?> map) {
|
||||
for (String key : map.keySet()) {
|
||||
Object value = map.get(key);
|
||||
for (Object value : map.values()) {
|
||||
if (value != null) {
|
||||
if (value.getClass().isArray()) {
|
||||
value = CollectionUtils.arrayToList(value);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -33,6 +33,7 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.TimeZone;
|
||||
|
||||
@@ -308,7 +309,7 @@ public class DefaultHttpHeaderMapper implements HeaderMapper<HttpHeaders>, BeanF
|
||||
public void setOutboundHeaderNames(String[] outboundHeaderNames) {
|
||||
this.outboundHeaderNames = (outboundHeaderNames != null) ? outboundHeaderNames : new String[0];
|
||||
this.outboundHeaderNamesLower = new String[this.outboundHeaderNames.length];
|
||||
for (int i = 0; i < outboundHeaderNames.length; i++) {
|
||||
for (int i = 0; i < this.outboundHeaderNames.length; i++) {
|
||||
if (HTTP_REQUEST_HEADER_NAME_PATTERN.equals(this.outboundHeaderNames[i])
|
||||
|| HTTP_RESPONSE_HEADER_NAME_PATTERN.equals(this.outboundHeaderNames[i])) {
|
||||
this.outboundHeaderNamesLower[i] = this.outboundHeaderNames[i];
|
||||
@@ -335,7 +336,7 @@ public class DefaultHttpHeaderMapper implements HeaderMapper<HttpHeaders>, BeanF
|
||||
public void setInboundHeaderNames(String[] inboundHeaderNames) {
|
||||
this.inboundHeaderNames = (inboundHeaderNames != null) ? inboundHeaderNames : new String[0];
|
||||
this.inboundHeaderNamesLower = new String[this.inboundHeaderNames.length];
|
||||
for (int i = 0; i < inboundHeaderNames.length; i++) {
|
||||
for (int i = 0; i < this.inboundHeaderNames.length; i++) {
|
||||
if (HTTP_REQUEST_HEADER_NAME_PATTERN.equals(this.inboundHeaderNames[i])
|
||||
|| HTTP_RESPONSE_HEADER_NAME_PATTERN.equals(this.inboundHeaderNames[i])) {
|
||||
this.inboundHeaderNamesLower[i] = this.inboundHeaderNames[i];
|
||||
@@ -387,11 +388,11 @@ public class DefaultHttpHeaderMapper implements HeaderMapper<HttpHeaders>, BeanF
|
||||
logger.debug(MessageFormat.format("outboundHeaderNames={0}",
|
||||
CollectionUtils.arrayToList(outboundHeaderNames)));
|
||||
}
|
||||
Set<String> headerNames = headers.keySet();
|
||||
for (String name : headerNames) {
|
||||
for (Entry<String, Object> entry : headers.entrySet()) {
|
||||
String name = entry.getKey();
|
||||
String lowerName = name.toLowerCase();
|
||||
if (this.shouldMapOutboundHeader(lowerName)) {
|
||||
Object value = headers.get(name);
|
||||
Object value = entry.getValue();
|
||||
if (value != null) {
|
||||
if (!HTTP_REQUEST_HEADER_NAMES_LOWER.contains(lowerName) &&
|
||||
!HTTP_RESPONSE_HEADER_NAMES_LOWER.contains(lowerName) &&
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -77,7 +77,7 @@ public class TestingUtilities {
|
||||
int n = 0;
|
||||
while (serverConnectionFactory.isListening()) {
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
Thread.sleep(delay);
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,7 +21,7 @@ import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import javax.jms.Destination;
|
||||
import javax.jms.JMSException;
|
||||
@@ -139,11 +139,11 @@ public class DefaultJmsHeaderMapper implements JmsHeaderMapper {
|
||||
logger.info("failed to set JMSType, skipping", e);
|
||||
}
|
||||
}
|
||||
Set<String> headerNames = headers.keySet();
|
||||
for (String headerName : headerNames) {
|
||||
for (Entry<String, Object> entry : headers.entrySet()) {
|
||||
String headerName = entry.getKey();
|
||||
if (StringUtils.hasText(headerName) && !headerName.startsWith(JmsHeaders.PREFIX)
|
||||
&& jmsMessage.getObjectProperty(headerName) == null) {
|
||||
Object value = headers.get(headerName);
|
||||
Object value = entry.getValue();
|
||||
if (value != null && SUPPORTED_PROPERTY_TYPES.contains(value.getClass())) {
|
||||
try {
|
||||
String propertyName = this.fromHeaderName(headerName);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -126,7 +126,7 @@ public class JmsChannelParser extends AbstractChannelParser {
|
||||
String prefetch = element.getAttribute("prefetch");
|
||||
if (StringUtils.hasText(prefetch)) {
|
||||
if (containerType.startsWith("default")) {
|
||||
builder.addPropertyValue("maxMessagesPerTask", new Integer(prefetch));
|
||||
builder.addPropertyValue("maxMessagesPerTask", Integer.valueOf(prefetch));
|
||||
}
|
||||
}
|
||||
return builder;
|
||||
|
||||
@@ -76,7 +76,7 @@ public class ExponentialMovingAverage {
|
||||
sum = decay * sum + value;
|
||||
sumSquares = decay * sumSquares + value * value;
|
||||
weight = decay * weight + 1;
|
||||
count++;
|
||||
count++;//NOSONAR - false positive, we're synchronized
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -22,16 +22,11 @@ import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.mongodb.BasicDBList;
|
||||
import com.mongodb.BasicDBObject;
|
||||
import com.mongodb.DB;
|
||||
import com.mongodb.DBObject;
|
||||
import com.mongodb.MongoException;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.DirectFieldAccessor;
|
||||
import org.springframework.beans.factory.BeanClassLoaderAware;
|
||||
@@ -81,6 +76,12 @@ import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.mongodb.BasicDBList;
|
||||
import com.mongodb.BasicDBObject;
|
||||
import com.mongodb.DB;
|
||||
import com.mongodb.DBObject;
|
||||
import com.mongodb.MongoException;
|
||||
|
||||
|
||||
/**
|
||||
* An implementation of both the {@link MessageStore} and {@link MessageGroupStore}
|
||||
@@ -485,7 +486,7 @@ public class MongoDbMessageStore extends AbstractMessageGroupStore
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public <S> S read(Class<S> clazz, DBObject source) {
|
||||
if (!MessageWrapper.class.equals(clazz)) {
|
||||
return super.read(clazz, source);
|
||||
@@ -534,8 +535,9 @@ public class MongoDbMessageStore extends AbstractMessageGroupStore
|
||||
|
||||
private Map<String, Object> normalizeHeaders(Map<String, Object> headers) {
|
||||
Map<String, Object> normalizedHeaders = new HashMap<String, Object>();
|
||||
for (String headerName : headers.keySet()) {
|
||||
Object headerValue = headers.get(headerName);
|
||||
for (Entry<String, Object> entry : headers.entrySet()) {
|
||||
String headerName = entry.getKey();
|
||||
Object headerValue = entry.getValue();
|
||||
if (headerValue instanceof DBObject) {
|
||||
DBObject source = (DBObject) headerValue;
|
||||
try {
|
||||
|
||||
@@ -100,7 +100,7 @@ public abstract class AbstractMqttMessageHandler extends AbstractMessageHandler
|
||||
}
|
||||
|
||||
protected void incrementClientInstance() {
|
||||
this.clientInstance++;
|
||||
this.clientInstance++;//NOSONAR - false positive - called from synchronized block
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -107,7 +107,8 @@ public abstract class TestUtils {
|
||||
ConfigurableListableBeanFactory configurableListableBeanFactory = null;
|
||||
if (beanFactory instanceof ConfigurableListableBeanFactory) {
|
||||
configurableListableBeanFactory = (ConfigurableListableBeanFactory) beanFactory;
|
||||
} else if (beanFactory instanceof GenericApplicationContext) {
|
||||
}
|
||||
else if (beanFactory instanceof GenericApplicationContext) {
|
||||
configurableListableBeanFactory = ((GenericApplicationContext) beanFactory).getBeanFactory();
|
||||
}
|
||||
if (bean instanceof BeanNameAware) {
|
||||
@@ -124,7 +125,7 @@ public abstract class TestUtils {
|
||||
throw new FatalBeanException("failed to register bean with test context", e);
|
||||
}
|
||||
}
|
||||
configurableListableBeanFactory.registerSingleton(beanName, bean);
|
||||
configurableListableBeanFactory.registerSingleton(beanName, bean);//NOSONAR false positive
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,6 +18,7 @@ package org.springframework.integration.xml.transformer;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import javax.xml.transform.Result;
|
||||
import javax.xml.transform.Source;
|
||||
@@ -41,7 +42,6 @@ import org.springframework.integration.xml.result.ResultFactory;
|
||||
import org.springframework.integration.xml.source.DomSourceFactory;
|
||||
import org.springframework.integration.xml.source.SourceFactory;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageHeaders;
|
||||
import org.springframework.messaging.MessagingException;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
@@ -152,6 +152,7 @@ public class XsltPayloadTransformer extends AbstractXmlTransformer implements Be
|
||||
*
|
||||
* @param resultFactory The result factory.
|
||||
*/
|
||||
@Override
|
||||
public void setResultFactory(ResultFactory resultFactory) {
|
||||
super.setResultFactory(resultFactory);
|
||||
this.resultFactoryExplicitlySet = true;
|
||||
@@ -327,8 +328,9 @@ public class XsltPayloadTransformer extends AbstractXmlTransformer implements Be
|
||||
// process individual mappings
|
||||
Transformer transformer = this.templates.newTransformer();
|
||||
if (this.xslParameterMappings != null) {
|
||||
for (String parameterName : this.xslParameterMappings.keySet()) {
|
||||
Expression expression = this.xslParameterMappings.get(parameterName);
|
||||
for (Entry<String, Expression> entry : this.xslParameterMappings.entrySet()) {
|
||||
String parameterName = entry.getKey();
|
||||
Expression expression = entry.getValue();
|
||||
try {
|
||||
Object value = expression.getValue(this.evaluationContext, message);
|
||||
transformer.setParameter(parameterName, value);
|
||||
@@ -344,11 +346,11 @@ public class XsltPayloadTransformer extends AbstractXmlTransformer implements Be
|
||||
}
|
||||
}
|
||||
// process xslt-parameter-headers
|
||||
MessageHeaders headers = message.getHeaders();
|
||||
if (!ObjectUtils.isEmpty(this.xsltParamHeaders)) {
|
||||
for (String headerName : headers.keySet()) {
|
||||
for (Entry<String, Object> entry : message.getHeaders().entrySet()) {
|
||||
String headerName = entry.getKey();
|
||||
if (PatternMatchUtils.simpleMatch(this.xsltParamHeaders, headerName)) {
|
||||
transformer.setParameter(headerName, headers.get(headerName));
|
||||
transformer.setParameter(headerName, entry.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user