Fix new Sonar smells
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2020 the original author or authors.
|
||||
* Copyright 2015-2021 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.
|
||||
@@ -190,8 +190,8 @@ public abstract class AbstractExecutorChannel extends AbstractSubscribableChanne
|
||||
theMessage = executorInterceptor.beforeHandle(theMessage, AbstractExecutorChannel.this,
|
||||
this.delegate.getMessageHandler());
|
||||
if (theMessage == null) {
|
||||
if (isLoggingEnabled() && logger.isDebugEnabled()) {
|
||||
logger.debug(executorInterceptor.getClass().getSimpleName()
|
||||
if (isLoggingEnabled()) {
|
||||
logger.debug(() -> executorInterceptor.getClass().getSimpleName()
|
||||
+ " returned null from beforeHandle, i.e. precluding the send.");
|
||||
}
|
||||
triggerAfterMessageHandled(null, null, interceptorStack);
|
||||
@@ -203,13 +203,13 @@ public abstract class AbstractExecutorChannel extends AbstractSubscribableChanne
|
||||
return theMessage;
|
||||
}
|
||||
|
||||
private void triggerAfterMessageHandled(Message<?> message, Exception ex,
|
||||
Deque<ExecutorChannelInterceptor> interceptorStack) {
|
||||
private void triggerAfterMessageHandled(@Nullable Message<?> message, @Nullable Exception ex,
|
||||
Deque<ExecutorChannelInterceptor> interceptorStack) {
|
||||
Iterator<ExecutorChannelInterceptor> iterator = interceptorStack.descendingIterator();
|
||||
while (iterator.hasNext()) {
|
||||
ExecutorChannelInterceptor interceptor = iterator.next();
|
||||
try {
|
||||
interceptor.afterMessageHandled(message, AbstractExecutorChannel.this,
|
||||
interceptor.afterMessageHandled(message, AbstractExecutorChannel.this, //NOSONAR
|
||||
this.delegate.getMessageHandler(), ex);
|
||||
}
|
||||
catch (Throwable ex2) { //NOSONAR
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2021 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.
|
||||
@@ -510,11 +510,14 @@ public class GatewayProxyFactoryBean extends AbstractEndpoint
|
||||
@Override
|
||||
@Nullable
|
||||
public Object invoke(final MethodInvocation invocation) throws Throwable { // NOSONAR
|
||||
Class<?> returnType = invocation.getMethod().getReturnType();
|
||||
final Class<?> returnType;
|
||||
MethodInvocationGateway gateway = this.gatewayMap.get(invocation.getMethod());
|
||||
if (gateway != null) {
|
||||
returnType = gateway.returnType;
|
||||
}
|
||||
else {
|
||||
returnType = invocation.getMethod().getReturnType();
|
||||
}
|
||||
if (this.asyncExecutor != null && !Object.class.equals(returnType)) {
|
||||
Invoker invoker = new Invoker(invocation);
|
||||
if (returnType.isAssignableFrom(this.asyncSubmitType)) {
|
||||
@@ -526,8 +529,8 @@ public class GatewayProxyFactoryBean extends AbstractEndpoint
|
||||
else if (CompletableFuture.class.equals(returnType)) { // exact
|
||||
return CompletableFuture.supplyAsync(invoker, this.asyncExecutor);
|
||||
}
|
||||
else if (Future.class.isAssignableFrom(returnType) && logger.isDebugEnabled()) {
|
||||
logger.debug("AsyncTaskExecutor submit*() return types are incompatible with the method return " +
|
||||
else if (Future.class.isAssignableFrom(returnType)) {
|
||||
logger.debug(() -> "AsyncTaskExecutor submit*() return types are incompatible with the method return " +
|
||||
"type; running on calling thread; the downstream flow must return the required Future: "
|
||||
+ returnType.getSimpleName());
|
||||
}
|
||||
@@ -997,7 +1000,7 @@ public class GatewayProxyFactoryBean extends AbstractEndpoint
|
||||
}
|
||||
}
|
||||
|
||||
private void setChannel(String channelName1, String channelName2, Consumer<String> channelNameMethod,
|
||||
private void setChannel(@Nullable String channelName1, String channelName2, Consumer<String> channelNameMethod,
|
||||
MessageChannel channel, Consumer<MessageChannel> channelMethod) {
|
||||
|
||||
if (StringUtils.hasText(channelName1)) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2021 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.
|
||||
@@ -29,6 +29,7 @@ import org.springframework.expression.EvaluationContext;
|
||||
import org.springframework.expression.Expression;
|
||||
import org.springframework.expression.common.LiteralExpression;
|
||||
import org.springframework.integration.expression.ExpressionUtils;
|
||||
import org.springframework.integration.expression.ValueExpression;
|
||||
import org.springframework.integration.jpa.support.JpaParameter;
|
||||
import org.springframework.integration.jpa.support.PersistMode;
|
||||
import org.springframework.integration.jpa.support.parametersource.BeanPropertyParameterSourceFactory;
|
||||
@@ -163,7 +164,7 @@ public class JpaExecutor implements InitializingBean, BeanFactoryAware {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the class type which is being used for retrieving entities from the
|
||||
* Set the class type which is being used for retrieving entities from the
|
||||
* database.
|
||||
* @param entityClass Must not be null.
|
||||
*/
|
||||
@@ -359,7 +360,7 @@ public class JpaExecutor implements InitializingBean, BeanFactoryAware {
|
||||
* @see javax.persistence.Query#setMaxResults(int)
|
||||
*/
|
||||
public void setMaxNumberOfResults(int maxNumberOfResults) {
|
||||
this.setMaxResultsExpression(new LiteralExpression("" + maxNumberOfResults));
|
||||
this.setMaxResultsExpression(new ValueExpression<>(maxNumberOfResults));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -537,7 +538,7 @@ public class JpaExecutor implements InitializingBean, BeanFactoryAware {
|
||||
return payload;
|
||||
}
|
||||
|
||||
private void checkDelete(final Object payload) {
|
||||
private void checkDelete(@Nullable Object payload) {
|
||||
if (payload != null && this.deleteAfterPoll) {
|
||||
if (payload instanceof Iterable) {
|
||||
if (this.deleteInBatch) {
|
||||
|
||||
Reference in New Issue
Block a user