cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anathan...@apache.org
Subject svn commit: r446615 - in /cocoon/trunk/core/cocoon-core/src: main/java/org/apache/cocoon/util/WildcardMatcherHelper.java test/java/org/apache/cocoon/util/WildcardMatcherHelperTestCase.java
Date Fri, 15 Sep 2006 14:11:04 GMT
Author: anathaniel
Date: Fri Sep 15 07:11:03 2006
New Revision: 446615

URL: http://svn.apache.org/viewvc?view=rev&rev=446615
Log:
Core: Off-by-1 bug in WildcardMatcher found pattern matches which were not there.

Modified:
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/util/WildcardMatcherHelper.java
    cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/util/WildcardMatcherHelperTestCase.java

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/util/WildcardMatcherHelper.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/util/WildcardMatcherHelper.java?view=diff&rev=446615&r1=446614&r2=446615
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/util/WildcardMatcherHelper.java
(original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/util/WildcardMatcherHelper.java
Fri Sep 15 07:11:03 2006
@@ -237,7 +237,7 @@
                 int eistr = lstr - l;
 
                 // beause the '**' wildcard need to be greedy we scan from the end of the
string for a match
-                while(istr < eistr && ! strncmp(apat, sipat, astr, eistr, l))
eistr--;
+                while(istr <= eistr && ! strncmp(apat, sipat, astr, eistr, l))
eistr--;
 
                 if(istr > eistr) return false;
 

Modified: cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/util/WildcardMatcherHelperTestCase.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/util/WildcardMatcherHelperTestCase.java?view=diff&rev=446615&r1=446614&r2=446615
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/util/WildcardMatcherHelperTestCase.java
(original)
+++ cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/util/WildcardMatcherHelperTestCase.java
Fri Sep 15 07:11:03 2006
@@ -282,6 +282,12 @@
         assertEquals("html", result.get("3"));
     }
 
+    public void test36WildcardURIMatch()
+    throws Exception {
+        Map result = WildcardMatcherHelper.match("menu/**/foo/*", "menu/bar/baz.xml");
+        assertNull(result);
+    }
+
     public void testEmptyPattern() throws Exception {
         assertNotNull(WildcardMatcherHelper.match("", ""));
         assertNull(WildcardMatcherHelper.match("", "foo"));



Mime
View raw message