CAMEL-7513: Fixed POJO aggregating when the parameter type was referring to a type that was class annotated.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/3c4f98a0 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/3c4f98a0 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/3c4f98a0 Branch: refs/heads/camel-2.12.x Commit: 3c4f98a0423f6883cccdfe9a1cce3841d2b2ecd0 Parents: a52183e Author: Claus Ibsen <[email protected]> Authored: Mon Jun 16 20:36:27 2014 +0200 Committer: Claus Ibsen <[email protected]> Committed: Mon Jun 16 20:37:06 2014 +0200 ---------------------------------------------------------------------- .../processor/aggregate/AggregationStrategyBeanInfo.java | 10 ++++++---- .../AggregationStrategyBeanAdapterAllowNullTest.java | 5 +++++ 2 files changed, 11 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/3c4f98a0/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregationStrategyBeanInfo.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregationStrategyBeanInfo.java b/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregationStrategyBeanInfo.java index f898be7..ed93a96e 100644 --- a/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregationStrategyBeanInfo.java +++ b/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregationStrategyBeanInfo.java @@ -16,6 +16,7 @@ */ package org.apache.camel.processor.aggregate; +import java.lang.annotation.Annotation; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; @@ -62,10 +63,11 @@ public class AggregationStrategyBeanInfo { } // must not have annotations as they are not supported (yet) - for (int i = 0; i < size; i++) { - Class<?> type = parameterTypes[i]; - if (type.getAnnotations().length > 0) { - throw new IllegalArgumentException("Parameter annotations at index " + i + " is not supported on method: " + method); + Annotation[][] parameterAnnotations = method.getParameterAnnotations(); + for (int i = 0; i < parameterAnnotations.length; i++) { + Annotation[] annotations = parameterAnnotations[i]; + if (annotations.length > 0) { + throw new IllegalArgumentException("Method parameter annotation: " + annotations[0] + " at index: " + i + " is not supported on method: " + method); } } http://git-wip-us.apache.org/repos/asf/camel/blob/3c4f98a0/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterAllowNullTest.java ---------------------------------------------------------------------- diff --git a/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterAllowNullTest.java b/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterAllowNullTest.java index c9cc79f..29e650b 100644 --- a/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterAllowNullTest.java +++ b/camel-core/src/test/java/org/apache/camel/processor/aggregator/AggregationStrategyBeanAdapterAllowNullTest.java @@ -18,6 +18,7 @@ package org.apache.camel.processor.aggregator; import java.util.ArrayList; import java.util.List; +import javax.xml.bind.annotation.XmlRootElement; import org.apache.camel.ContextTestSupport; import org.apache.camel.builder.RouteBuilder; @@ -66,6 +67,10 @@ public class AggregationStrategyBeanAdapterAllowNullTest extends ContextTestSupp } } + /** + * We support annotations on the types. + */ + @XmlRootElement(name = "user") public static final class User { private String name;
