From 750c3d1cd11c77438986b7069f5892f59a384006 Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Wed, 7 Oct 2015 10:57:16 -0400 Subject: [PATCH] INT-3842: Backport NPE Fix for the AmqpInGateway JIRA: https://jira.spring.io/browse/INT-3842 --- .../integration/amqp/inbound/AmqpInboundGateway.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/inbound/AmqpInboundGateway.java b/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/inbound/AmqpInboundGateway.java index 97dcf11ffe..d4b56a113f 100644 --- a/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/inbound/AmqpInboundGateway.java +++ b/spring-integration-amqp/src/main/java/org/springframework/integration/amqp/inbound/AmqpInboundGateway.java @@ -105,6 +105,8 @@ public class AmqpInboundGateway extends MessagingGatewaySupport { // TODO: fallback to a reply address property of this gateway Address replyTo; String replyToProperty = message.getMessageProperties().getReplyTo(); + Assert.notNull(replyToProperty, "The replyTo header must not be null on a " + + "request Message being handled by the AMQP inbound gateway."); // TODO: Use the Address.AMQ_RABBITMQ_REPLY_TO constant when 1.4.3 is the minimum if (replyToProperty.startsWith("amq.rabbitmq.reply-to")) { replyTo = new Address("", replyToProperty); @@ -112,8 +114,6 @@ public class AmqpInboundGateway extends MessagingGatewaySupport { else { replyTo = new Address(replyToProperty); } - Assert.notNull(replyTo, "The replyTo header must not be null on a " + - "request Message being handled by the AMQP inbound gateway."); amqpTemplate.convertAndSend(replyTo.getExchangeName(), replyTo.getRoutingKey(), reply.getPayload(), new MessagePostProcessor() {