You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by si...@apache.org on 2019/04/26 09:55:42 UTC

[sling-org-apache-sling-feature-cpconverter] branch master updated: invoke the 'artifacts.add' only once

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-org-apache-sling-feature-cpconverter.git


The following commit(s) were added to refs/heads/master by this push:
     new 5b54e3d  invoke the 'artifacts.add' only once
5b54e3d is described below

commit 5b54e3d3615f5585344718fb7c6439ab062d0b48
Author: stripodi <st...@192.168.1.111>
AuthorDate: Fri Apr 26 11:55:36 2019 +0200

    invoke the 'artifacts.add' only once
---
 .../feature/cpconverter/ContentPackage2FeatureModelConverter.java | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/sling/feature/cpconverter/ContentPackage2FeatureModelConverter.java b/src/main/java/org/apache/sling/feature/cpconverter/ContentPackage2FeatureModelConverter.java
index d4df35c..4014256 100644
--- a/src/main/java/org/apache/sling/feature/cpconverter/ContentPackage2FeatureModelConverter.java
+++ b/src/main/java/org/apache/sling/feature/cpconverter/ContentPackage2FeatureModelConverter.java
@@ -35,6 +35,7 @@ import org.apache.jackrabbit.vault.packaging.VaultPackage;
 import org.apache.jackrabbit.vault.packaging.impl.PackageManagerImpl;
 import org.apache.sling.feature.Artifact;
 import org.apache.sling.feature.ArtifactId;
+import org.apache.sling.feature.Artifacts;
 import org.apache.sling.feature.Configuration;
 import org.apache.sling.feature.Extension;
 import org.apache.sling.feature.ExtensionType;
@@ -467,6 +468,7 @@ public class ContentPackage2FeatureModelConverter {
         Artifact artifact = new Artifact(new ArtifactId(groupId, artifactId, version, classifier, type));
 
         Feature targetFeature = getRunMode(runMode);
+        Artifacts artifacts;
 
         if (ZIP_TYPE.equals(type) ) {
             Extensions extensions = targetFeature.getExtensions();
@@ -477,11 +479,13 @@ public class ContentPackage2FeatureModelConverter {
                 extensions.add(extension);
             }
 
-            extension.getArtifacts().add(artifact);
+            artifacts = extension.getArtifacts();
         } else {
             artifact.setStartOrder(bundlesStartOrder);
-            targetFeature.getBundles().add(artifact);
+            artifacts = targetFeature.getBundles();
         }
+
+        artifacts.add(artifact);
     }
 
 }