This is an automated email from the ASF dual-hosted git repository.
orpiske 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 447cfde (chores) camel-package-maven-plugin: filter directly on the
listDir instead of in the stream
447cfde is described below
commit 447cfde60e2c204d697a5f3c89c9c88a42cc27c0
Author: Otavio Rodolfo Piske <[email protected]>
AuthorDate: Thu Feb 10 19:05:15 2022 +0100
(chores) camel-package-maven-plugin: filter directly on the listDir instead
of in the stream
---
.../java/org/apache/camel/maven/packaging/EndpointDslMojo.java | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git
a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/EndpointDslMojo.java
b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/EndpointDslMojo.java
index 1b028e8..6721fb6 100644
---
a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/EndpointDslMojo.java
+++
b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/EndpointDslMojo.java
@@ -17,6 +17,7 @@
package org.apache.camel.maven.packaging;
import java.io.File;
+import java.io.FileFilter;
import java.io.IOException;
import java.io.InputStream;
import java.io.LineNumberReader;
@@ -204,7 +205,7 @@ public class EndpointDslMojo extends AbstractGeneratorMojo {
// Update components metadata
getLog().debug("Load components EndpointFactories");
- List<File> endpointFactories =
loadAllComponentsDslEndpointFactoriesAsFile();
+ final List<File> endpointFactories =
loadAllComponentsDslEndpointFactoriesAsFile();
getLog().debug("Regenerate EndpointBuilderFactory");
// make sure EndpointBuilderFactory is synced
@@ -897,15 +898,15 @@ public class EndpointDslMojo extends
AbstractGeneratorMojo {
private List<File> loadAllComponentsDslEndpointFactoriesAsFile() {
final File allComponentsDslEndpointFactory
= new File(sourcesOutputDir,
componentsFactoriesPackageName.replace('.', '/'));
- final File[] files = allComponentsDslEndpointFactory.listFiles();
+ FileFilter fileFilter = file -> file.isFile() &&
file.getName().endsWith(".java");
+ final File[] files =
allComponentsDslEndpointFactory.listFiles(fileFilter);
if (files == null) {
return Collections.emptyList();
}
// load components
- return Arrays.stream(files).filter(file -> file.isFile() &&
file.getName().endsWith(".java") && file.exists()).sorted()
- .collect(Collectors.toList());
+ return
Arrays.stream(files).sorted().collect(Collectors.toUnmodifiableList());
}
private static String camelCaseLower(String s) {