[
https://issues.apache.org/jira/browse/CAMEL-7146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13889552#comment-13889552
]
Stefan Burkard commented on CAMEL-7146:
---------------------------------------
I edited the description of the issue since I analyzed the issue in the Camel
code.
In the method "doAggregation" the aggregator evaluates if the aggregation is
complete. With completionSize = 1 this is the case on every Exchange. Therefore
the aggregator does not persist the Exchanges, but skips this part:
{code:title=AggregateProcessor.java|borderStyle=solid}
...
if (complete == null) {
doAggregationRepositoryAdd(newExchange.getContext(), key,
originalExchange, answer);
// we are not complete so the answer should be null
answer = null;
} else {
...
{code}
On the other hand does the method "onCompletion" no such evaluation and tries
to delete the Exchange in the Repository. Therefore the NPE.
> NPE in Aggregator when completionSize = 1
> -----------------------------------------
>
> Key: CAMEL-7146
> URL: https://issues.apache.org/jira/browse/CAMEL-7146
> Project: Camel
> Issue Type: Bug
> Components: camel-core
> Affects Versions: 2.12.2
> Reporter: Stefan Burkard
> Priority: Trivial
> Labels: aggregator
> Attachments: Camel-7146-example.tgz, Camel-7146-stacktrace.txt
>
>
> A Camel aggregator with persistence repository cannot have a completionSize
> of 1. If this is configured, every message produces a NPE with the attached
> stacktrace.
> I have also attached a small example project that shows the Exception. As
> soon as the completionSize is > 1, it runs fine.
> This is just a minor flaw, since I cannot think about a really useful case
> with completionSize 1, but it worked with earlier versions of Camel.
> As an alternative (if completionSize 1 should not be used), Camel could throw
> an error during Context startup when completionSize < 2.
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)