Fix new Sonar smells

This commit is contained in:
abilan
2023-03-07 12:01:42 -05:00
parent f128a3f2eb
commit f0d21040b8
6 changed files with 172 additions and 165 deletions

View File

@@ -335,7 +335,7 @@ public abstract class AbstractMessageChannel extends IntegrationObjectSupport
DefaultMessageSenderObservationConvention.INSTANCE,
() -> new MessageSenderContext(messageToSend, getComponentName()),
this.observationRegistry)
.observe(() -> sendInternal(messageToSend, timeout));
.observe(() -> sendInternal(messageToSend, timeout)); // NOSONAR - never null
}
private boolean sendWithMetrics(Message<?> message, long timeout) {

View File

@@ -174,14 +174,13 @@ public class DefaultConfiguringBeanFactoryPostProcessor
BeanDefinition nullChannelDefinition = null;
BeanFactory beanFactoryToUse = this.beanFactory;
do {
if (beanFactoryToUse instanceof ConfigurableListableBeanFactory listable) {
if (listable.containsBeanDefinition(IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME)) {
nullChannelDefinition =
listable.getBeanDefinition(IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME);
}
if (beanFactoryToUse instanceof ConfigurableListableBeanFactory listable &&
listable.containsBeanDefinition(IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME)) {
nullChannelDefinition = listable.getBeanDefinition(IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME);
}
if (beanFactoryToUse instanceof HierarchicalBeanFactory) {
beanFactoryToUse = ((HierarchicalBeanFactory) beanFactoryToUse).getParentBeanFactory();
if (beanFactoryToUse instanceof HierarchicalBeanFactory hierarchicalBeanFactory) {
beanFactoryToUse = hierarchicalBeanFactory.getParentBeanFactory();
}
}
while (nullChannelDefinition == null);
@@ -455,7 +454,7 @@ public class DefaultConfiguringBeanFactoryPostProcessor
return BeanDefinitionBuilder.genericBeanDefinition(IntegrationMessageHandlerMethodFactory.class)
.addConstructorArgValue(listCapable)
.addPropertyReference("messageConverter",
IntegrationContextUtils.ARGUMENT_RESOLVER_MESSAGE_CONVERTER_BEAN_NAME);
IntegrationContextUtils.ARGUMENT_RESOLVER_MESSAGE_CONVERTER_BEAN_NAME);
}
}

View File

@@ -39,10 +39,10 @@ public interface CheckedFunction<T, R> {
return apply(t1);
}
catch (Throwable t) { // NOSONAR
if (t instanceof RuntimeException runtimeException) {
if (t instanceof RuntimeException runtimeException) { // NOSONAR
throw runtimeException;
}
else if (t instanceof Error error) {
else if (t instanceof Error error) { // NOSONAR
throw error;
}
else {