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

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


The following commit(s) were added to refs/heads/main by this push:
     new a98925e38 OWB-1386 - Print the exception's message when ERROR_0013 
occurs
a98925e38 is described below

commit a98925e3879f09f5e47639e07db02ffdf5e0561a
Author: tandraschko <[email protected]>
AuthorDate: Wed Apr 15 11:48:03 2026 +0200

    OWB-1386 - Print the exception's message when ERROR_0013 occurs
---
 .../src/main/java/org/apache/webbeans/config/OWBLogConst.java         | 2 +-
 webbeans-impl/src/main/resources/openwebbeans/Messages.properties     | 2 +-
 .../main/java/org/apache/webbeans/web/context/WebContextsService.java | 4 +++-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git 
a/webbeans-impl/src/main/java/org/apache/webbeans/config/OWBLogConst.java 
b/webbeans-impl/src/main/java/org/apache/webbeans/config/OWBLogConst.java
index ee906c762..0f0b5821d 100644
--- a/webbeans-impl/src/main/java/org/apache/webbeans/config/OWBLogConst.java
+++ b/webbeans-impl/src/main/java/org/apache/webbeans/config/OWBLogConst.java
@@ -83,7 +83,7 @@ public final class OWBLogConst
     public static final String ERROR_0010 = "ERROR_0010"; // An error occurred 
while closing the JMS instance.
     public static final String ERROR_0011 = "ERROR_0011"; // Method security 
access violation for method : [{0}] in decorator class : [{1}]
     public static final String ERROR_0012 = "ERROR_0012"; // Exception in 
calling method : [{0}] in decorator class : [{1}]. Look in the log for target 
checked exception.
-    public static final String ERROR_0013 = "ERROR_0013"; // An Exception 
occurred while starting a fresh session!
+    public static final String ERROR_0013 = "ERROR_0013"; // Caught an 
Exception while starting a fresh session: {0}
     public static final String ERROR_0014 = "ERROR_0014"; // Method illegal 
access for method : [{0}] in decorator class : [{1}]
     public static final String ERROR_0015 = "ERROR_0015"; // Illegal access 
exception for field : [{0}] in decorator class : [{1}]
     public static final String ERROR_0016 = "ERROR_0016"; // 
IllegalArgumentException has occurred while calling the field: [{0}] on the 
class: [{1}]
diff --git a/webbeans-impl/src/main/resources/openwebbeans/Messages.properties 
b/webbeans-impl/src/main/resources/openwebbeans/Messages.properties
index 9af063044..f0d6a53e7 100644
--- a/webbeans-impl/src/main/resources/openwebbeans/Messages.properties
+++ b/webbeans-impl/src/main/resources/openwebbeans/Messages.properties
@@ -72,7 +72,7 @@ ERROR_0009 = An error occurred while shutting down the plugin 
\: [{0}]
 ERROR_0010 = An error occurred while closing the JMS instance.
 ERROR_0011 = Method security access violation for method \: [{0}] in decorator 
class \: [{1}]
 ERROR_0012 = Exception in calling method \: [{0}] in decorator class \: [{1}]. 
Look in the log for target checked exception.
-ERROR_0013 = Caught an Exception while starting a fresh session!
+ERROR_0013 = Caught an Exception while starting a fresh session: {0}
 ERROR_0014 = Illegal access exception for method \: [{0}] in decorator class 
\: [{1}]
 ERROR_0015 = Illegal access exception for field \: [{0}] in decorator class \: 
[{1}]
 ERROR_0016 = IllegalArgumentException has occurred while calling the field \: 
[{0}] on the class \: [{1}]
diff --git 
a/webbeans-web/src/main/java/org/apache/webbeans/web/context/WebContextsService.java
 
b/webbeans-web/src/main/java/org/apache/webbeans/web/context/WebContextsService.java
index a70ead14f..128099d00 100644
--- 
a/webbeans-web/src/main/java/org/apache/webbeans/web/context/WebContextsService.java
+++ 
b/webbeans-web/src/main/java/org/apache/webbeans/web/context/WebContextsService.java
@@ -50,6 +50,7 @@ import jakarta.servlet.ServletRequestEvent;
 import jakarta.servlet.http.HttpServletRequest;
 import jakarta.servlet.http.HttpSession;
 import java.lang.annotation.Annotation;
+import java.util.Objects;
 import java.util.concurrent.TimeUnit;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -851,7 +852,8 @@ public class WebContextsService extends 
AbstractContextsService
             }
             catch (Exception e)
             {
-                logger.log(Level.SEVERE, 
WebBeansLoggerFacade.constructMessage(OWBLogConst.ERROR_0013, e));
+                logger.log(Level.SEVERE, 
WebBeansLoggerFacade.constructMessage(OWBLogConst.ERROR_0013,
+                        Objects.requireNonNullElse(e.getMessage(), 
e.toString())), e);
             }
         }
     }

Reply via email to