You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Volker Karlmeier (JIRA)" <ji...@apache.org> on 2008/11/16 22:18:44 UTC
[jira] Created: (DIGESTER-131) [PATCH] commons-digester / Allow
recursive match in ExtendedBaseRules.java (see comments to patch)
[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.
[jira] Updated: (DIGESTER-131) [PATCH] commons-digester / Allow
recursive match in ExtendedBaseRules.java (see patch)
Posted by "Rahul Akolkar (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIGESTER-131?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Rahul Akolkar updated DIGESTER-131:
-----------------------------------
Fix Version/s: 2.1
1.8.2
Setting fix versions so this will be looked at before the next release.
> [PATCH] commons-digester / Allow recursive match in ExtendedBaseRules.java (see patch)
> --------------------------------------------------------------------------------------
>
> Key: DIGESTER-131
> URL: https://issues.apache.org/jira/browse/DIGESTER-131
> Project: Commons Digester
> Issue Type: Improvement
> Environment: all
> Reporter: Volker Karlmeier
> Fix For: 1.8.2, 2.1
>
> Attachments: ExtendedBaseRules.patch
>
> Original Estimate: 0.17h
> Remaining Estimate: 0.17h
>
> Recursive tags in XML-rules-file only work on root node. Nested nodes like the one below to not work.
> With the attached patch, it is possible to specify rules like
> <...>
> <...>
> <pattern value="*/properties">
> <object-create-rule classname="de.wsy.f4ja.alertbatches.configuration.alerting.alertingconfig.Properties" />
> <set-properties-rule />
> <set-next-rule methodname="addProperties"/>
> </pattern>
>
> <pattern value="*/property">
> <object-create-rule classname="de.wsy.f4ja.alertbatches.configuration.alerting.alertingconfig.Property" />
> <set-properties-rule />
> <set-next-rule methodname="addProperty" />
> </pattern>
> </...>
> </..>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (DIGESTER-131) [PATCH] commons-digester / Allow
recursive match in ExtendedBaseRules.java (see patch)
Posted by "Simone Tripodi (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIGESTER-131?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Simone Tripodi updated DIGESTER-131:
------------------------------------
Fix Version/s: 2.2
(was: 2.1)
> [PATCH] commons-digester / Allow recursive match in ExtendedBaseRules.java (see patch)
> --------------------------------------------------------------------------------------
>
> Key: DIGESTER-131
> URL: https://issues.apache.org/jira/browse/DIGESTER-131
> Project: Commons Digester
> Issue Type: Improvement
> Environment: all
> Reporter: Volker Karlmeier
> Fix For: 1.8.2, 2.2
>
> Attachments: ExtendedBaseRules.patch
>
> Original Estimate: 0.17h
> Remaining Estimate: 0.17h
>
> Recursive tags in XML-rules-file only work on root node. Nested nodes like the one below to not work.
> With the attached patch, it is possible to specify rules like
> <...>
> <...>
> <pattern value="*/properties">
> <object-create-rule classname="de.wsy.f4ja.alertbatches.configuration.alerting.alertingconfig.Properties" />
> <set-properties-rule />
> <set-next-rule methodname="addProperties"/>
> </pattern>
>
> <pattern value="*/property">
> <object-create-rule classname="de.wsy.f4ja.alertbatches.configuration.alerting.alertingconfig.Property" />
> <set-properties-rule />
> <set-next-rule methodname="addProperty" />
> </pattern>
> </...>
> </..>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DIGESTER-131) [PATCH] commons-digester / Allow
recursive match in ExtendedBaseRules.java (see patch)
Posted by "Simone Tripodi (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIGESTER-131?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12921280#action_12921280 ]
Simone Tripodi commented on DIGESTER-131:
-----------------------------------------
Hi Volker,
apologizes but I wasn't able to manage that issue before :(
Looking forward to publish 2.2 ASAP including the submitted patch, It would be nicer if you can provide in the patch also a TestCase that shows the benefit of the submitted code.
Sorry but I'm not familiar with XML config, can you post here in the comments a sample that shows which is now allowed that was not admitted before?
Many thanks in advance and apologizes once again,
Simo
> [PATCH] commons-digester / Allow recursive match in ExtendedBaseRules.java (see patch)
> --------------------------------------------------------------------------------------
>
> Key: DIGESTER-131
> URL: https://issues.apache.org/jira/browse/DIGESTER-131
> Project: Commons Digester
> Issue Type: Improvement
> Environment: all
> Reporter: Volker Karlmeier
> Fix For: 1.8.2, 2.2
>
> Attachments: ExtendedBaseRules.patch
>
> Original Estimate: 0.17h
> Remaining Estimate: 0.17h
>
> Recursive tags in XML-rules-file only work on root node. Nested nodes like the one below to not work.
> With the attached patch, it is possible to specify rules like
> <...>
> <...>
> <pattern value="*/properties">
> <object-create-rule classname="de.wsy.f4ja.alertbatches.configuration.alerting.alertingconfig.Properties" />
> <set-properties-rule />
> <set-next-rule methodname="addProperties"/>
> </pattern>
>
> <pattern value="*/property">
> <object-create-rule classname="de.wsy.f4ja.alertbatches.configuration.alerting.alertingconfig.Property" />
> <set-properties-rule />
> <set-next-rule methodname="addProperty" />
> </pattern>
> </...>
> </..>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DIGESTER-131) [PATCH] commons-digester / Allow
recursive match in ExtendedBaseRules.java (see patch)
Posted by "Volker Karlmeier (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIGESTER-131?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12921098#action_12921098 ]
Volker Karlmeier commented on DIGESTER-131:
-------------------------------------------
Hi Simone,
why do you move this patch to the future ?
Rahul told me to consider this patch in 2.1
Regards
Volker
--
-------------------------------
words a just some place to hide
a wall that we can run behind..
-------------------------------
Volker Karlmeier
Friedrich-Freye-Str. 61
45481 Mlheim/Ruhr
Tel. : (+49) 208-7785675
Mobil: (+49) 176-21056587
Mail : Volker@magiccode.eu
> [PATCH] commons-digester / Allow recursive match in ExtendedBaseRules.java (see patch)
> --------------------------------------------------------------------------------------
>
> Key: DIGESTER-131
> URL: https://issues.apache.org/jira/browse/DIGESTER-131
> Project: Commons Digester
> Issue Type: Improvement
> Environment: all
> Reporter: Volker Karlmeier
> Fix For: 1.8.2, 2.2
>
> Attachments: ExtendedBaseRules.patch
>
> Original Estimate: 0.17h
> Remaining Estimate: 0.17h
>
> Recursive tags in XML-rules-file only work on root node. Nested nodes like the one below to not work.
> With the attached patch, it is possible to specify rules like
> <...>
> <...>
> <pattern value="*/properties">
> <object-create-rule classname="de.wsy.f4ja.alertbatches.configuration.alerting.alertingconfig.Properties" />
> <set-properties-rule />
> <set-next-rule methodname="addProperties"/>
> </pattern>
>
> <pattern value="*/property">
> <object-create-rule classname="de.wsy.f4ja.alertbatches.configuration.alerting.alertingconfig.Property" />
> <set-properties-rule />
> <set-next-rule methodname="addProperty" />
> </pattern>
> </...>
> </..>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (DIGESTER-131) [PATCH] commons-digester / Allow
recursive match in ExtendedBaseRules.java (see comments to patch)
Posted by "Volker Karlmeier (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIGESTER-131?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Volker Karlmeier updated DIGESTER-131:
--------------------------------------
Attachment: ExtendedBaseRules.patch
> [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
> Attachments: ExtendedBaseRules.patch
>
> Original Estimate: 0.17h
> Remaining Estimate: 0.17h
>
> 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.
[jira] Updated: (DIGESTER-131) [PATCH] commons-digester / Allow
recursive match in ExtendedBaseRules.java (see patch)
Posted by "Volker Karlmeier (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIGESTER-131?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Volker Karlmeier updated DIGESTER-131:
--------------------------------------
Description:
Recursive tags in XML-rules-file only work on root node. Nested nodes like the one below to not work.
With the attached patch, it is possible to specify rules like
<...>
<...>
<pattern value="*/properties">
<object-create-rule classname="de.wsy.f4ja.alertbatches.configuration.alerting.alertingconfig.Properties" />
<set-properties-rule />
<set-next-rule methodname="addProperties"/>
</pattern>
<pattern value="*/property">
<object-create-rule classname="de.wsy.f4ja.alertbatches.configuration.alerting.alertingconfig.Property" />
<set-properties-rule />
<set-next-rule methodname="addProperty" />
</pattern>
</...>
</..>
was:
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("!*");
Summary: [PATCH] commons-digester / Allow recursive match in ExtendedBaseRules.java (see patch) (was: [PATCH] commons-digester / Allow recursive match in ExtendedBaseRules.java (see comments to patch))
> [PATCH] commons-digester / Allow recursive match in ExtendedBaseRules.java (see patch)
> --------------------------------------------------------------------------------------
>
> Key: DIGESTER-131
> URL: https://issues.apache.org/jira/browse/DIGESTER-131
> Project: Commons Digester
> Issue Type: Improvement
> Environment: all
> Reporter: Volker Karlmeier
> Attachments: ExtendedBaseRules.patch
>
> Original Estimate: 0.17h
> Remaining Estimate: 0.17h
>
> Recursive tags in XML-rules-file only work on root node. Nested nodes like the one below to not work.
> With the attached patch, it is possible to specify rules like
> <...>
> <...>
> <pattern value="*/properties">
> <object-create-rule classname="de.wsy.f4ja.alertbatches.configuration.alerting.alertingconfig.Properties" />
> <set-properties-rule />
> <set-next-rule methodname="addProperties"/>
> </pattern>
>
> <pattern value="*/property">
> <object-create-rule classname="de.wsy.f4ja.alertbatches.configuration.alerting.alertingconfig.Property" />
> <set-properties-rule />
> <set-next-rule methodname="addProperty" />
> </pattern>
> </...>
> </..>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DIGESTER-131) [PATCH] commons-digester / Allow
recursive match in ExtendedBaseRules.java (see comments to patch)
Posted by "Volker Karlmeier (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DIGESTER-131?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12648033#action_12648033 ]
Volker Karlmeier commented on DIGESTER-131:
-------------------------------------------
The above patch for ExtendedBaseRules provides the possibility of matching recursive patterns in subnodes.
> [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
> Original Estimate: 0.17h
> Remaining Estimate: 0.17h
>
> 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.