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

davidb pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-installer-factory-feature.git

commit a81ba6791d69b94f5a6bcb1cb44ec4c4d8060463
Author: Carsten Ziegeler <[email protected]>
AuthorDate: Wed Apr 29 16:34:25 2020 +0200

    Convert Properies to String[]
---
 .../factory/model/impl/InstallFeatureModelTask.java   | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git 
a/src/main/java/org/apache/sling/installer/factory/model/impl/InstallFeatureModelTask.java
 
b/src/main/java/org/apache/sling/installer/factory/model/impl/InstallFeatureModelTask.java
index 7dbb111..1570a59 100644
--- 
a/src/main/java/org/apache/sling/installer/factory/model/impl/InstallFeatureModelTask.java
+++ 
b/src/main/java/org/apache/sling/installer/factory/model/impl/InstallFeatureModelTask.java
@@ -31,6 +31,8 @@ import java.util.ArrayList;
 import java.util.Dictionary;
 import java.util.Hashtable;
 import java.util.List;
+import java.util.Map;
+import java.util.Properties;
 
 import org.apache.sling.feature.Artifact;
 import org.apache.sling.feature.ArtifactId;
@@ -182,10 +184,10 @@ public class InstallFeatureModelTask extends 
AbstractFeatureModelTask {
 
                 final String configPid = 
REGION_FACTORY_PID.concat(feature.getId().toMvnName().replace('-', '_'));
                 final Dictionary<String, Object> props = new Hashtable<>();
-                props.put(PROP_idbsnver, 
LauncherProperties.getBundleIDtoBSNandVersionMap(feature, 
this.installContext.artifactManager));
-                props.put(PROP_bundleFeatures, 
LauncherProperties.getBundleIDtoFeaturesMap(feature));
-                props.put(PROP_featureRegions, 
LauncherProperties.getFeatureIDtoRegionsMap(regions));
-                props.put(PROP_regionPackage, 
LauncherProperties.getRegionNametoPackagesMap(regions));
+                props.put(PROP_idbsnver, 
convert(LauncherProperties.getBundleIDtoBSNandVersionMap(feature, 
this.installContext.artifactManager)));
+                props.put(PROP_bundleFeatures, 
convert(LauncherProperties.getBundleIDtoFeaturesMap(feature)));
+                props.put(PROP_featureRegions, 
convert(LauncherProperties.getFeatureIDtoRegionsMap(regions)));
+                props.put(PROP_regionPackage, 
convert(LauncherProperties.getRegionNametoPackagesMap(regions)));
 
                 result.add(new 
InstallableResource("/".concat(configPid).concat(".config"), null,
                         props, null, InstallableResource.TYPE_CONFIG, null));
@@ -213,6 +215,15 @@ public class InstallFeatureModelTask extends 
AbstractFeatureModelTask {
         return result;
     }
 
+    private String[] convert(final Properties props) {
+        final List<String> result = new ArrayList<>();
+
+        for(final Map.Entry<Object, Object> entry : props.entrySet()) {
+            
result.add(entry.getKey().toString().concat("=").concat(entry.getValue().toString()));
+        }
+        return result.toArray(new String[result.size()]);
+    }
+
     private boolean addArtifact(final Artifact artifact,
             final List<InstallableResource> result) {
         File artifactFile = (this.installContext.storageDirectory == null ? 
null

Reply via email to