commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 11693] - CallMethod rule on nested indentical elements cause parameter confusion
Date Thu, 12 Sep 2002 16:02:42 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11693>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11693

CallMethod rule on nested indentical elements cause parameter confusion

smanux@lfjr.net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Keywords|                            |PatchAvailable



------- Additional Comments From smanux@lfjr.net  2002-09-12 16:02 -------
I just identified the cause of this issue. The attribute value is added to the
parameter array at the end of the tag, this lets plenty of time for it to be
overwritten by another attribute matching the same rule. For example :

1  <toplevel>
2    <element name="A">
3      <element name="B">
4      </element>
5    </element>
6  </toplevel>

with the rules :

digester.addCallMethod("*/element", "append", 1);
digester.addCallParam("*/element", 0, "name");

line 2 : the first parameter array is pushed on the top of the stack, the
attribute value (A) is set to the bodyText of the CallParamRule but not yet
written in the parameter array.

line 3 : the second parameter array is pushed on the stack, the attribute value
(B) is set to the same CallParamRule bodyText, overwritting the previous value (A).

line 4 : the end of the 2nd element is reached, the CallParamRule bodyText value
(B) is added to the 2nd parameter array. The method is then invoked.

line 5 : the end of the 1st element is reached, the CallParamRule bodyText value
(B) is added to the 1st parameter array (A was expected). The method is then
invoked.


The solution is simply to add the attribute value at the beginning and not at
the end. For body parameters the value is still added to the array at the end of
the element of course. I'll post a patch soon.

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message