Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Bartel2013-09-09 02:29:36 +0000
committerJan Bartel2013-09-09 02:30:52 +0000
commit67bdc29b9b666fd32beba59413715115f505e56e (patch)
treeb58468dd5f2bc9b61d9ca4fbdd8cfde52de86f1a
parenta1cba900c5266ddba97a58f0e67e55b35418fc7e (diff)
downloadorg.eclipse.jetty.project-67bdc29b9b666fd32beba59413715115f505e56e.tar.gz
org.eclipse.jetty.project-67bdc29b9b666fd32beba59413715115f505e56e.tar.xz
org.eclipse.jetty.project-67bdc29b9b666fd32beba59413715115f505e56e.zip
416787 StringIndexOutOfBounds with a pathMap of ""
-rw-r--r--jetty-http/src/main/java/org/eclipse/jetty/http/PathMap.java3
-rw-r--r--jetty-http/src/test/java/org/eclipse/jetty/http/PathMapTest.java2
2 files changed, 5 insertions, 0 deletions
diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/PathMap.java b/jetty-http/src/main/java/org/eclipse/jetty/http/PathMap.java
index 0385c8ed66..d4e5119a3d 100644
--- a/jetty-http/src/main/java/org/eclipse/jetty/http/PathMap.java
+++ b/jetty-http/src/main/java/org/eclipse/jetty/http/PathMap.java
@@ -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=='/')
{
diff --git a/jetty-http/src/test/java/org/eclipse/jetty/http/PathMapTest.java b/jetty-http/src/test/java/org/eclipse/jetty/http/PathMapTest.java
index 36e9b2e158..65481f1435 100644
--- a/jetty-http/src/test/java/org/eclipse/jetty/http/PathMapTest.java
+++ b/jetty-http/src/test/java/org/eclipse/jetty/http/PathMapTest.java
@@ -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("", "/"));
}
/**

Back to the top