Fix exception in AntPathMatcher for leading *
Issue: SPR-13139
This commit is contained in:
parent
be4329545a
commit
63f01c851f
|
@ -747,7 +747,7 @@ public class AntPathMatcher implements PathMatcher {
|
||||||
this.doubleWildcards++;
|
this.doubleWildcards++;
|
||||||
pos += 2;
|
pos += 2;
|
||||||
}
|
}
|
||||||
else if (!this.pattern.substring(pos - 1).equals(".*")) {
|
else if (pos > 0 && !this.pattern.substring(pos - 1).equals(".*")) {
|
||||||
this.singleWildcards++;
|
this.singleWildcards++;
|
||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -479,6 +479,10 @@ public class AntPathMatcherTests {
|
||||||
|
|
||||||
// longer is better
|
// longer is better
|
||||||
assertEquals(1, comparator.compare("/hotels", "/hotels2"));
|
assertEquals(1, comparator.compare("/hotels", "/hotels2"));
|
||||||
|
|
||||||
|
//SPR-13139
|
||||||
|
assertEquals(-1, comparator.compare("*", "*/**"));
|
||||||
|
assertEquals(1, comparator.compare("*/**", "*"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue