Sonar fixes
* exposing internal objects * boolean complexity * names, methods with _ * missing `default` in switch * lost stack trace * unnecessary null check before instanceof * unused parameter * Fix method name
This commit is contained in:
committed by
Artem Bilan
parent
9780a6c893
commit
ebbcb9df48
@@ -65,7 +65,7 @@ public class MessageGroupExpiredEvent extends IntegrationEvent {
|
||||
}
|
||||
|
||||
public Date getExpired() {
|
||||
return this.expired;
|
||||
return (Date) this.expired.clone();
|
||||
}
|
||||
|
||||
public boolean isDiscarded() {
|
||||
|
||||
@@ -66,7 +66,7 @@ public class GlobalChannelInterceptorWrapper implements Ordered {
|
||||
}
|
||||
|
||||
public String[] getPatterns() {
|
||||
return this.patterns;
|
||||
return this.patterns; // NOSONAR - expose internals
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -132,9 +132,13 @@ public class FilterFactoryBean extends AbstractStandardMessageHandlerFactoryBean
|
||||
@Override
|
||||
protected boolean canBeUsedDirect(AbstractMessageProducingHandler handler) {
|
||||
return handler instanceof MessageFilter
|
||||
|| (!(handler instanceof MessageSelector)
|
||||
&& this.discardChannel == null && this.throwExceptionOnRejection == null
|
||||
&& this.discardWithinAdvice == null);
|
||||
|| (!(handler instanceof MessageSelector) && noFilterAttributesProvided());
|
||||
}
|
||||
|
||||
private boolean noFilterAttributesProvided() {
|
||||
return this.discardChannel == null
|
||||
&& this.throwExceptionOnRejection == null
|
||||
&& this.discardWithinAdvice == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -152,7 +152,7 @@ public class RouterFactoryBean extends AbstractStandardMessageHandlerFactoryBean
|
||||
}
|
||||
|
||||
protected boolean noRouterAttributesProvided() {
|
||||
return this.channelMappings == null && this.defaultOutputChannel == null
|
||||
return this.channelMappings == null && this.defaultOutputChannel == null // NOSONAR boolean complexity
|
||||
&& getSendTimeout() == null && this.resolutionRequired == null && this.applySequence == null
|
||||
&& this.ignoreSendFailures == null;
|
||||
}
|
||||
|
||||
@@ -395,9 +395,12 @@ public abstract class AbstractMethodAnnotationPostProcessor<T extends Annotation
|
||||
String receiveTimeout = this.beanFactory.resolveEmbeddedValue(poller.receiveTimeout());
|
||||
|
||||
if (StringUtils.hasText(ref)) {
|
||||
Assert.state(!StringUtils.hasText(triggerRef) && !StringUtils.hasText(executorRef) &&
|
||||
!StringUtils.hasText(cron) && !StringUtils.hasText(fixedDelayValue) &&
|
||||
!StringUtils.hasText(fixedRateValue) && !StringUtils.hasText(maxMessagesPerPollValue),
|
||||
Assert.state(!StringUtils.hasText(triggerRef)
|
||||
&& !StringUtils.hasText(executorRef)
|
||||
&& !StringUtils.hasText(cron)
|
||||
&& !StringUtils.hasText(fixedDelayValue)
|
||||
&& !StringUtils.hasText(fixedRateValue)
|
||||
&& !StringUtils.hasText(maxMessagesPerPollValue), // NOSONAR boolean complexity
|
||||
"The '@Poller' 'ref' attribute is mutually exclusive with other attributes.");
|
||||
pollerMetadata = this.beanFactory.getBean(ref, PollerMetadata.class);
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ public class RouterAnnotationPostProcessor extends AbstractMethodAnnotationPostP
|
||||
String applySequence = MessagingAnnotationUtils.resolveAttribute(annotations, "applySequence", String.class);
|
||||
String ignoreSendFailures = MessagingAnnotationUtils.resolveAttribute(annotations, "ignoreSendFailures",
|
||||
String.class);
|
||||
return StringUtils.hasText(defaultOutputChannel) || !ObjectUtils.isEmpty(channelMappings)
|
||||
return StringUtils.hasText(defaultOutputChannel) || !ObjectUtils.isEmpty(channelMappings) // NOSONAR complexity
|
||||
|| StringUtils.hasText(prefix) || StringUtils.hasText(suffix) || StringUtils.hasText(resolutionRequired)
|
||||
|| StringUtils.hasText(applySequence) || StringUtils.hasText(ignoreSendFailures);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public abstract class AbstractInboundGatewayParser extends AbstractSimpleBeanDef
|
||||
|
||||
@Override
|
||||
protected boolean isEligibleAttribute(String attributeName) {
|
||||
return !attributeName.equals("name") && !attributeName.equals("request-channel")
|
||||
return !attributeName.equals("name") && !attributeName.equals("request-channel") // NOSONAR boolean complexity
|
||||
&& !attributeName.equals("error-channel")
|
||||
&& !attributeName.equals("reply-channel") && super.isEligibleAttribute(attributeName);
|
||||
}
|
||||
|
||||
@@ -65,16 +65,16 @@ public class DefaultInboundChannelAdapterParser extends AbstractPollingInboundCh
|
||||
boolean hasExpressionElement = expressionElement != null;
|
||||
boolean hasMethod = StringUtils.hasText(methodName);
|
||||
|
||||
if (!hasInnerDef && !hasRef && !hasExpression && !hasScriptElement && !hasExpressionElement) {
|
||||
if (!hasInnerDef && !hasRef && !hasExpression && !hasScriptElement && !hasExpressionElement) { // NOSONAR
|
||||
parserContext.getReaderContext().error(
|
||||
"Exactly one of the 'ref', 'expression', inner bean, <script> or <expression> is required.", element);
|
||||
"Exactly one of the 'ref', 'expression', inner bean, <script> or <expression> is required.", element);
|
||||
}
|
||||
|
||||
if (hasInnerDef) {
|
||||
if (hasRef || hasExpression) {
|
||||
parserContext.getReaderContext().error(
|
||||
"Neither 'ref' nor 'expression' are permitted when an inner bean (<bean/>) is configured on element " +
|
||||
IntegrationNamespaceUtils.createElementDescription(element) + ".", source);
|
||||
"Neither 'ref' nor 'expression' are permitted when an inner bean (<bean/>) is configured on "
|
||||
+ "element " + IntegrationNamespaceUtils.createElementDescription(element) + ".", source);
|
||||
return null;
|
||||
}
|
||||
if (hasMethod) {
|
||||
@@ -87,8 +87,9 @@ public class DefaultInboundChannelAdapterParser extends AbstractPollingInboundCh
|
||||
else if (hasScriptElement) {
|
||||
if (hasRef || hasMethod || hasExpression) {
|
||||
parserContext.getReaderContext().error(
|
||||
"Neither 'ref' and 'method' nor 'expression' are permitted when an inner script element is configured on element " +
|
||||
IntegrationNamespaceUtils.createElementDescription(element) + ".", source);
|
||||
"Neither 'ref' and 'method' nor 'expression' are permitted when an inner script element is "
|
||||
+ "configured on element "
|
||||
+ IntegrationNamespaceUtils.createElementDescription(element) + ".", source);
|
||||
return null;
|
||||
}
|
||||
BeanDefinition scriptBeanDefinition = parserContext.getDelegate().parseCustomElement(scriptElement);
|
||||
@@ -101,7 +102,8 @@ public class DefaultInboundChannelAdapterParser extends AbstractPollingInboundCh
|
||||
else if (hasExpression || hasExpressionElement) {
|
||||
if (hasRef || hasMethod) {
|
||||
parserContext.getReaderContext().error(
|
||||
"The 'ref' and 'method' attributes can't be used with 'expression' attribute or inner <expression>.", element);
|
||||
"The 'ref' and 'method' attributes can't be used with 'expression' attribute or inner "
|
||||
+ "<expression>.", element);
|
||||
return null;
|
||||
}
|
||||
if (hasExpression & hasExpressionElement) {
|
||||
@@ -124,9 +126,11 @@ public class DefaultInboundChannelAdapterParser extends AbstractPollingInboundCh
|
||||
return result;
|
||||
}
|
||||
|
||||
private BeanMetadataElement parseMethodInvokingSource(BeanMetadataElement targetObject, String methodName, Element element,
|
||||
ParserContext parserContext) {
|
||||
BeanDefinitionBuilder sourceBuilder = BeanDefinitionBuilder.genericBeanDefinition(MethodInvokingMessageSource.class);
|
||||
private BeanMetadataElement parseMethodInvokingSource(BeanMetadataElement targetObject, String methodName,
|
||||
Element element, ParserContext parserContext) {
|
||||
|
||||
BeanDefinitionBuilder sourceBuilder = BeanDefinitionBuilder
|
||||
.genericBeanDefinition(MethodInvokingMessageSource.class);
|
||||
sourceBuilder.addPropertyValue("object", targetObject);
|
||||
sourceBuilder.addPropertyValue("methodName", methodName);
|
||||
this.parseHeaderExpressions(sourceBuilder, element, parserContext);
|
||||
@@ -135,7 +139,9 @@ public class DefaultInboundChannelAdapterParser extends AbstractPollingInboundCh
|
||||
|
||||
private BeanMetadataElement parseExpression(String expressionString, Element expressionElement, Element element,
|
||||
ParserContext parserContext) {
|
||||
BeanDefinitionBuilder sourceBuilder = BeanDefinitionBuilder.genericBeanDefinition(ExpressionEvaluatingMessageSource.class);
|
||||
|
||||
BeanDefinitionBuilder sourceBuilder = BeanDefinitionBuilder
|
||||
.genericBeanDefinition(ExpressionEvaluatingMessageSource.class);
|
||||
|
||||
BeanDefinition expressionDef = null;
|
||||
|
||||
@@ -166,8 +172,9 @@ public class DefaultInboundChannelAdapterParser extends AbstractPollingInboundCh
|
||||
ManagedMap<String, Object> headerExpressions = new ManagedMap<String, Object>();
|
||||
for (Element headerElement : headerElements) {
|
||||
String headerName = headerElement.getAttribute("name");
|
||||
BeanDefinition expressionDef = IntegrationNamespaceUtils.createExpressionDefinitionFromValueOrExpression("value",
|
||||
"expression", parserContext, headerElement, true);
|
||||
BeanDefinition expressionDef = IntegrationNamespaceUtils
|
||||
.createExpressionDefinitionFromValueOrExpression("value",
|
||||
"expression", parserContext, headerElement, true);
|
||||
headerExpressions.put(headerName, expressionDef);
|
||||
}
|
||||
builder.addPropertyValue("headerExpressions", headerExpressions);
|
||||
|
||||
@@ -60,23 +60,24 @@ public class IdempotentReceiverInterceptorParser extends AbstractBeanDefinitionP
|
||||
|
||||
String endpoints = element.getAttribute("endpoint");
|
||||
|
||||
if (!hasSelector & !(hasKeyStrategy | hasKeyExpression)) {
|
||||
if (!hasSelector && !(hasKeyStrategy || hasKeyExpression)) {
|
||||
parserContext.getReaderContext().error("One of the 'selector', 'key-strategy' or 'key-expression' " +
|
||||
"attributes must be provided", source);
|
||||
}
|
||||
|
||||
if (hasSelector & (hasStore | hasKeyStrategy | hasKeyExpression | hasValueStrategy | hasValueExpression)) {
|
||||
if (hasSelector && (hasStore || hasKeyStrategy || hasKeyExpression || hasValueStrategy // NOSONAR complexity
|
||||
|| hasValueExpression)) {
|
||||
parserContext.getReaderContext().error("The 'selector' attribute is mutually exclusive with " +
|
||||
"'metadata-store', 'key-strategy', 'key-expression', 'value-strategy' " +
|
||||
"or 'value-expression'", source);
|
||||
}
|
||||
|
||||
if (hasKeyStrategy & hasKeyExpression) {
|
||||
if (hasKeyStrategy && hasKeyExpression) {
|
||||
parserContext.getReaderContext().error("The 'key-strategy' and 'key-expression' attributes " +
|
||||
"are mutually exclusive", source);
|
||||
}
|
||||
|
||||
if (hasValueStrategy & hasValueExpression) {
|
||||
if (hasValueStrategy && hasValueExpression) {
|
||||
parserContext.getReaderContext().error("The 'value-strategy' and 'value-expression' attributes " +
|
||||
"are mutually exclusive", source);
|
||||
}
|
||||
|
||||
@@ -58,7 +58,8 @@ public class AggregateMessageDeliveryException extends MessageDeliveryException
|
||||
@Override
|
||||
public String getMessage() {
|
||||
String baseMessage = super.getMessage();
|
||||
StringBuilder message = new StringBuilder(appendPeriodIfNecessary(baseMessage) + " Multiple causes:\n");
|
||||
StringBuilder message = new StringBuilder(appendPeriodIfNecessary(baseMessage))
|
||||
.append(" Multiple causes:\n");
|
||||
for (Exception exception : this.aggregatedExceptions) {
|
||||
message.append(" " + exception.getMessage() + "\n");
|
||||
}
|
||||
|
||||
@@ -3114,7 +3114,7 @@ public abstract class IntegrationFlowDefinition<B extends IntegrationFlowDefinit
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected final B _this() {
|
||||
protected final B _this() { // NOSONAR name
|
||||
return (B) this;
|
||||
}
|
||||
|
||||
|
||||
@@ -113,6 +113,10 @@ class IntegrationFlowLifecycleAdvice implements MethodInterceptor {
|
||||
result = this.delegate.getPhase();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -547,10 +547,10 @@ public class GatewayProxyFactoryBean extends AbstractEndpoint
|
||||
throw t;
|
||||
}
|
||||
}
|
||||
if (t instanceof RuntimeException
|
||||
if (t instanceof RuntimeException // NOSONAR boolean complexity
|
||||
&& !(t instanceof MessagingException)
|
||||
&& !(t instanceof UndeclaredThrowableException)
|
||||
&& !(t instanceof IllegalStateException && ("Unexpected exception thrown").equals(t.getMessage()))) {
|
||||
&& !(t instanceof IllegalStateException && "Unexpected exception thrown".equals(t.getMessage()))) {
|
||||
throw t;
|
||||
}
|
||||
t = t.getCause();
|
||||
|
||||
@@ -85,9 +85,9 @@ public class LoggingHandler extends AbstractMessageHandler {
|
||||
return Level.valueOf(level.toUpperCase());
|
||||
}
|
||||
catch (@SuppressWarnings("unused") IllegalArgumentException e) {
|
||||
throw new IllegalArgumentException("Invalid log level '" + level
|
||||
throw new IllegalArgumentException("Invalid log level '" + level // NOSONAR lost stack trace
|
||||
+ "'. The (case-insensitive) supported values are: "
|
||||
+ StringUtils.arrayToCommaDelimitedString(Level.values())); // NOSONAR lost stack trace
|
||||
+ StringUtils.arrayToCommaDelimitedString(Level.values()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ public abstract class AbstractHandleMessageAdvice extends IntegrationObjectSuppo
|
||||
Method method = invocation.getMethod();
|
||||
Object invocationThis = invocation.getThis();
|
||||
Object[] arguments = invocation.getArguments();
|
||||
boolean isMessageHandler = invocationThis != null && invocationThis instanceof MessageHandler;
|
||||
boolean isMessageHandler = invocationThis instanceof MessageHandler;
|
||||
boolean isMessageMethod = method.getName().equals("handleMessage")
|
||||
&& (arguments.length == 1 && arguments[0] instanceof Message);
|
||||
if (!isMessageHandler || !isMessageMethod) {
|
||||
@@ -59,6 +59,6 @@ public abstract class AbstractHandleMessageAdvice extends IntegrationObjectSuppo
|
||||
return doInvoke(invocation, message);
|
||||
}
|
||||
|
||||
protected abstract Object doInvoke(MethodInvocation invocation, Message<?> message) throws Throwable;
|
||||
protected abstract Object doInvoke(MethodInvocation invocation, Message<?> message) throws Throwable; // NOSONAR
|
||||
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public class JsonPropertyAccessor implements PropertyAccessor {
|
||||
|
||||
@Override
|
||||
public Class<?>[] getSpecificTargetClasses() {
|
||||
return SUPPORTED_CLASSES;
|
||||
return SUPPORTED_CLASSES; // NOSONAR - expose internals
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -48,7 +48,7 @@ public class MapBuilder<B extends MapBuilder<B, K, V>, K, V> {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected final B _this() {
|
||||
protected final B _this() { // NOSONAR name
|
||||
return (B) this;
|
||||
}
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ public class MutableMessage<T> implements Message<T>, Serializable {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj != null && obj instanceof MutableMessage<?>) {
|
||||
if (obj instanceof MutableMessage<?>) {
|
||||
MutableMessage<?> other = (MutableMessage<?>) obj;
|
||||
UUID thisId = this.headers.getId();
|
||||
UUID otherId = other.headers.getId();
|
||||
|
||||
@@ -21,7 +21,6 @@ import java.io.UncheckedIOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -260,7 +259,7 @@ public class EmbeddedJsonHeadersMessageMapper implements BytesMessageMapper {
|
||||
buffer.position(4);
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, Object> headers = this.objectMapper.readValue(bytes, buffer.position(), headersLen,
|
||||
HashMap.class);
|
||||
Map.class);
|
||||
|
||||
buffer.position(buffer.position() + headersLen);
|
||||
buffer.getInt();
|
||||
|
||||
@@ -41,7 +41,7 @@ import org.springframework.util.StringUtils;
|
||||
public class TransactionSynchronizationFactoryBean implements FactoryBean<DefaultTransactionSynchronizationFactory>,
|
||||
BeanFactoryAware {
|
||||
|
||||
private final SpelExpressionParser PARSER = new SpelExpressionParser();
|
||||
private static final SpelExpressionParser PARSER = new SpelExpressionParser();
|
||||
|
||||
private final AtomicInteger counter = new AtomicInteger();
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ public class BeanFactoryTypeConverter implements TypeConverter, BeanFactoryAware
|
||||
if (sourceType != null) {
|
||||
Class<?> sourceClass = sourceType.getType();
|
||||
Class<?> targetClass = targetType.getType();
|
||||
if ((sourceClass == MessageHeaders.class && targetClass == MessageHeaders.class) ||
|
||||
if ((sourceClass == MessageHeaders.class && targetClass == MessageHeaders.class) || // NOSONAR
|
||||
(sourceClass == MessageHistory.class && targetClass == MessageHistory.class) ||
|
||||
(sourceType.isAssignableTo(targetType) && ClassUtils.isPrimitiveArray(sourceClass))) {
|
||||
return value;
|
||||
|
||||
@@ -72,7 +72,7 @@ public final class MessagingAnnotationUtils {
|
||||
}
|
||||
|
||||
public static boolean hasValue(Object value) {
|
||||
return value != null && (!(value instanceof String) || (StringUtils.hasText((String) value)))
|
||||
return value != null && (!(value instanceof String) || (StringUtils.hasText((String) value))) // NOSONAR
|
||||
&& (!value.getClass().isArray() || ((Object[]) value).length > 0);
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ public final class MessagingAnnotationUtils {
|
||||
Annotation match = null;
|
||||
for (Annotation annotation : annotations) {
|
||||
Class<? extends Annotation> type = annotation.annotationType();
|
||||
if (type.equals(Payload.class)
|
||||
if (type.equals(Payload.class) // NOSONAR boolean complexity
|
||||
|| type.equals(Header.class)
|
||||
|| type.equals(Headers.class)
|
||||
|| (payloads && type.equals(Payloads.class))) {
|
||||
|
||||
@@ -41,7 +41,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
public class EmbeddedJsonHeadersMessageMapperTests {
|
||||
|
||||
@Test
|
||||
public void testEmbedAll() throws Exception {
|
||||
public void testEmbedAll() {
|
||||
EmbeddedJsonHeadersMessageMapper mapper = new EmbeddedJsonHeadersMessageMapper();
|
||||
GenericMessage<String> message = new GenericMessage<>("foo");
|
||||
assertThat(mapper.toMessage(mapper.fromMessage(message))).isEqualTo(message);
|
||||
@@ -92,7 +92,7 @@ public class EmbeddedJsonHeadersMessageMapperTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBytesEmbedSome() throws Exception {
|
||||
public void testBytesEmbedSome() {
|
||||
EmbeddedJsonHeadersMessageMapper mapper = new EmbeddedJsonHeadersMessageMapper("I*");
|
||||
GenericMessage<byte[]> message = new GenericMessage<>("foo".getBytes(), Collections.singletonMap("bar", "baz"));
|
||||
byte[] bytes = mapper.fromMessage(message);
|
||||
@@ -112,7 +112,7 @@ public class EmbeddedJsonHeadersMessageMapperTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBytesEmbedAllJson() throws Exception {
|
||||
public void testBytesEmbedAllJson() {
|
||||
EmbeddedJsonHeadersMessageMapper mapper = new EmbeddedJsonHeadersMessageMapper();
|
||||
mapper.setRawBytes(false);
|
||||
GenericMessage<byte[]> message = new GenericMessage<>("foo".getBytes());
|
||||
@@ -126,7 +126,7 @@ public class EmbeddedJsonHeadersMessageMapperTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBytesDecodeAll() throws Exception {
|
||||
public void testBytesDecodeAll() {
|
||||
EmbeddedJsonHeadersMessageMapper mapper = new EmbeddedJsonHeadersMessageMapper();
|
||||
GenericMessage<byte[]> message = new GenericMessage<>("foo".getBytes());
|
||||
Message<?> decoded = mapper.toMessage(mapper.fromMessage(message));
|
||||
|
||||
@@ -47,7 +47,7 @@ public class CrossOrigin {
|
||||
}
|
||||
|
||||
public String[] getOrigin() {
|
||||
return this.origin;
|
||||
return this.origin; // NOSONAR - expose internals
|
||||
}
|
||||
|
||||
public void setAllowedHeaders(String... allowedHeaders) {
|
||||
@@ -55,7 +55,7 @@ public class CrossOrigin {
|
||||
}
|
||||
|
||||
public String[] getAllowedHeaders() {
|
||||
return this.allowedHeaders;
|
||||
return this.allowedHeaders; // NOSONAR - expose internals
|
||||
}
|
||||
|
||||
public void setExposedHeaders(String... exposedHeaders) {
|
||||
@@ -63,7 +63,7 @@ public class CrossOrigin {
|
||||
}
|
||||
|
||||
public String[] getExposedHeaders() {
|
||||
return this.exposedHeaders;
|
||||
return this.exposedHeaders; // NOSONAR - expose internals
|
||||
}
|
||||
|
||||
public void setMethod(RequestMethod... method) {
|
||||
@@ -71,7 +71,7 @@ public class CrossOrigin {
|
||||
}
|
||||
|
||||
public RequestMethod[] getMethod() {
|
||||
return this.method;
|
||||
return this.method; // NOSONAR - expose internals
|
||||
}
|
||||
|
||||
public void setAllowCredentials(Boolean allowCredentials) {
|
||||
|
||||
@@ -61,7 +61,7 @@ public class RequestMapping {
|
||||
}
|
||||
|
||||
public String[] getPathPatterns() {
|
||||
return this.pathPatterns;
|
||||
return this.pathPatterns; // NOSONAR - expose internals
|
||||
}
|
||||
|
||||
public void setMethods(HttpMethod... supportedMethods) {
|
||||
@@ -70,7 +70,7 @@ public class RequestMapping {
|
||||
}
|
||||
|
||||
public HttpMethod[] getMethods() {
|
||||
return this.methods;
|
||||
return this.methods; // NOSONAR - expose internals
|
||||
}
|
||||
|
||||
public void setParams(String... params) {
|
||||
@@ -79,7 +79,7 @@ public class RequestMapping {
|
||||
}
|
||||
|
||||
public String[] getParams() {
|
||||
return this.params;
|
||||
return this.params; // NOSONAR - expose internals
|
||||
}
|
||||
|
||||
public void setHeaders(String... headers) {
|
||||
@@ -88,7 +88,7 @@ public class RequestMapping {
|
||||
}
|
||||
|
||||
public String[] getHeaders() {
|
||||
return this.headers;
|
||||
return this.headers; // NOSONAR - expose internals
|
||||
}
|
||||
|
||||
public void setConsumes(String... consumes) {
|
||||
@@ -97,7 +97,7 @@ public class RequestMapping {
|
||||
}
|
||||
|
||||
public String[] getConsumes() {
|
||||
return this.consumes;
|
||||
return this.consumes; // NOSONAR - expose internals
|
||||
}
|
||||
|
||||
public void setProduces(String... produces) {
|
||||
@@ -106,7 +106,7 @@ public class RequestMapping {
|
||||
}
|
||||
|
||||
public String[] getProduces() {
|
||||
return this.produces;
|
||||
return this.produces; // NOSONAR - expose internals
|
||||
}
|
||||
|
||||
public RequestMethod[] getRequestMethods() {
|
||||
|
||||
@@ -393,11 +393,11 @@ public class CachingClientConnectionFactory extends AbstractClientConnectionFact
|
||||
|
||||
private final AtomicBoolean released = new AtomicBoolean();
|
||||
|
||||
private CachedConnection(TcpConnectionSupport connection,
|
||||
CachedConnection(TcpConnectionSupport connection,
|
||||
@Nullable TcpListener tcpListener) { // NOSONAR false positive, connection not marked @Nullable
|
||||
|
||||
super.setTheConnection(connection);
|
||||
registerListener(tcpListener);
|
||||
super.registerListener(tcpListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -572,9 +572,9 @@ public class JmsOutboundGateway extends AbstractReplyProducingMessageHandler imp
|
||||
* This is needed because there is no way to detect 2 or more gateways using the same reply queue
|
||||
* with no correlation key.
|
||||
*/
|
||||
if (this.useReplyContainer && (this.correlationKey == null &&
|
||||
(this.replyDestination != null || this.replyDestinationName != null) ||
|
||||
this.replyDestinationExpressionProcessor != null)) {
|
||||
boolean hasAReplyDest = this.replyDestination != null || this.replyDestinationName != null
|
||||
|| this.replyDestinationExpressionProcessor != null;
|
||||
if (this.useReplyContainer && (this.correlationKey == null && hasAReplyDest)) {
|
||||
if (logger.isWarnEnabled()) {
|
||||
logger.warn("The gateway cannot use a reply listener container with a specified " +
|
||||
"destination(Name/Expression) " +
|
||||
|
||||
@@ -79,15 +79,17 @@ public class JmsOutboundGatewayParser extends AbstractConsumerEndpointParser {
|
||||
Element container = DomUtils.getChildElementByTagName(element, "reply-listener");
|
||||
|
||||
if (container != null) {
|
||||
this.parseReplyContainer(builder, parserContext, container);
|
||||
this.parseReplyContainer(builder, container);
|
||||
}
|
||||
return builder;
|
||||
}
|
||||
|
||||
private void parseDestination(Element element, ParserContext parserContext, BeanDefinitionBuilder builder,
|
||||
String destinationAttributeName, String destinationNameAttributeName, String destinationExpressionAttributeName,
|
||||
String destinationAttributeName, String destinationNameAttributeName,
|
||||
String destinationExpressionAttributeName,
|
||||
String destinationProperty, String destinationNameProperty, String destinationExpressionProperty,
|
||||
boolean oneRequired) {
|
||||
|
||||
String destinationAttribute = element.getAttribute(destinationAttributeName);
|
||||
String destinationNameAttribute = element.getAttribute(destinationNameAttributeName);
|
||||
String destinationExpressionAttribute = element.getAttribute(destinationExpressionAttributeName);
|
||||
@@ -99,14 +101,16 @@ public class JmsOutboundGatewayParser extends AbstractConsumerEndpointParser {
|
||||
(hasDestinationExpression ? 1 : 0);
|
||||
if (oneRequired) {
|
||||
if (destCount != 1) {
|
||||
parserContext.getReaderContext().error("Exactly one of the '" + destinationAttribute + "', " +
|
||||
"'" + destinationNameAttributeName + "', or '" + destinationExpressionAttributeName + "' attributes is required.", element);
|
||||
parserContext.getReaderContext().error("Exactly one of the '" + destinationAttribute + "', "
|
||||
+ "'" + destinationNameAttributeName + "', or '"
|
||||
+ destinationExpressionAttributeName + "' attributes is required.", element);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (destCount > 1) {
|
||||
parserContext.getReaderContext().error("Only one of the '" + destinationAttribute + "', " +
|
||||
"'" + destinationNameAttributeName + "', or '" + destinationExpressionAttributeName + "' attributes is allowed.", element);
|
||||
parserContext.getReaderContext().error("Only one of the '" + destinationAttribute + "', "
|
||||
+ "'" + destinationNameAttributeName + "', or '"
|
||||
+ destinationExpressionAttributeName + "' attributes is allowed.", element);
|
||||
}
|
||||
}
|
||||
if (hasDestination) {
|
||||
@@ -116,15 +120,18 @@ public class JmsOutboundGatewayParser extends AbstractConsumerEndpointParser {
|
||||
builder.addPropertyValue(destinationNameProperty, destinationNameAttribute);
|
||||
}
|
||||
else if (hasDestinationExpression) {
|
||||
BeanDefinitionBuilder expressionBuilder = BeanDefinitionBuilder.genericBeanDefinition(ExpressionFactoryBean.class);
|
||||
BeanDefinitionBuilder expressionBuilder = BeanDefinitionBuilder
|
||||
.genericBeanDefinition(ExpressionFactoryBean.class);
|
||||
expressionBuilder.addConstructorArgValue(destinationExpressionAttribute);
|
||||
builder.addPropertyValue(destinationExpressionProperty, expressionBuilder.getBeanDefinition());
|
||||
}
|
||||
}
|
||||
|
||||
private void parseReplyContainer(BeanDefinitionBuilder gatewayBuilder, ParserContext parserContext, Element element) {
|
||||
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(JmsOutboundGateway.ReplyContainerProperties.class);
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "acknowledge", "sessionAcknowledgeModeName");
|
||||
private void parseReplyContainer(BeanDefinitionBuilder gatewayBuilder, Element element) {
|
||||
BeanDefinitionBuilder builder = BeanDefinitionBuilder
|
||||
.genericBeanDefinition(JmsOutboundGateway.ReplyContainerProperties.class);
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "acknowledge",
|
||||
"sessionAcknowledgeModeName");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "concurrent-consumers");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "max-concurrent-consumers");
|
||||
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "max-messages-per-task");
|
||||
|
||||
@@ -80,7 +80,7 @@ public class BeanPropertyParameterSource implements ParameterSource {
|
||||
}
|
||||
this.propertyNames = names.toArray(new String[names.size()]);
|
||||
}
|
||||
return this.propertyNames;
|
||||
return this.propertyNames; // NOSONAR - expose internals
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public class MessageDocument {
|
||||
* currently Auditable.
|
||||
*/
|
||||
@Id
|
||||
private String _id;
|
||||
private String _id; // NOSONAR name
|
||||
|
||||
private final Message<?> message;
|
||||
|
||||
|
||||
@@ -791,15 +791,15 @@ public class MongoDbMessageStore extends AbstractMessageGroupStore
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
@Id
|
||||
private String _id;
|
||||
private String _id; // NOSONAR name
|
||||
|
||||
private volatile Object _groupId;
|
||||
private volatile Object _groupId; // NOSONAR name
|
||||
|
||||
@Transient
|
||||
private final Message<?> message;
|
||||
private final Message<?> message; // NOSONAR name
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private final String _messageType;
|
||||
private final String _messageType; // NOSONAR name
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private final Object payload;
|
||||
@@ -810,15 +810,15 @@ public class MongoDbMessageStore extends AbstractMessageGroupStore
|
||||
@SuppressWarnings("unused")
|
||||
private final Message<?> inputMessage;
|
||||
|
||||
private long _message_timestamp;
|
||||
private long _message_timestamp; // NOSONAR name
|
||||
|
||||
private volatile long _group_timestamp;
|
||||
private volatile long _group_timestamp; // NOSONAR name
|
||||
|
||||
private volatile long _group_update_timestamp;
|
||||
private volatile long _group_update_timestamp; // NOSONAR name
|
||||
|
||||
private volatile int _last_released_sequence;
|
||||
private volatile int _last_released_sequence; // NOSONAR name
|
||||
|
||||
private volatile boolean _group_complete;
|
||||
private volatile boolean _group_complete; // NOSONAR name
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private int sequence;
|
||||
@@ -837,20 +837,20 @@ public class MongoDbMessageStore extends AbstractMessageGroupStore
|
||||
}
|
||||
}
|
||||
|
||||
public int get_LastReleasedSequenceNumber() {
|
||||
public int get_LastReleasedSequenceNumber() { // NOSONAR name
|
||||
return this._last_released_sequence;
|
||||
}
|
||||
|
||||
public long get_Group_timestamp() {
|
||||
public long get_Group_timestamp() { // NOSONAR name
|
||||
return this._group_timestamp;
|
||||
}
|
||||
|
||||
public boolean get_Group_complete() {
|
||||
public boolean get_Group_complete() { // NOSONAR name
|
||||
return this._group_complete;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public Object get_GroupId() {
|
||||
public Object get_GroupId() { // NOSONAR name
|
||||
return this._groupId;
|
||||
}
|
||||
|
||||
@@ -858,39 +858,39 @@ public class MongoDbMessageStore extends AbstractMessageGroupStore
|
||||
return this.message;
|
||||
}
|
||||
|
||||
public void set_GroupId(Object groupId) {
|
||||
public void set_GroupId(Object groupId) { // NOSONAR name
|
||||
this._groupId = groupId;
|
||||
}
|
||||
|
||||
public void set_Group_timestamp(long groupTimestamp) {
|
||||
public void set_Group_timestamp(long groupTimestamp) { // NOSONAR name
|
||||
this._group_timestamp = groupTimestamp;
|
||||
}
|
||||
|
||||
public long get_message_timestamp() {
|
||||
public long get_message_timestamp() { // NOSONAR name
|
||||
return this._message_timestamp;
|
||||
}
|
||||
|
||||
public void set_message_timestamp(long _message_timestamp) {
|
||||
public void set_message_timestamp(long _message_timestamp) { // NOSONAR name
|
||||
this._message_timestamp = _message_timestamp;
|
||||
}
|
||||
|
||||
public long get_Group_update_timestamp() {
|
||||
public long get_Group_update_timestamp() { // NOSONAR name
|
||||
return this._group_update_timestamp;
|
||||
}
|
||||
|
||||
public void set_Group_update_timestamp(long lastModified) {
|
||||
public void set_Group_update_timestamp(long lastModified) { // NOSONAR name
|
||||
this._group_update_timestamp = lastModified;
|
||||
}
|
||||
|
||||
public void set_LastReleasedSequenceNumber(int lastReleasedSequenceNumber) {
|
||||
public void set_LastReleasedSequenceNumber(int lastReleasedSequenceNumber) { // NOSONAR name
|
||||
this._last_released_sequence = lastReleasedSequenceNumber;
|
||||
}
|
||||
|
||||
public void set_Group_complete(boolean completedGroup) {
|
||||
public void set_Group_complete(boolean completedGroup) { // NOSONAR name
|
||||
this._group_complete = completedGroup;
|
||||
}
|
||||
|
||||
public void set_Sequence(int sequence) {
|
||||
public void set_Sequence(int sequence) { // NOSONAR name
|
||||
this.sequence = sequence;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ public class RedisQueueInboundGatewayParser extends AbstractInboundGatewayParser
|
||||
|
||||
@Override
|
||||
protected boolean isEligibleAttribute(String attributeName) {
|
||||
return !attributeName.equals("queue")
|
||||
return !attributeName.equals("queue") // NOSONAR boolean complexity
|
||||
&& !attributeName.equals("connection-factory")
|
||||
&& !attributeName.equals("serializer")
|
||||
&& !attributeName.equals("task-executor")
|
||||
|
||||
@@ -88,7 +88,7 @@ public class SftpSession implements Session<LsEntry> {
|
||||
public LsEntry[] list(String path) throws IOException {
|
||||
Assert.state(this.channel != null, "session is not connected");
|
||||
try {
|
||||
Vector<?> lsEntries = this.channel.ls(path);
|
||||
Vector<?> lsEntries = this.channel.ls(path); // NOSONAR (Vector)
|
||||
if (lsEntries != null) {
|
||||
LsEntry[] entries = new LsEntry[lsEntries.size()];
|
||||
for (int i = 0; i < lsEntries.size(); i++) {
|
||||
|
||||
@@ -54,7 +54,7 @@ public class OnlyOnceTrigger implements Trigger {
|
||||
return null;
|
||||
}
|
||||
|
||||
return this.executionTime;
|
||||
return this.executionTime; // NOSONAR - expose internals
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -150,7 +150,7 @@ public class WebFluxMessageHandlerSpec
|
||||
}
|
||||
|
||||
@Override
|
||||
protected WebFluxMessageHandlerSpec expectReply(boolean expectReply) {
|
||||
protected WebFluxMessageHandlerSpec expectReply(boolean expectReply) { // NOSONAR increases visibility
|
||||
return super.expectReply(expectReply);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user