commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1187566 - /commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/RulesBase.java
Date Fri, 21 Oct 2011 21:50:51 GMT
Author: simonetripodi
Date: Fri Oct 21 21:50:50 2011
New Revision: 1187566

URL: http://svn.apache.org/viewvc?rev=1187566&view=rev
Log:
fixed PMD violation: These nested if statements could be combined

Modified:
    commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/RulesBase.java

Modified: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/RulesBase.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/RulesBase.java?rev=1187566&r1=1187565&r2=1187566&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/RulesBase.java
(original)
+++ commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/RulesBase.java
Fri Oct 21 21:50:50 2011
@@ -127,17 +127,13 @@ public class RulesBase
             String longKey = "";
             for ( String key : cache.keySet() )
             {
-                if ( key.startsWith( "*/" ) )
+                if ( key.startsWith( "*/" )
+                                && ( pattern.equals( key.substring( 2 ) ) || pattern.endsWith(
key.substring( 1 ) )
+                                && key.length() > longKey.length() ) )
                 {
-                    if ( pattern.equals( key.substring( 2 ) ) || pattern.endsWith( key.substring(
1 ) ) )
-                    {
-                        if ( key.length() > longKey.length() )
-                        {
-                            // rulesList = (List) this.cache.get(key);
-                            rulesList = lookup( namespaceURI, key );
-                            longKey = key;
-                        }
-                    }
+                    // rulesList = (List) this.cache.get(key);
+                    rulesList = lookup( namespaceURI, key );
+                    longKey = key;
                 }
             }
         }
@@ -161,7 +157,7 @@ public class RulesBase
     /**
      * Return a List of Rule instances for the specified pattern that also match the specified
namespace URI (if any).
      * If there are no such rules, return <code>null</code>.
-     * 
+     *
      * @param namespaceURI Namespace URI to match, or <code>null</code> to select
matching rules regardless of namespace
      *            URI
      * @param pattern Pattern to be matched



Mime
View raw message