You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rz...@apache.org on 2026/05/12 09:25:14 UTC

(tomee) branch main updated: TOMEE-4610 - RemoteException is not chained with AuthenticationException at openejb-client authentication (#2549)

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

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


The following commit(s) were added to refs/heads/main by this push:
     new c1265958ab TOMEE-4610 - RemoteException is not chained with AuthenticationException at openejb-client authentication (#2549)
c1265958ab is described below

commit c1265958ab29ac297f3bd24803510849a139d375
Author: Florian Courault <49...@users.noreply.github.com>
AuthorDate: Tue May 12 11:22:48 2026 +0200

    TOMEE-4610 - RemoteException is not chained with AuthenticationException at openejb-client authentication (#2549)
    
    * RemoteException is not chained with AuthenticationException at openejb-client authentication
    
    * Apply same cause chaining to JNDIContext.logout()
    
    Mirror the fix from authenticate(): when the RemoteException from
    Client.request fails the logout, wrap it via initCause so the original
    cause is preserved instead of only the localized message. Matches the
    existing pattern used at the AUTH_DENIED branch a few lines below.
    
    ---------
    
    Co-authored-by: Richard Zowalla <rz...@apache.org>
---
 .../src/main/java/org/apache/openejb/client/JNDIContext.java          | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/server/openejb-client/src/main/java/org/apache/openejb/client/JNDIContext.java b/server/openejb-client/src/main/java/org/apache/openejb/client/JNDIContext.java
index 0d5884c952..4159ae773a 100644
--- a/server/openejb-client/src/main/java/org/apache/openejb/client/JNDIContext.java
+++ b/server/openejb-client/src/main/java/org/apache/openejb/client/JNDIContext.java
@@ -377,7 +377,7 @@ public class JNDIContext implements InitialContextFactory, Context {
         try {
             res = requestAuthorization(req);
         } catch (RemoteException e) {
-            throw new AuthenticationException(e.getLocalizedMessage());
+            throw (AuthenticationException) new AuthenticationException(e.getLocalizedMessage()).initCause(e);
         }
 
         switch (res.getResponseCode()) {
@@ -767,7 +767,7 @@ public class JNDIContext implements InitialContextFactory, Context {
         try {
             response = LogoutResponse.class.cast(Client.request(request, new LogoutResponse(), server));
         } catch (final RemoteException e) {
-            throw new AuthenticationException(e.getLocalizedMessage());
+            throw (AuthenticationException) new AuthenticationException(e.getLocalizedMessage()).initCause(e);
         }
 
         switch (response.getResponseCode()) {