This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push: new 2f36c9534a Avoid possible NPEs 2f36c9534a is described below commit 2f36c9534a513bacd60014903d9e248df2146c21 Author: remm <r...@apache.org> AuthorDate: Wed Jan 17 12:49:02 2024 +0100 Avoid possible NPEs Found by coverity. --- java/org/apache/jasper/servlet/JspCServletContext.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/java/org/apache/jasper/servlet/JspCServletContext.java b/java/org/apache/jasper/servlet/JspCServletContext.java index 573b4751f6..b40cc98ebe 100644 --- a/java/org/apache/jasper/servlet/JspCServletContext.java +++ b/java/org/apache/jasper/servlet/JspCServletContext.java @@ -349,7 +349,11 @@ public class JspCServletContext implements ServletContext { return null; } try { - File f = new File(getResource(path).toURI()); + URL url = getResource(path); + if (url == null) { + return null; + } + File f = new File(url.toURI()); return f.getAbsolutePath(); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); @@ -426,7 +430,11 @@ public class JspCServletContext implements ServletContext { @Override public InputStream getResourceAsStream(String path) { try { - return getResource(path).openStream(); + URL url = getResource(path); + if (url == null) { + return null; + } + return url.openStream(); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); return null; --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org