Re: Please review changes to WildcardHelper
Bruno Dumon <bruno <at> outerthought.org>
2006-06-01 13:49:50 GMT
On Thu, 2006-06-01 at 11:27 +0200, Carsten Ziegeler wrote:
> I just fixed the bug in our wildcard helper. The problem was the
> following: if a pattern ends with a constant string (like ".xml")
> and the uri in question contained this constant twice (like
> ("hello.xml.xml") the pattern did not match.
> I added a junit test case for this and now the tests all succeed.
> BUT, while looking at the wildcard helper code, I found several smelling
> code place, like unreachable code etc. which I cleaned up.
> In addition the fix for the bug "seems" to work, but I'm not 100% sure
> if it breaks something else.
> So, it would be great if others can review the code.
> I'm not sure if the code of the wildcard helper is correct at all; I
> guess there are still other cases where the pattern does not match
> although it should. So I think we have to rewrite the code anyway. One
> idea I had is to transform the pattern into a regexp and then use
> one of the regexp libraries for matching.
This won't be of much help, but I thought the wildcard matcher is
significantly faster than regexpes.
PS: I like the idea of moving it to commons-lang. I've used it on
several occasions outside Cocoon.
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center