This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch 10.1.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.1.x by this push: new 98a89dfe63 Avoid possible NPEs 98a89dfe63 is described below commit 98a89dfe6318ec043e3ff8183e73754def6b65e1 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 b5f5acdb3a..53743b40e6 100644 --- a/java/org/apache/jasper/servlet/JspCServletContext.java +++ b/java/org/apache/jasper/servlet/JspCServletContext.java @@ -348,7 +348,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); @@ -425,7 +429,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