cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Hartmann <>
Subject Re: Please review changes to WildcardHelper
Date Mon, 19 Jun 2006 09:09:35 GMT
Carsten Ziegeler wrote:
> Hi,
> 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.

We noticed a problem in Lenya:

       <map:match pattern="*/">
         <map:redirect-to uri="introduction.html"/>

After the change, this matches all URLs ending with a slash,
even ones containing slashes. This is not intended, is it?

I added a method to the WildcardHelperTestCase:

     public void testEndPattern() throws Exception {
         final Map resultMap = new HashMap();
         final String pattern = "*/";
         final int[] expr = WildcardHelper.compilePattern(pattern);
         boolean result = WildcardHelper.match(resultMap, "foo/bar/", expr);
         assertFalse("Url 'foo/bar/' should not match pattern '*/'.", result);

         result = WildcardHelper.match(resultMap, "foo/", expr);
         assertTrue("Url 'foo/' should match pattern '*/'", result);

resulting in:

     Testcase: testEndPattern took 0,003 sec FAILED
     Url 'foo/bar/' should not match pattern '*/'. 

Is this a bug, or do I misinterpret the matching functionality?


-- Andreas

Andreas Hartmann
Wyona Inc.  -   Open Source Content Management   -   Apache Lenya                       

View raw message