You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by ri...@apache.org on 2006/12/04 15:55:32 UTC

svn commit: r482203 - /incubator/openejb/branches/v2_2/openejb2/modules/openejb-corba/src/main/java/org/apache/openejb/corba/security/ServerSecurityInterceptor.java

Author: rickmcguire
Date: Mon Dec  4 06:55:32 2006
New Revision: 482203

URL: http://svn.apache.org/viewvc?view=rev&rev=482203
Log:
OPENEJB-395 ClassCastException in ServerSecurityInterceptor.


Modified:
    incubator/openejb/branches/v2_2/openejb2/modules/openejb-corba/src/main/java/org/apache/openejb/corba/security/ServerSecurityInterceptor.java

Modified: incubator/openejb/branches/v2_2/openejb2/modules/openejb-corba/src/main/java/org/apache/openejb/corba/security/ServerSecurityInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/openejb/branches/v2_2/openejb2/modules/openejb-corba/src/main/java/org/apache/openejb/corba/security/ServerSecurityInterceptor.java?view=diff&rev=482203&r1=482202&r2=482203
==============================================================================
--- incubator/openejb/branches/v2_2/openejb2/modules/openejb-corba/src/main/java/org/apache/openejb/corba/security/ServerSecurityInterceptor.java (original)
+++ incubator/openejb/branches/v2_2/openejb2/modules/openejb-corba/src/main/java/org/apache/openejb/corba/security/ServerSecurityInterceptor.java Mon Dec  4 06:55:32 2006
@@ -146,10 +146,25 @@
         } catch (SASException e) {
             log.error("SASException", e);
             SASReplyManager.setSASReply(ri.request_id(), generateContextError(e, contextId));
-            throw (RuntimeException) e.getCause();
+            // rethrowing this requires some special handling.  If the root exception is a
+            // RuntimeException, then we can just rethrow it.  Otherwise we need to turn this into
+            // a RuntimeException.
+            Throwable cause = e.getCause();
+            if (cause instanceof RuntimeException) {
+                throw (RuntimeException)cause;
+            }
+            else {
+                throw new RuntimeException(cause.getMessage(), cause);
+            }
         } catch (Exception e) {
             log.error("Exception", e);
-            throw (RuntimeException) e.getCause();
+            Throwable cause = e.getCause();
+            if (cause instanceof RuntimeException) {
+                throw (RuntimeException)cause;
+            }
+            else {
+                throw new RuntimeException(cause.getMessage(), cause);
+            }
         } finally {
             Thread.currentThread().setContextClassLoader(savedCL);
         }