camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r931012 - /camel/trunk/camel-core/src/main/java/org/apache/camel/processor/PollEnricher.java
Date Tue, 06 Apr 2010 04:40:38 GMT
Author: davsclaus
Date: Tue Apr  6 04:40:38 2010
New Revision: 931012

URL: http://svn.apache.org/viewvc?rev=931012&view=rev
Log:
MR-332: Avoid NPE if from endpoint is null

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/PollEnricher.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/PollEnricher.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/PollEnricher.java?rev=931012&r1=931011&r2=931012&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/PollEnricher.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/PollEnricher.java Tue
Apr  6 04:40:38 2010
@@ -63,6 +63,7 @@ public class PollEnricher extends Servic
      *
      * @param aggregationStrategy  aggregation strategy to aggregate input data and additional
data.
      * @param consumer consumer to resource endpoint.
+     * @param timeout timeout in millis
      */
     public PollEnricher(AggregationStrategy aggregationStrategy, PollingConsumer consumer,
long timeout) {
         this.aggregationStrategy = aggregationStrategy;
@@ -171,7 +172,8 @@ public class PollEnricher extends Servic
         if (consumer instanceof EventDrivenPollingConsumer) {
             EventDrivenPollingConsumer edpc = (EventDrivenPollingConsumer) consumer;
             boolean fileBasedConsumer = edpc.getEndpoint().getEndpointKey().startsWith("file")
|| edpc.getEndpoint().getEndpointKey().startsWith("ftp");
-            boolean fileBasedExchange = exchange.getFromEndpoint().getEndpointUri().startsWith("file")
|| exchange.getFromEndpoint().getEndpointUri().startsWith("ftp");
+            boolean fileBasedExchange = exchange.getFromEndpoint() != null
+                    && (exchange.getFromEndpoint().getEndpointUri().startsWith("file")
|| exchange.getFromEndpoint().getEndpointUri().startsWith("ftp"));
             if (fileBasedConsumer && fileBasedExchange) {
                 throw new IllegalArgumentException("Camel currently does not support pollEnrich
from a file/ftp endpoint"
                         + " when the route also started from a file/ftp endpoint."



Mime
View raw message