From 4867cbca55bea3890f77e39b3a61ccb2ce0f811f Mon Sep 17 00:00:00 2001 From: Mark Fisher Date: Tue, 17 May 2011 18:35:05 -0400 Subject: [PATCH] INT-1896 added an extra instanceof check prior to MessageChannel cast, and added a debug log message --- .../GlobalChannelInterceptorBeanPostProcessor.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/spring-integration-core/src/main/java/org/springframework/integration/channel/interceptor/GlobalChannelInterceptorBeanPostProcessor.java b/spring-integration-core/src/main/java/org/springframework/integration/channel/interceptor/GlobalChannelInterceptorBeanPostProcessor.java index 737ce0b05c..22932046f9 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/channel/interceptor/GlobalChannelInterceptorBeanPostProcessor.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/channel/interceptor/GlobalChannelInterceptorBeanPostProcessor.java @@ -130,9 +130,12 @@ final class GlobalChannelInterceptorBeanPostProcessor implements BeanPostProcess private List getExistingInterceptors(MessageChannel channel) { try { MessageChannel targetChannel = channel; - if (AopUtils.isAopProxy(channel)){ - targetChannel = (MessageChannel) ((Advised)channel).getTargetSource().getTarget(); - } + if (AopUtils.isAopProxy(channel)) { + Object target = ((Advised) channel).getTargetSource().getTarget(); + if (target instanceof MessageChannel) { + targetChannel = (MessageChannel) target; + } + } DirectFieldAccessor channelAccessor = new DirectFieldAccessor(targetChannel); Object interceptorListWrapper = channelAccessor.getPropertyValue("interceptors"); if (interceptorListWrapper != null) { @@ -140,7 +143,9 @@ final class GlobalChannelInterceptorBeanPostProcessor implements BeanPostProcess } } catch (Exception e) { - // interceptors not supported by this channel, will return null + if (logger.isDebugEnabled()) { + logger.debug("interceptors not supported by channel '" + channel + "'", e); + } } return null; }