commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Volker Karlmeier (JIRA)" <j...@apache.org>
Subject [jira] Created: (DIGESTER-131) [PATCH] commons-digester / Allow recursive match in ExtendedBaseRules.java (see comments to patch)
Date Sun, 16 Nov 2008 21:18:44 GMT
[PATCH] commons-digester / Allow recursive match in ExtendedBaseRules.java (see comments to
patch)
--------------------------------------------------------------------------------------------------

                 Key: DIGESTER-131
                 URL: https://issues.apache.org/jira/browse/DIGESTER-131
             Project: Commons Digester
          Issue Type: Improvement
         Environment: all
            Reporter: Volker Karlmeier


Index: /home/volker/workspace/commons-digester/src/java/org/apache/commons/digester/ExtendedBaseRules.java
===================================================================
- --- /home/volker/workspace/commons-digester/src/java/org/apache/commons/digester/ExtendedBaseRules.java
   (revision 718060)
+++ /home/volker/workspace/commons-digester/src/java/org/apache/commons/digester/ExtendedBaseRules.java
   (working copy)
@@ -234,6 +234,32 @@
~         // we keep the list of universal matches separate
~         List universalList = new ArrayList(counter);

+        // Universal wildcards ('*') in the middle of the pattern-string
+        List recList = null;
+        int parentLastIndex=-1;
+        // temporary parentPattern
+        // we don't want to change anything....
+        String tempParentPattern = parentPattern;
+        // look for pattern. Here, we search the whole
+        // parent. 
+        while ((parentLastIndex = tempParentPattern.lastIndexOf('/')) > -1 &&
recList == null) { 
+            recList = (List) this.cache.get(tempParentPattern+"/*/"+pattern.substring(lastIndex+1));
+            if (recList != null) {
+                // when /*/-pattern-string is found, add method
+                // list to universalList.
+                // Digester will do the rest
+                universalList.addAll(recList);
+            } else {
+                // if not, shorten tempParent to move /*/ one position
+                // to the left.
+                // as last part of patttern is always added
+                // we make sure pattern is allowed anywhere.
+                tempParentPattern=parentPattern.substring(0, parentLastIndex);
+            }
+            +        }
+        +        ~         // Universal all wildards ('!*')
~         // These are always matched so always add them
~         List tempList = (List) this.cache.get("!*"); 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message