You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2017/11/14 22:45:25 UTC

[isis] 02/03: ISIS-1710: fixes NPE if no prior list of services

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

danhaywood pushed a commit to branch ISIS-1759
in repository https://gitbox.apache.org/repos/asf/isis.git

commit 629289008ec55a5b56895a7ddde1903fd2a70e39
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Tue Nov 14 18:19:15 2017 +0000

    ISIS-1710: fixes NPE if no prior list of services
---
 .../systemusinginstallers/IsisComponentProvider.java    | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisComponentProvider.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisComponentProvider.java
index f6e61a8..ec66347 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisComponentProvider.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisComponentProvider.java
@@ -174,14 +174,21 @@ public abstract class IsisComponentProvider {
 
         final List<Class<?>> additionalServices = appManifest.getAdditionalServices();
         if(additionalServices != null) {
-            String existingServicesCsv = configuration.getString(ServicesInstallerFromConfiguration.SERVICES_KEY);
-            String additionalServicesCsv = classNamesFrom(additionalServices);
-            String servicesCsv = Joiner.on(",").join(existingServicesCsv, additionalServicesCsv);
-            putConfigurationProperty(
-                    ServicesInstallerFromConfiguration.SERVICES_KEY, servicesCsv);
+            final String additionalServicesCsv = classNamesFrom(additionalServices);
+            appendToPropertyCsvValue(ServicesInstallerFromConfiguration.SERVICES_KEY, additionalServicesCsv);
         }
     }
 
+    private void appendToPropertyCsvValue(final String servicesKey, final String additionalServicesCsv) {
+        final String existingServicesCsv = configuration.getString(servicesKey);
+        final String servicesCsv = join(existingServicesCsv, additionalServicesCsv);
+        putConfigurationProperty(servicesKey, servicesCsv);
+    }
+
+    private static String join(final String csv1, final String csv2) {
+        return csv1 != null ? Joiner.on(",").join(csv1, csv2) : null;
+    }
+
     private Iterable<String> modulePackageNamesFrom(final AppManifest appManifest) {
         List<Class<?>> modules = appManifest.getModules();
         if (modules == null || modules.isEmpty()) {

-- 
To stop receiving notification emails like this one, please contact
"commits@isis.apache.org" <co...@isis.apache.org>.