Author: markt
Date: Fri Mar 17 15:15:19 2017
New Revision: 1787405

URL: http://svn.apache.org/viewvc?rev=1787405&view=rev
Log:
Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=60882
Fix a NullPointerException when obtaining a RequestDispatcher for a request 
that will not have any pathInfo associated with it.
This was a regression in the changes in 9.0.0.M18 for the Servlet 4.0 API 
changes.

Modified:
    tomcat/trunk/java/org/apache/catalina/core/ApplicationMapping.java
    tomcat/trunk/test/org/apache/catalina/core/TestApplicationMapping.java
    tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/catalina/core/ApplicationMapping.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ApplicationMapping.java?rev=1787405&r1=1787404&r2=1787405&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/ApplicationMapping.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/core/ApplicationMapping.java Fri Mar 
17 15:15:19 2017
@@ -57,8 +57,13 @@ public class ApplicationMapping {
                             "*" + path.substring(extIndex), 
mappingData.matchType, servletName);
                     break;
                 case PATH:
-                    mapping = new 
MappingImpl(mappingData.pathInfo.toString().substring(1),
-                            mappingData.wrapperPath.toString() + "/*",
+                    String matchValue;
+                    if (mappingData.pathInfo.isNull()) {
+                        matchValue = null;
+                    } else {
+                        matchValue = 
mappingData.pathInfo.toString().substring(1);
+                    }
+                    mapping = new MappingImpl(matchValue, 
mappingData.wrapperPath.toString() + "/*",
                             mappingData.matchType, servletName);
                     break;
                 case UNKNOWN:

Modified: tomcat/trunk/test/org/apache/catalina/core/TestApplicationMapping.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/core/TestApplicationMapping.java?rev=1787405&r1=1787404&r2=1787405&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/core/TestApplicationMapping.java 
(original)
+++ tomcat/trunk/test/org/apache/catalina/core/TestApplicationMapping.java Fri 
Mar 17 15:15:19 2017
@@ -59,6 +59,16 @@ public class TestApplicationMapping exte
     }
 
     @Test
+    public void testContextNonRootMappingPathNone() throws Exception {
+        doTestMapping("/dummy", "/foo/bar/*", "/foo/bar", null, "PATH");
+    }
+
+    @Test
+    public void testContextNonRootMappingPathSeparatorOnly() throws Exception {
+        doTestMapping("/dummy", "/foo/bar/*", "/foo/bar/", "", "PATH");
+    }
+
+    @Test
     public void testContextNonRootMappingPath() throws Exception {
         doTestMapping("/dummy", "/foo/bar/*", "/foo/bar/foo2", "foo2", "PATH");
     }

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1787405&r1=1787404&r2=1787405&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Fri Mar 17 15:15:19 2017
@@ -69,6 +69,12 @@
         by the <code>Rfc6265CookieProcessor</code> are aligned with the
         specification. Patch provided by Jim Griswold. (markt)
       </fix>
+      <fix>
+        <bug>60882</bug>: Fix a <code>NullPointerException</code> when 
obtaining
+        a <code>RequestDispatcher</code> for a request that will not have any
+        pathInfo associated with it. This was a regression in the changes in
+        9.0.0.M18 for the Servlet 4.0 API changes. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to