This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
     new 4a1029acd2 Avoid NPE
4a1029acd2 is described below

commit 4a1029acd215966f0ff5a1a19ae5e5f8a51e44fc
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 e452935fe2..6bd7a18e0e 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -202,6 +202,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