Hi,

The first attached patch is just a fix for a minor javadoc problem
introduced in an earlier patch.

====

The second patch is perhaps more controversial: it allows a leading
slash on patterns for the PluginRules class.

ie "/root/item" is treated just like "root/item".

This is useful because plugin classes usually do something like this:
  digester.add....(basePattern + "/mychildtag");

If the base pattern is "", then the pattern ends up with a leading
slash, which is not good.

This patch definitely does *not* alter the behaviour of any code outside
plugins (though I think it would be nice for all the Rules classes to
allow leading slashes anyway).

Regards,

Simon
Index: src/java/org/apache/commons/digester/plugins/PluginCreateRule.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons/digester/src/java/org/apache/commons/digester/plugins/PluginCreateRule.java,v
retrieving revision 1.8
diff -u -r1.8 PluginCreateRule.java
--- src/java/org/apache/commons/digester/plugins/PluginCreateRule.java	16 Nov 2003 22:37:35 -0000	1.8
+++ src/java/org/apache/commons/digester/plugins/PluginCreateRule.java	16 Nov 2003 22:47:53 -0000
@@ -301,8 +301,8 @@
      * associated with the specified pattern. Check all configuration data is
      * valid and remember the pattern for later.
      * 
-     * @param pattern is the digester match pattern that is associated with
-     * this rule instance, eg "root/widget".
+     * @param matchPattern is the digester match pattern that is associated 
+     * with this rule instance, eg "root/widget".
      * @exception PluginConfigurationException
      */
     public void postRegisterInit(String matchPattern)
Index: src/java/org/apache/commons/digester/plugins/PluginRules.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons/digester/src/java/org/apache/commons/digester/plugins/PluginRules.java,v
retrieving revision 1.6
diff -u -r1.6 PluginRules.java
--- src/java/org/apache/commons/digester/plugins/PluginRules.java	16 Nov 2003 22:37:35 -0000	1.6
+++ src/java/org/apache/commons/digester/plugins/PluginRules.java	16 Nov 2003 22:46:29 -0000
@@ -236,6 +236,12 @@
                   " 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);
 
         if (rule instanceof InitializableRule) {

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to