INT-3474 Suppress DEBUG StackTrace in MIMHelper

JIRA: https://jira.spring.io/browse/INT-3474

When the MethodInvokingMessageHandler skips ineligible methods while
searching it emits a stack trace under DEBUG logging. This is not
needed, a simple log message is enough to convey the information.

Some POJOs gain ineligible methods when wrapped in a proxy so this
is no fault of the developer.

Other reasons for skipping methods (improperly set annotations etc)
continue to emit a stack trace.

INT-3474: Polishing

Rethrow `IneligibleMethodException` as `IllegalArgumentException` in case of a single `method` for processor
This commit is contained in:
Gary Russell
2014-07-24 16:41:25 +03:00
committed by Artem Bilan
parent 3b49d606ac
commit 5b3b557cba
2 changed files with 53 additions and 4 deletions

View File

@@ -506,6 +506,16 @@ public class MethodInvokingMessageProcessorTests {
assertEquals("FOO", helper.process(new GenericMessage<Object>(targetObject)));
}
@Test
public void testIneligible() {
IneligibleMethodBean bean = new IneligibleMethodBean();
MethodInvokingMessageProcessor processor = new MethodInvokingMessageProcessor(bean, "foo");
processor.processMessage(MessageBuilder.withPayload("true").build());
assertNotNull(bean.lastArg);
assertEquals(String.class, bean.lastArg.getClass());
assertEquals("true", bean.lastArg);
}
private static class ExceptionCauseMatcher extends TypeSafeMatcher<Exception> {
private Throwable cause;
@@ -683,4 +693,20 @@ public class MethodInvokingMessageProcessorTests {
}
private static class IneligibleMethodBean {
private volatile Object lastArg = null;
@SuppressWarnings("unused")
public void foo(String s) {
this.lastArg = s;
}
@SuppressWarnings("unused")
public void foo(String s, int i) {
throw new RuntimeException("expected ineligible");
}
}
}