You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2021/02/01 12:40:22 UTC

[camel-spring-boot] branch master updated: Factorize code in SpringBootRuntimeProvider (#273)

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git


The following commit(s) were added to refs/heads/master by this push:
     new 491344f  Factorize code in SpringBootRuntimeProvider (#273)
491344f is described below

commit 491344f5c9d5b21f43c5fb9967548e146fe81ca1
Author: Aurélien Pupier <ap...@redhat.com>
AuthorDate: Mon Feb 1 13:40:13 2021 +0100

    Factorize code in SpringBootRuntimeProvider (#273)
    
    Signed-off-by: Aurélien Pupier <ap...@redhat.com>
---
 .../catalog/SpringBootRuntimeProvider.java         | 39 +++++-----------------
 1 file changed, 8 insertions(+), 31 deletions(-)

diff --git a/catalog/camel-catalog-provider-springboot/src/main/java/org/apache/camel/springboot/catalog/SpringBootRuntimeProvider.java b/catalog/camel-catalog-provider-springboot/src/main/java/org/apache/camel/springboot/catalog/SpringBootRuntimeProvider.java
index fe31912..620dc98 100644
--- a/catalog/camel-catalog-provider-springboot/src/main/java/org/apache/camel/springboot/catalog/SpringBootRuntimeProvider.java
+++ b/catalog/camel-catalog-provider-springboot/src/main/java/org/apache/camel/springboot/catalog/SpringBootRuntimeProvider.java
@@ -89,50 +89,27 @@ public class SpringBootRuntimeProvider implements RuntimeProvider {
 
     @Override
     public List<String> findComponentNames() {
-        List<String> names = new ArrayList<>();
-        InputStream is = camelCatalog.getVersionManager().getResourceAsStream(COMPONENTS_CATALOG);
-        if (is != null) {
-            try {
-                CatalogHelper.loadLines(is, names);
-            } catch (IOException e) {
-                // ignore
-            }
-        }
-        return names;
+        return findNames(COMPONENTS_CATALOG);
     }
 
     @Override
     public List<String> findDataFormatNames() {
-        List<String> names = new ArrayList<>();
-        InputStream is = camelCatalog.getVersionManager().getResourceAsStream(DATA_FORMATS_CATALOG);
-        if (is != null) {
-            try {
-                CatalogHelper.loadLines(is, names);
-            } catch (IOException e) {
-                // ignore
-            }
-        }
-        return names;
+        return findNames(DATA_FORMATS_CATALOG);
     }
 
     @Override
     public List<String> findLanguageNames() {
-        List<String> names = new ArrayList<>();
-        InputStream is = camelCatalog.getVersionManager().getResourceAsStream(LANGUAGE_CATALOG);
-        if (is != null) {
-            try {
-                CatalogHelper.loadLines(is, names);
-            } catch (IOException e) {
-                // ignore
-            }
-        }
-        return names;
+        return findNames(LANGUAGE_CATALOG);
     }
 
     @Override
     public List<String> findOtherNames() {
+        return findNames(OTHER_CATALOG);
+    }
+    
+    private List<String> findNames(String pathToPropertyCatalogDescriptor) {
         List<String> names = new ArrayList<>();
-        InputStream is = camelCatalog.getVersionManager().getResourceAsStream(OTHER_CATALOG);
+        InputStream is = camelCatalog.getVersionManager().getResourceAsStream(pathToPropertyCatalogDescriptor);
         if (is != null) {
             try {
                 CatalogHelper.loadLines(is, names);