felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r1101073 - /felix/trunk/framework/src/main/java/org/apache/felix/framework/EntryFilterEnumeration.java
Date Mon, 09 May 2011 15:49:47 GMT
Author: rickhall
Date: Mon May  9 15:49:47 2011
New Revision: 1101073

URL: http://svn.apache.org/viewvc?rev=1101073&view=rev
Log:
Avoid returning duplicates of synthesized directory entries. (FELIX-2935)

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

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/EntryFilterEnumeration.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/EntryFilterEnumeration.java?rev=1101073&r1=1101072&r2=1101073&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/EntryFilterEnumeration.java
(original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/EntryFilterEnumeration.java
Mon May  9 15:49:47 2011
@@ -90,12 +90,12 @@ class EntryFilterEnumeration implements 
 
     public synchronized boolean hasMoreElements()
     {
-        return (m_nextEntries.size() != 0);
+        return !m_nextEntries.isEmpty();
     }
 
     public synchronized Object nextElement()
     {
-        if (m_nextEntries.size() == 0)
+        if (m_nextEntries.isEmpty())
         {
             throw new NoSuchElementException("No more entries.");
         }
@@ -114,11 +114,11 @@ class EntryFilterEnumeration implements 
         {
             return;
         }
-        while ((m_moduleIndex < m_enumerations.size()) && (m_nextEntries.size()
== 0))
+        while ((m_moduleIndex < m_enumerations.size()) && m_nextEntries.isEmpty())
         {
             while (m_enumerations.get(m_moduleIndex) != null
                 && m_enumerations.get(m_moduleIndex).hasMoreElements()
-                && m_nextEntries.size() == 0)
+                && m_nextEntries.isEmpty())
             {
                 // Get the current entry to determine if it should be filtered or not.
                 String entryName = (String) m_enumerations.get(m_moduleIndex).nextElement();
@@ -198,7 +198,9 @@ class EntryFilterEnumeration implements 
                     // be filtered or not. If we are recursive or the current entry
                     // is a child (not a grandchild) of the initial path, then we need
                     // to check if it matches the file pattern.
-                    if (m_recurse || (dirSlashIdx < 0) || (dirSlashIdx == entryName.length()
- 1))
+                    if (!m_dirEntries.contains(entryName)
+                        && (m_recurse || (dirSlashIdx < 0)
+                            || (dirSlashIdx == entryName.length() - 1)))
                     {
                         // See if the file pattern matches the last element of the path.
                         if (SimpleFilter.compareSubstring(
@@ -219,7 +221,7 @@ class EntryFilterEnumeration implements 
                     }
                 }
             }
-            if (m_nextEntries.size() == 0)
+            if (m_nextEntries.isEmpty())
             {
                 m_moduleIndex++;
             }



Mime
View raw message