rdonkin 2003/11/18 14:32:16
Modified: digester/src/java/org/apache/commons/digester/plugins
PluginRules.java
Log:
Corrects patterns that begin with a leading slash. Submitted by Simon Kitching.
Revision Changes Path
1.7 +12 -4
jakarta-commons/digester/src/java/org/apache/commons/digester/plugins/PluginRules.java
Index: PluginRules.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/digester/src/java/org/apache/commons/digester/plugins/PluginRules.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- PluginRules.java 16 Nov 2003 22:37:35 -0000 1.6
+++ PluginRules.java 18 Nov 2003 22:32:16 -0000 1.7
@@ -224,7 +224,9 @@
/**
* Register a new Rule instance matching the specified pattern.
*
- * @param pattern Nesting pattern to be matched for this Rule
+ * @param pattern Nesting pattern to be matched for this Rule.
+ * This parameter treats equally patterns that begin with and without
+ * a leading slash ('/').
* @param rule Rule instance to be registered
*/
public void add(String pattern, Rule rule) {
@@ -234,6 +236,12 @@
if (debug) {
log.debug("add entry" + ": mapping pattern [" + pattern + "]" +
" to rule of type [" + rule.getClass().getName() + "]");
+ }
+
+ // allow patterns with a leading slash character
+ if (pattern.startsWith("/"))
+ {
+ pattern = pattern.substring(1);
}
decoratedRules.add(pattern, rule);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]