This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/8.5.x by this push: new 27adc25 Fix NPE regression in 6c03319 27adc25 is described below commit 27adc252a0fc8ad254a053c8c8ce0e0af8e4f73d Author: Mark Thomas <ma...@apache.org> AuthorDate: Sun Nov 17 17:27:14 2019 +0000 Fix NPE regression in 6c03319 --- .../apache/catalina/core/ApplicationMapping.java | 77 ++++++++++++---------- 1 file changed, 42 insertions(+), 35 deletions(-) diff --git a/java/org/apache/catalina/core/ApplicationMapping.java b/java/org/apache/catalina/core/ApplicationMapping.java index acf1b37..4d28f7a 100644 --- a/java/org/apache/catalina/core/ApplicationMapping.java +++ b/java/org/apache/catalina/core/ApplicationMapping.java @@ -32,42 +32,49 @@ public class ApplicationMapping { public HttpServletMapping getHttpServletMapping() { if (mapping == null) { - String servletName; - if (mappingData.wrapper == null) { - servletName = ""; + if (mappingData == null) { + // This can happen when dispatching from an application provided + // request object that does not provide the Servlet 4.0 mapping + // data. + mapping = new MappingImpl("", "", null, ""); } else { - servletName = mappingData.wrapper.getName(); - } - if (mappingData.matchType == null) { - mapping = new MappingImpl("", "", null, servletName); - } else { - switch (mappingData.matchType) { - case CONTEXT_ROOT: - mapping = new MappingImpl("", "", mappingData.matchType, servletName); - break; - case DEFAULT: - mapping = new MappingImpl("", "/", mappingData.matchType, servletName); - break; - case EXACT: - mapping = new MappingImpl(mappingData.wrapperPath.toString().substring(1), - mappingData.wrapperPath.toString(), mappingData.matchType, servletName); - break; - case EXTENSION: - String path = mappingData.wrapperPath.toString(); - int extIndex = path.lastIndexOf('.'); - mapping = new MappingImpl(path.substring(1, extIndex), - "*" + path.substring(extIndex), mappingData.matchType, servletName); - break; - case PATH: - 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; + String servletName; + if (mappingData.wrapper == null) { + servletName = ""; + } else { + servletName = mappingData.wrapper.getName(); + } + if (mappingData.matchType == null) { + mapping = new MappingImpl("", "", null, servletName); + } else { + switch (mappingData.matchType) { + case CONTEXT_ROOT: + mapping = new MappingImpl("", "", mappingData.matchType, servletName); + break; + case DEFAULT: + mapping = new MappingImpl("", "/", mappingData.matchType, servletName); + break; + case EXACT: + mapping = new MappingImpl(mappingData.wrapperPath.toString().substring(1), + mappingData.wrapperPath.toString(), mappingData.matchType, servletName); + break; + case EXTENSION: + String path = mappingData.wrapperPath.toString(); + int extIndex = path.lastIndexOf('.'); + mapping = new MappingImpl(path.substring(1, extIndex), + "*" + path.substring(extIndex), mappingData.matchType, servletName); + break; + case PATH: + 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; + } } } } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org