You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Volker Karlmeier <vo...@magiccode.eu> on 2008/11/16 18:47:41 UTC
[PATCH] commons-digester / Allow recursive match in ExtendedBaseRules.java
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
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. Not ideal, but does the thing....
+ 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("!*");
- ------------------------------------------
Volker Karlmeier
Friedrich-Freye-Str. 61
45481 Mülheim/Ruhr
Tel. : (+49) 208-7785675
Mobil: (+49) 176-21056587
Mail : Volker@magiccode.eu
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
iD8DBQFJIFy9aEMQXBIqssERAk9KAJ0djVxRqQ5nBNzzo2hBuDmye3VRNQCePnAE
a7um94YvHSMHO+k9d/5sMA4=
=V8ly
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org