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 00e815405b Avoid NPE
00e815405b is described below

commit 00e815405b39b8e2293fcdcbad03e225e4c6b553
Author: remm <r...@apache.org>
AuthorDate: Fri Mar 28 16:18:57 2025 +0100

    Avoid NPE
    
    BZ69634
---
 java/org/apache/catalina/valves/JsonErrorReportValve.java | 5 ++++-
 webapps/docs/changelog.xml                                | 4 ++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/catalina/valves/JsonErrorReportValve.java 
b/java/org/apache/catalina/valves/JsonErrorReportValve.java
index f86f70cc0a..8d978a03f0 100644
--- a/java/org/apache/catalina/valves/JsonErrorReportValve.java
+++ b/java/org/apache/catalina/valves/JsonErrorReportValve.java
@@ -74,9 +74,12 @@ public class JsonErrorReportValve extends ErrorReportValve {
         if (message == null && throwable != null) {
             message = throwable.getMessage();
         }
+        if (message == null) {
+            message = "";
+        }
         String description = smClient.getString("http." + statusCode + 
".desc");
         if (description == null) {
-            if (message == null || message.isEmpty()) {
+            if (message.isEmpty()) {
                 return;
             } else {
                 description = 
smClient.getString("errorReportValve.noDescription");
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 1b548fe376..a8aa6f05b3 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -152,6 +152,10 @@
         made from within a web application with resource caching enabled.
         (markt)
       </fix>
+      <fix>
+        <bug>69634</bug>: Avoid NPE on <code>JsonErrorReportValve</code>.
+        (remm)
+      </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