From bfe28dba9aac39afe1092f52672f64496496d411 Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Sat, 25 Jan 2020 09:19:59 -0500 Subject: [PATCH] Revert NPE check in the AbstMappingMessageRouter --- .../integration/router/AbstractMappingMessageRouter.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spring-integration-core/src/main/java/org/springframework/integration/router/AbstractMappingMessageRouter.java b/spring-integration-core/src/main/java/org/springframework/integration/router/AbstractMappingMessageRouter.java index 26c679a77c..4d384e40b0 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/router/AbstractMappingMessageRouter.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/router/AbstractMappingMessageRouter.java @@ -312,13 +312,14 @@ public abstract class AbstractMappingMessageRouter extends AbstractMessageRouter else if (channelKey instanceof Collection) { addToCollection(channels, (Collection) channelKey, message); } - else if (getRequiredConversionService().canConvert(channelKey.getClass(), String.class)) { + else if (channelKey != null && + getRequiredConversionService().canConvert(channelKey.getClass(), String.class)) { String converted = getConversionService().convert(channelKey, String.class); if (converted != null) { addChannelFromString(channels, converted, message); } } - else { + else if (channelKey != null) { throw new MessagingException("unsupported return type for router [" + channelKey.getClass() + "]"); } }