Fix Sonar problems
This commit is contained in:
@@ -16,8 +16,10 @@
|
||||
|
||||
package org.springframework.amqp.core;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
/**
|
||||
@@ -47,7 +49,7 @@ public final class ExchangeBuilder extends AbstractBuilder {
|
||||
|
||||
private boolean declare = true;
|
||||
|
||||
private Object[] admins;
|
||||
private Object[] declaringAdmins;
|
||||
|
||||
/**
|
||||
* Construct an instance of the appropriate type.
|
||||
@@ -176,13 +178,15 @@ public final class ExchangeBuilder extends AbstractBuilder {
|
||||
}
|
||||
|
||||
/**
|
||||
* Admins, or admin bean names that should declare this exchange.
|
||||
* Admin instances, or admin bean names that should declare this exchange.
|
||||
* @param admins the admins.
|
||||
* @return the builder.
|
||||
* @since 2.1
|
||||
*/
|
||||
public ExchangeBuilder admins(Object... admins) {
|
||||
this.admins = admins;
|
||||
Assert.notNull(admins, "'admins' cannot be null");
|
||||
Assert.noNullElements(admins, "'admins' can't have null elements");
|
||||
this.declaringAdmins = Arrays.copyOf(admins, admins.length);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -207,8 +211,8 @@ public final class ExchangeBuilder extends AbstractBuilder {
|
||||
exchange.setDelayed(this.delayed);
|
||||
exchange.setIgnoreDeclarationExceptions(this.ignoreDeclarationExceptions);
|
||||
exchange.setShouldDeclare(this.declare);
|
||||
if (!ObjectUtils.isEmpty(this.admins)) {
|
||||
exchange.setAdminsThatShouldDeclare(this.admins);
|
||||
if (!ObjectUtils.isEmpty(this.declaringAdmins)) {
|
||||
exchange.setAdminsThatShouldDeclare(this.declaringAdmins);
|
||||
}
|
||||
return exchange;
|
||||
}
|
||||
|
||||
@@ -218,7 +218,12 @@ public final class BrokerRunning extends TestWatcher {
|
||||
|
||||
private BrokerRunning(boolean assumeOnline, boolean purge, boolean management, String... queues) {
|
||||
this.assumeOnline = assumeOnline;
|
||||
this.queues = queues;
|
||||
if (queues != null) {
|
||||
this.queues = Arrays.copyOf(queues, queues.length);
|
||||
}
|
||||
else {
|
||||
this.queues = null;
|
||||
}
|
||||
this.purge = purge;
|
||||
this.management = management;
|
||||
setPort(this.defaultPort);
|
||||
|
||||
@@ -46,6 +46,7 @@ import org.springframework.lang.Nullable;
|
||||
import org.springframework.retry.RecoveryCallback;
|
||||
import org.springframework.retry.support.RetryTemplate;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ErrorHandler;
|
||||
import org.springframework.util.backoff.BackOff;
|
||||
import org.springframework.util.backoff.FixedBackOff;
|
||||
@@ -295,23 +296,27 @@ public abstract class AbstractRabbitListenerContainerFactory<C extends AbstractM
|
||||
|
||||
/**
|
||||
* Set post processors which will be applied after the Message is received.
|
||||
* @param afterReceivePostProcessors the post processors.
|
||||
* @param postProcessors the post processors.
|
||||
* @since 2.0
|
||||
* @see AbstractMessageListenerContainer#setAfterReceivePostProcessors(MessagePostProcessor...)
|
||||
*/
|
||||
public void setAfterReceivePostProcessors(MessagePostProcessor... afterReceivePostProcessors) {
|
||||
this.afterReceivePostProcessors = afterReceivePostProcessors;
|
||||
public void setAfterReceivePostProcessors(MessagePostProcessor... postProcessors) {
|
||||
Assert.notNull(postProcessors, "'postProcessors' cannot be null");
|
||||
Assert.noNullElements(postProcessors, "'postProcessors' cannot have null elements");
|
||||
this.afterReceivePostProcessors = Arrays.copyOf(postProcessors, postProcessors.length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set post processors that will be applied before sending replies; added to each
|
||||
* message listener adapter.
|
||||
* @param beforeSendReplyPostProcessors the post processors.
|
||||
* @param postProcessors the post processors.
|
||||
* @since 2.0.3
|
||||
* @see AbstractAdaptableMessageListener#setBeforeSendReplyPostProcessors(MessagePostProcessor...)
|
||||
*/
|
||||
public void setBeforeSendReplyPostProcessors(MessagePostProcessor... beforeSendReplyPostProcessors) {
|
||||
this.beforeSendReplyPostProcessors = beforeSendReplyPostProcessors;
|
||||
public void setBeforeSendReplyPostProcessors(MessagePostProcessor... postProcessors) {
|
||||
Assert.notNull(postProcessors, "'postProcessors' cannot be null");
|
||||
Assert.noNullElements(postProcessors, "'postProcessors' cannot have null elements");
|
||||
this.beforeSendReplyPostProcessors = Arrays.copyOf(postProcessors, postProcessors.length);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -76,8 +76,8 @@ public class BindingFactoryBean implements FactoryBean<Binding> {
|
||||
this.ignoreDeclarationExceptions = ignoreDeclarationExceptions;
|
||||
}
|
||||
|
||||
public void setAdminsThatShouldDeclare(AmqpAdmin... adminsThatShouldDeclare) {
|
||||
this.adminsThatShouldDeclare = adminsThatShouldDeclare;
|
||||
public void setAdminsThatShouldDeclare(AmqpAdmin... admins) {
|
||||
this.adminsThatShouldDeclare = admins;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -198,11 +198,11 @@ public class ListenerContainerFactoryBean extends AbstractFactoryBean<AbstractMe
|
||||
this.acknowledgeMode = acknowledgeMode;
|
||||
}
|
||||
|
||||
public void setQueueNames(String... queueName) {
|
||||
public void setQueueNames(String... queueName) { // NOSONAR
|
||||
this.queueNames = queueName;
|
||||
}
|
||||
|
||||
public void setQueues(Queue... queues) {
|
||||
public void setQueues(Queue... queues) { // NOSONAR
|
||||
this.queues = queues;
|
||||
}
|
||||
|
||||
@@ -222,11 +222,11 @@ public class ListenerContainerFactoryBean extends AbstractFactoryBean<AbstractMe
|
||||
this.deBatchingEnabled = deBatchingEnabled;
|
||||
}
|
||||
|
||||
public void setAdviceChain(Advice... adviceChain) {
|
||||
public void setAdviceChain(Advice... adviceChain) { // NOSONAR
|
||||
this.adviceChain = adviceChain;
|
||||
}
|
||||
|
||||
public void setAfterReceivePostProcessors(MessagePostProcessor... afterReceivePostProcessors) {
|
||||
public void setAfterReceivePostProcessors(MessagePostProcessor... afterReceivePostProcessors) { // NOSONAR
|
||||
this.afterReceivePostProcessors = afterReceivePostProcessors;
|
||||
}
|
||||
|
||||
|
||||
@@ -485,15 +485,15 @@ public abstract class AbstractMessageListenerContainer extends RabbitAccessor
|
||||
* <p>
|
||||
* In contrast to {@link #setAfterReceivePostProcessors(MessagePostProcessor...)}, this
|
||||
* method does not override the previously added afterReceivePostProcessors.
|
||||
* @param afterReceivePostProcessors the post processor.
|
||||
* @param postprocessors the post processor.
|
||||
* @since 2.1.4
|
||||
*/
|
||||
public void addAfterReceivePostProcessors(MessagePostProcessor... afterReceivePostProcessors) {
|
||||
Assert.notNull(afterReceivePostProcessors, "'afterReceivePostProcessors' cannot be null");
|
||||
public void addAfterReceivePostProcessors(MessagePostProcessor... postprocessors) {
|
||||
Assert.notNull(postprocessors, "'afterReceivePostProcessors' cannot be null");
|
||||
if (this.afterReceivePostProcessors == null) {
|
||||
this.afterReceivePostProcessors = new ArrayList<>();
|
||||
}
|
||||
this.afterReceivePostProcessors.addAll(Arrays.asList(afterReceivePostProcessors));
|
||||
this.afterReceivePostProcessors.addAll(Arrays.asList(postprocessors));
|
||||
this.afterReceivePostProcessors = MessagePostProcessorUtils.sort(this.afterReceivePostProcessors);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user