416787 StringIndexOutOfBounds with a pathMap of ""

This commit is contained in:
Jan Bartel 2013-09-09 12:29:36 +10:00
parent a1cba900c5
commit 67bdc29b9b
2 changed files with 5 additions and 0 deletions

View File

@ -401,6 +401,9 @@ public class PathMap<O> extends HashMap<String,O>
public static boolean match(String pathSpec, String path, boolean noDefault)
throws IllegalArgumentException
{
if (pathSpec.length()==0)
return "/".equals(path);
char c = pathSpec.charAt(0);
if (c=='/')
{

View File

@ -138,6 +138,8 @@ public class PathMapTest
assertTrue("!match *.foo", !PathMap.match("*.foo", "anything.bar"));
assertEquals("match / with ''", "10", p.getMatch("/").getValue());
assertTrue("match \"\"", PathMap.match("", "/"));
}
/**