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 45bd08f34b Avoid three possible NPEs 45bd08f34b is described below commit 45bd08f34b2a471c27edcb2c12403e3304a4d82c Author: remm <r...@apache.org> AuthorDate: Fri Sep 8 15:27:07 2023 +0200 Avoid three possible NPEs Found by coverity. --- java/org/apache/catalina/mbeans/ContextMBean.java | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/java/org/apache/catalina/mbeans/ContextMBean.java b/java/org/apache/catalina/mbeans/ContextMBean.java index d36ad25ea6..9afea8a392 100644 --- a/java/org/apache/catalina/mbeans/ContextMBean.java +++ b/java/org/apache/catalina/mbeans/ContextMBean.java @@ -77,7 +77,12 @@ public class ContextMBean extends BaseCatalinaMBean<Context> { */ public String findErrorPage(int errorCode) throws MBeanException { Context context = doGetManagedResource(); - return context.findErrorPage(errorCode).toString(); + ErrorPage errorPage = context.findErrorPage(errorCode); + if (errorPage != null) { + return context.findErrorPage(errorCode).toString(); + } else { + return null; + } } @@ -91,7 +96,12 @@ public class ContextMBean extends BaseCatalinaMBean<Context> { */ public String findErrorPage(Throwable exceptionType) throws MBeanException { Context context = doGetManagedResource(); - return context.findErrorPage(exceptionType).toString(); + ErrorPage errorPage = context.findErrorPage(exceptionType); + if (errorPage != null) { + return errorPage.toString(); + } else { + return null; + } } @@ -128,7 +138,11 @@ public class ContextMBean extends BaseCatalinaMBean<Context> { Context context = doGetManagedResource(); FilterDef filterDef = context.findFilterDef(name); - return filterDef.toString(); + if (filterDef != null) { + return filterDef.toString(); + } else { + return null; + } } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org