You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ri...@apache.org on 2011/07/18 21:07:10 UTC

svn commit: r1148008 - /felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/Candidates.java

Author: rickhall
Date: Mon Jul 18 19:07:09 2011
New Revision: 1148008

URL: http://svn.apache.org/viewvc?rev=1148008&view=rev
Log:
Create hash set on demand for fragment caps. (FELIX-2950)

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

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/Candidates.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/Candidates.java?rev=1148008&r1=1148007&r2=1148008&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/Candidates.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/resolver/Candidates.java Mon Jul 18 19:07:09 2011
@@ -210,7 +210,7 @@ class Candidates
             ResolveException rethrow = null;
             SortedSet<BundleCapability> candidates =
                 state.getCandidates((BundleRequirementImpl) req, true);
-            Set<BundleCapability> fragmentCands = new HashSet();
+            Set<BundleCapability> fragmentCands = null;
             for (Iterator<BundleCapability> itCandCap = candidates.iterator();
                 itCandCap.hasNext(); )
             {
@@ -223,6 +223,10 @@ class Candidates
                 // if the fragment is already attached to any hosts.
                 if (isFragment)
                 {
+                    if (fragmentCands == null)
+                    {
+                        fragmentCands = new HashSet<BundleCapability>();
+                    }
                     fragmentCands.add(candCap);
                 }
 
@@ -263,7 +267,7 @@ class Candidates
             // then also insert synthesized hosted capabilities for any other host
             // to which the fragment is attached since they are all effectively
             // unique capabilities.
-            if (!fragmentCands.isEmpty())
+            if (fragmentCands != null)
             {
                 for (BundleCapability fragCand : fragmentCands)
                 {