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 5b51528c90d CAMEL-18311: camel-jbang - Running files should detect duplicated names 5b51528c90d is described below commit 5b51528c90dccfce26b0a00c2dc5fbf41d351b98 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Wed Jul 27 13:50:37 2022 +0200 CAMEL-18311: camel-jbang - Running files should detect duplicated names --- .../main/java/org/apache/camel/dsl/jbang/core/commands/Run.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java index 4f3d33c272c..e03afec68d1 100644 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java +++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java @@ -42,6 +42,7 @@ import java.util.concurrent.TimeUnit; import java.util.function.Supplier; import java.util.regex.Matcher; import java.util.regex.Pattern; +import java.util.stream.Collectors; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; @@ -207,7 +208,7 @@ class Run extends CamelCommand { } protected Integer runPipe(String file) throws Exception { - this.files = new String[] { file }; + this.files = new String[]{file}; pipeRun = true; return run(); } @@ -313,6 +314,10 @@ class Run extends CamelCommand { } } } + // filter out duplicate files + if (files != null && files.length > 0) { + files = Arrays.stream(files).distinct().toArray(String[]::new); + } // configure logging first configureLogging();