This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push: new 1d01f9bea30 CAMEL-19679: camel-flatpack - Strange concurrency with DataSet iterator 1d01f9bea30 is described below commit 1d01f9bea30660d27de37f342ef58f57b6d8e2dc Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Fri Jul 28 21:05:09 2023 +0200 CAMEL-19679: camel-flatpack - Strange concurrency with DataSet iterator --- .../org/apache/camel/component/flatpack/DataSetList.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/components/camel-flatpack/src/main/java/org/apache/camel/component/flatpack/DataSetList.java b/components/camel-flatpack/src/main/java/org/apache/camel/component/flatpack/DataSetList.java index 745b7631629..6834036317b 100644 --- a/components/camel-flatpack/src/main/java/org/apache/camel/component/flatpack/DataSetList.java +++ b/components/camel-flatpack/src/main/java/org/apache/camel/component/flatpack/DataSetList.java @@ -63,19 +63,17 @@ public class DataSetList extends AbstractList<Map<String, Object>> implements Da @Override public Iterator<Map<String, Object>> iterator() { dataSet.goTop(); + return new Iterator<Map<String, Object>>() { - private boolean hasNext = dataSet.next(); + private int pos = 0; public boolean hasNext() { - return hasNext; + return pos < size(); } public Map<String, Object> next() { - // because of a limitation in split() we need to create an object for the current position - // otherwise strangeness occurs when the same object is used to represent each row - Map<String, Object> result = FlatpackConverter.toMap(dataSet); - hasNext = dataSet.next(); - return result; + dataSet.absolute(pos++); + return FlatpackConverter.toMap(dataSet); } @Override