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

simonetripodi pushed a commit to branch multiple-packages-conversion
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-cpconverter.git


The following commit(s) were added to refs/heads/multiple-packages-conversion 
by this push:
     new 19d0ea1  SLING-8390 - Converter not handling serviceusers and acls 
spread across multiple packages
19d0ea1 is described below

commit 19d0ea1783c945e4ac494fa651fa55d356f38d40
Author: stripodi <stripodi@simos-mbp>
AuthorDate: Mon May 6 10:59:11 2019 +0200

    SLING-8390 - Converter not handling serviceusers and acls spread across
    multiple packages
    
    minor optimizations
---
 .../cli/ContentPackage2FeatureModelConverterLauncher.java   | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git 
a/src/main/java/org/apache/sling/feature/cpconverter/cli/ContentPackage2FeatureModelConverterLauncher.java
 
b/src/main/java/org/apache/sling/feature/cpconverter/cli/ContentPackage2FeatureModelConverterLauncher.java
index 22834bf..faff807 100644
--- 
a/src/main/java/org/apache/sling/feature/cpconverter/cli/ContentPackage2FeatureModelConverterLauncher.java
+++ 
b/src/main/java/org/apache/sling/feature/cpconverter/cli/ContentPackage2FeatureModelConverterLauncher.java
@@ -180,20 +180,19 @@ public final class 
ContentPackage2FeatureModelConverterLauncher implements Runna
                                    Map<PackageId, ZipVaultPackage> 
idPackageMapping,
                                    ZipVaultPackage pack,
                                    Set<PackageId> visited) throws 
CyclicDependencyException {
-        if (visited.contains(pack.getId())) {
+        if (!visited.add(pack.getId())) {
             throw new CyclicDependencyException("Cyclic dependency detected, " 
+ pack.getId() + " was previously visited already");
         }
-        visited.add(pack.getId());
-        Dependency[] deps = pack.getDependencies();
-        for (Dependency dep : deps) {
-            for (PackageId id : new HashSet<>(idPackageMapping.keySet())) {
+
+        for (Dependency dep : pack.getDependencies()) {
+            for (PackageId id : idPackageMapping.keySet()) {
                 if (dep.matches(id)) {
-                    orderDependencies(idFileMap, packageFileMapping, 
idPackageMapping, idPackageMapping.get(id),
-                            visited);
+                    orderDependencies(idFileMap, packageFileMapping, 
idPackageMapping, idPackageMapping.get(id), visited);
                     break;
                 }
             }
         }
+
         idFileMap.put(pack.getId(), packageFileMapping.get(pack));
         idPackageMapping.remove(pack.getId());
     }

Reply via email to