From 8a478620257774eda06c1d7dbc918f4a53c5aa3d Mon Sep 17 00:00:00 2001 From: Gary Russell Date: Mon, 31 Oct 2022 08:47:42 -0400 Subject: [PATCH] GH-1382: Sonar Issues --- .../amqp/rabbit/retry/RepublishMessageRecoverer.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/retry/RepublishMessageRecoverer.java b/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/retry/RepublishMessageRecoverer.java index efe28d49f..304e4f7a9 100644 --- a/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/retry/RepublishMessageRecoverer.java +++ b/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/retry/RepublishMessageRecoverer.java @@ -110,7 +110,9 @@ public RepublishMessageRecoverer(AmqpTemplate errorTemplate, String errorExchang * @param errorExchange the exchange. * @param errorRoutingKey the routing key. */ - public RepublishMessageRecoverer(AmqpTemplate errorTemplate, String errorExchange, String errorRoutingKey) { + public RepublishMessageRecoverer(AmqpTemplate errorTemplate, @Nullable String errorExchange, + @Nullable String errorRoutingKey) { + this(errorTemplate, new LiteralExpression(errorExchange), new LiteralExpression(errorRoutingKey)); } @@ -126,8 +128,8 @@ public RepublishMessageRecoverer(AmqpTemplate errorTemplate, @Nullable Expressio Assert.notNull(errorTemplate, "'errorTemplate' cannot be null"); this.errorTemplate = errorTemplate; - this.errorExchangeNameExpression = errorExchange != null ? errorExchange : new LiteralExpression(null); - this.errorRoutingKeyExpression = errorRoutingKey != null ? errorRoutingKey : new LiteralExpression(null); + this.errorExchangeNameExpression = errorExchange != null ? errorExchange : new LiteralExpression(null); // NOSONAR + this.errorRoutingKeyExpression = errorRoutingKey != null ? errorRoutingKey : new LiteralExpression(null); // NOSONAR if (!(this.errorTemplate instanceof RabbitTemplate)) { this.maxStackTraceLength = Integer.MAX_VALUE; }