camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r997217 - /camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Splitter.java
Date Wed, 15 Sep 2010 08:00:31 GMT
Author: davsclaus
Date: Wed Sep 15 08:00:30 2010
New Revision: 997217

URL: http://svn.apache.org/viewvc?rev=997217&view=rev
Log:
CAMEL-3121: Fixed issue with splitter in non streaming mode and Windows keep input stream
locked, causing file on completion not being able to move/delete files splitted.

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

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Splitter.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Splitter.java?rev=997217&r1=997216&r2=997217&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Splitter.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Splitter.java Wed Sep
15 08:00:30 2010
@@ -157,27 +157,14 @@ public class Splitter extends MulticastP
     }
 
     private Iterable<ProcessorExchangePair> createProcessorExchangePairsList(Exchange
exchange, Object value) {
-        List<ProcessorExchangePair> result;
-        Integer collectionSize = CollectionHelper.size(value);
-        if (collectionSize != null) {
-            result = new ArrayList<ProcessorExchangePair>(collectionSize);
-        } else {
-            result = new ArrayList<ProcessorExchangePair>();
-        }
+        List<ProcessorExchangePair> result = new ArrayList<ProcessorExchangePair>();
 
-        int index = 0;
-        Iterator<Object> iter = ObjectHelper.createIterator(value);
-        while (iter.hasNext()) {
-            Object part = iter.next();
-            Exchange newExchange = exchange.copy();
-            if (part instanceof Message) {
-                newExchange.setIn((Message)part);
-            } else {
-                Message in = newExchange.getIn();
-                in.setBody(part);
-            }
-            result.add(createProcessorExchangePair(index++, getProcessors().iterator().next(),
newExchange));
+        // reuse iterable and add it to the result list
+        Iterable<ProcessorExchangePair> pairs = createProcessorExchangePairsIterable(exchange,
value);
+        for (ProcessorExchangePair pair : pairs) {
+            result.add(pair);
         }
+
         return result;
     }
 



Mime
View raw message