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 28486] - [digester] ExtendedBaseRules test fails
Date Tue, 20 Apr 2004 07:35:24 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=28486>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=28486

[digester] ExtendedBaseRules test fails





------- Additional Comments From simon@ecnetwork.co.nz  2004-04-20 07:35 -------
Ok, I think I've got it pinned down. 

The test itself was a very good one. It asked:
 given the pattern "a/b/c/d"
 is the preferred match:
   */b/c/d
or */b/c/*

The specs for the ExtendedBaseRules class say that:
[quote]
*/a/b/*" matches any elements whose parentage path contains an element 'a'
followed by an element 'b'. The longest matching still applies but the length
excludes the '*' at the end.
[/quote]

The code currently tries to handle this by subtracting 1 from *new candidate
keys* when the length if (parentMatched || ancestorMatched). However:
(a) it should subtract 2(?) for patterns that both begin and end with wildcards, and
(b) it doesn't apply any corrections to the "previously longest key" it is
comparing against.

And when 2 patterns of the same "length" exist in the cache, and they both
match, only the first matching pattern is kept. So the current code passes the
test only if the cache returns the "correct" match first. Which it appears to do
with jvm 1.4 but not 1.2!

I will attach a patch soon. I would appreciate review of this, as it has the
potential to break a lot of stuff if it is wrong.

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


Mime
View raw message