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

simonetripodi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git


The following commit(s) were added to refs/heads/master by this push:
     new 25f2ace  [r2f] always make sure ConfigurationAdmin instance is not 
null, before enlisting all the configurations
25f2ace is described below

commit 25f2acec1cace1f813895b3389cde4c93afd58cb
Author: Simo Tripodi <[email protected]>
AuthorDate: Wed Jun 19 18:25:31 2019 +0200

    [r2f] always make sure ConfigurationAdmin instance is not null, before
    enlisting all the configurations
---
 .../impl/RuntimeEnvironment2FeatureModelService.java  | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git 
a/runtime2feature/src/main/java/org/apache/sling/feature/r2f/impl/RuntimeEnvironment2FeatureModelService.java
 
b/runtime2feature/src/main/java/org/apache/sling/feature/r2f/impl/RuntimeEnvironment2FeatureModelService.java
index f727261..7ad9c00 100644
--- 
a/runtime2feature/src/main/java/org/apache/sling/feature/r2f/impl/RuntimeEnvironment2FeatureModelService.java
+++ 
b/runtime2feature/src/main/java/org/apache/sling/feature/r2f/impl/RuntimeEnvironment2FeatureModelService.java
@@ -102,16 +102,19 @@ public class RuntimeEnvironment2FeatureModelService 
implements RuntimeEnvironmen
         ServiceReference<ConfigurationAdmin> configurationAdminReference = 
bundleContext.getServiceReference(ConfigurationAdmin.class);
         if (configurationAdminReference != null) {
             ConfigurationAdmin configurationAdmin = 
bundleContext.getService(configurationAdminReference);
-            try {
-                Configuration[] configurations = 
configurationAdmin.listConfigurations(null);
-                if (configurations != null) {
-                    OSGiConfiguration2FeatureConfigurationMapper mapper = new 
OSGiConfiguration2FeatureConfigurationMapper(targetFeature);
 
-                    Stream.of(configurations).map(mapper).forEach(mapper);
+            if (configurationAdmin != null) {
+                try {
+                    Configuration[] configurations = 
configurationAdmin.listConfigurations(null);
+                    if (configurations != null) {
+                        OSGiConfiguration2FeatureConfigurationMapper mapper = 
new OSGiConfiguration2FeatureConfigurationMapper(targetFeature);
+
+                        Stream.of(configurations).map(mapper).forEach(mapper);
+                    }
+                } catch (Exception e) {
+                    // that should not happen
+                    throw new RuntimeException("Something went wrong while 
iterating over all available Configurations", e);
                 }
-            } catch (Exception e) {
-                // that should not happen
-                throw new RuntimeException("Something went wrong while 
iterating over all available Configurations", e);
             }
         }
 

Reply via email to