This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch camel-3.20.x in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-3.20.x by this push: new 1da7183c67e CAMEL-19679: camel-flatpack - Strange concurrency with DataSet iterator 1da7183c67e is described below commit 1da7183c67e596eff9c648450fa09b87e897e8eb 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