camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steffen Ryll (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CAMEL-8213) UseOriginalAggregationStrategy is suspicious to NullPointerException
Date Wed, 07 Jan 2015 09:31:34 GMT
Steffen Ryll created CAMEL-8213:
-----------------------------------

             Summary: UseOriginalAggregationStrategy is suspicious to NullPointerException
                 Key: CAMEL-8213
                 URL: https://issues.apache.org/jira/browse/CAMEL-8213
             Project: Camel
          Issue Type: Bug
          Components: camel-core
    Affects Versions: 2.14.1
            Reporter: Steffen Ryll
            Priority: Trivial


The default constructor of UseOriginalAggregationStrategy sets the final field {{original}}
to null.
In one corner case, the {{aggregate}} will dereference this null pointer, as no null-pointer
check is made.
{code}
    public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
        if (propagateException) {
            Exception exception = checkException(oldExchange, newExchange);
            if (exception != null) {
                original.setException(exception);
            }
        }
        return original != null ? original : oldExchange;
    }
{code}

This potential NPE should be fixed, maybe a unit test be added.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message