416787 StringIndexOutOfBounds with a pathMap of ""

This commit is contained in:
Jan Bartel 2013-09-09 12:41:28 +10:00
parent 28f3c1ac01
commit 11085742c8
2 changed files with 5 additions and 0 deletions

View File

@ -414,6 +414,9 @@ public class PathMap extends HashMap implements Externalizable
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

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