From 71532737e2dcceede91ac6015e27840815163c90 Mon Sep 17 00:00:00 2001 From: Mark Fisher Date: Fri, 16 May 2008 14:38:36 +0000 Subject: [PATCH] Method invocation for namespace-based handlers now falls back to the Message as method parameter instead of passing the Message payload if the first invocation attempt throws a NoSuchMethodException (INT-216). --- .../handler/AbstractMessageHandlerAdapter.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractMessageHandlerAdapter.java b/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractMessageHandlerAdapter.java index aeb24e25b6..d9dcbcbbd9 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractMessageHandlerAdapter.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/handler/AbstractMessageHandlerAdapter.java @@ -157,12 +157,20 @@ public abstract class AbstractMessageHandlerAdapter implements MessageHandler, I args = new Object[] { mappingResult }; } try { - Object result = this.invoker.invokeMethod(args); + Object result = null; + try { + result = this.invoker.invokeMethod(args); + } + catch (NoSuchMethodException e) { + result = this.invoker.invokeMethod(message); + this.methodExpectsMessage = true; + } if (result == null) { return null; } return this.handleReturnValue(result, message); - } catch (InvocationTargetException e) { + } + catch (InvocationTargetException e) { throw new MessagingException( "Handler method '" + this.method + "' threw an Exception.", e.getTargetException()); }