felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r1152490 - /felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/ResolverImpl.java
Date Sat, 30 Jul 2011 15:49:55 GMT
Author: rickhall
Date: Sat Jul 30 15:49:54 2011
New Revision: 1152490

URL: http://svn.apache.org/viewvc?rev=1152490&view=rev
Log:
Need to check for require-bundle cycles when merging require-bundle candidates
into a bundle revision's package space. (FELIX-3062)

Modified:
    felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/ResolverImpl.java

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/ResolverImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/ResolverImpl.java?rev=1152490&r1=1152489&r2=1152490&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/ResolverImpl.java
(original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/ResolverImpl.java
Sat Jul 30 15:49:54 2011
@@ -717,12 +717,13 @@ public class ResolverImpl implements Res
         Packages revisionPkgs = revisionPkgMap.get(revision);
 
         // Second, add all imported packages to the target revision's package space.
+        Set<BundleRevision> cycles = new HashSet<BundleRevision>();
         for (int i = 0; i < reqs.size(); i++)
         {
             BundleRequirement req = reqs.get(i);
             BundleCapability cap = caps.get(i);
             calculateExportedPackages(cap.getRevision(), allCandidates, revisionPkgMap);
-            mergeCandidatePackages(revision, req, cap, revisionPkgMap, allCandidates);
+            mergeCandidatePackages(revision, req, cap, revisionPkgMap, allCandidates, cycles);
         }
 
         // Third, have all candidates to calculate their package spaces.
@@ -811,8 +812,14 @@ public class ResolverImpl implements Res
     private void mergeCandidatePackages(
         BundleRevision current, BundleRequirement currentReq, BundleCapability candCap,
         Map<BundleRevision, Packages> revisionPkgMap,
-        Candidates allCandidates)
+        Candidates allCandidates, Set<BundleRevision> cycles)
     {
+        if (cycles.contains(current))
+        {
+            return;
+        }
+        cycles.add(current);
+
         if (candCap.getNamespace().equals(BundleRevision.PACKAGE_NAMESPACE))
         {
             mergeCandidatePackage(
@@ -860,11 +867,14 @@ public class ResolverImpl implements Res
                             currentReq,
                             allCandidates.getCandidates(req).iterator().next(),
                             revisionPkgMap,
-                            allCandidates);
+                            allCandidates,
+                            cycles);
                     }
                 }
             }
         }
+
+        cycles.remove(current);
     }
 
     private void mergeCandidatePackage(



Mime
View raw message