Modified the filter implementation so that it would not cache passed in
dictionaries and service references inside its property mapper for the
LDAP evaluator. This was causing a somewhat benign garbage collection
issue.


git-svn-id: https://svn.apache.org/repos/asf/incubator/felix/trunk@468408 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/FilterImpl.java b/framework/src/main/java/org/apache/felix/framework/FilterImpl.java
index 0a77331..07dd9eb 100644
--- a/framework/src/main/java/org/apache/felix/framework/FilterImpl.java
+++ b/framework/src/main/java/org/apache/felix/framework/FilterImpl.java
@@ -129,8 +129,13 @@
     {
         try
         {
+            // Since the mapper instance is reused, we should
+            // null the source after use to avoid potential
+            // garbage collection issues.
             m_mapper.setSource(dict, false);
-            return m_evaluator.evaluate(m_mapper);
+            boolean result = m_evaluator.evaluate(m_mapper);
+            m_mapper.setSource(null, false);
+            return result;
         }
         catch (AttributeNotFoundException ex)
         {
@@ -155,8 +160,13 @@
     {
         try
         {
+            // Since the mapper instance is reused, we should
+            // null the source after use to avoid potential
+            // garbage collection issues.
             m_mapper.setSource(ref);
-            return m_evaluator.evaluate(m_mapper);
+            boolean result = m_evaluator.evaluate(m_mapper);
+            m_mapper.setSource(null);
+            return result;
         }
         catch (AttributeNotFoundException ex)
         {
@@ -169,12 +179,17 @@
         return false;
     }
 
-    public boolean matchCase(Dictionary dictionary)
+    public boolean matchCase(Dictionary dict)
     {
         try
         {
-            m_mapper.setSource(dictionary, true);
-            return m_evaluator.evaluate(m_mapper);
+            // Since the mapper instance is reused, we should
+            // null the source after use to avoid potential
+            // garbage collection issues.
+            m_mapper.setSource(dict, true);
+            boolean result = m_evaluator.evaluate(m_mapper);
+            m_mapper.setSource(null, true);
+            return result;
         }
         catch (AttributeNotFoundException ex)
         {