You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by lb...@apache.org on 2020/05/21 11:17:17 UTC
[camel-k-runtime] 02/03: chore: simplify code
This is an automated email from the ASF dual-hosted git repository.
lburgazzoli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git
commit 9caad133af2512c92a7bb940e5fe99dd318343c4
Author: lburgazzoli <lb...@gmail.com>
AuthorDate: Wed May 20 19:34:50 2020 +0200
chore: simplify code
---
.../org/apache/camel/k/tooling/maven/GenerateYamlSupport.java | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/GenerateYamlSupport.java b/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/GenerateYamlSupport.java
index 1d9c540..f402add 100644
--- a/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/GenerateYamlSupport.java
+++ b/tooling/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/GenerateYamlSupport.java
@@ -103,8 +103,8 @@ public abstract class GenerateYamlSupport extends AbstractMojo {
List<IndexView> allIndex = new ArrayList<>();
Set<URL> locations = new HashSet<>();
- for (Enumeration<URL> e = elements; e.hasMoreElements();) {
- URL url = e.nextElement();
+ while (elements.hasMoreElements()) {
+ URL url = elements.nextElement();
if (locations.add(url)) {
try (InputStream is = url.openStream()) {
allIndex.add(new IndexReader(is).read());
@@ -124,10 +124,8 @@ public abstract class GenerateYamlSupport extends AbstractMojo {
}
try {
- List<String> elements = new ArrayList<>();
- elements.addAll(project.getCompileClasspathElements());
-
- URL urls[] = new URL[elements.size()];
+ List<String> elements = new ArrayList<>(project.getCompileClasspathElements());
+ URL[] urls = new URL[elements.size()];
for (int i = 0; i < elements.size(); ++i) {
urls[i] = new File(elements.get(i)).toURI().toURL();
}