Parcourir la source

SEC-599: Refactoring to use Map.Entry for iterating through patterns.

Luke Taylor il y a 17 ans
Parent
commit
a40bb11be3

+ 5 - 4
core/src/main/java/org/springframework/security/intercept/web/AbstractFilterInvocationDefinitionSource.java

@@ -111,10 +111,11 @@ public abstract class AbstractFilterInvocationDefinitionSource implements Filter
             }
         }
 
-        Iterator patterns = requestMap.keySet().iterator();
+        Iterator entries = requestMap.entrySet().iterator();
 
-        while (patterns.hasNext()) {
-            Object p = patterns.next();            
+        while (entries.hasNext()) {
+            Map.Entry entry = (Map.Entry) entries.next();
+            Object p = entry.getKey();
             boolean matched = urlMatcher.pathMatchesUrl(p, url);
 
             if (logger.isDebugEnabled()) {
@@ -122,7 +123,7 @@ public abstract class AbstractFilterInvocationDefinitionSource implements Filter
             }
 
             if (matched) {
-                return (ConfigAttributeDefinition) getRequestMap().get(p);
+                return (ConfigAttributeDefinition) entry.getValue();
             }
         }
 

+ 0 - 8
core/src/test/java/org/springframework/security/intercept/web/AbstractFilterInvocationDefinitionSourceTests.java

@@ -47,14 +47,6 @@ public class AbstractFilterInvocationDefinitionSourceTests extends TestCase {
 
     //~ Methods ========================================================================================================
 
-    public static void main(String[] args) {
-        junit.textui.TestRunner.run(AbstractFilterInvocationDefinitionSourceTests.class);
-    }
-
-    public final void setUp() throws Exception {
-        super.setUp();
-    }
-
     public void testDoesNotSupportAnotherObject() {
         MockFilterInvocationDefinitionSource mfis = new MockFilterInvocationDefinitionSource(false, true);
         assertFalse(mfis.supports(String.class));