[jboss-cvs] JBossAS SVN: r59086 - trunk/server/src/main/org/jboss/ejb/plugins

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Dec 18 13:37:26 EST 2006


Author: anil.saldhana at jboss.com
Date: 2006-12-18 13:37:25 -0500 (Mon, 18 Dec 2006)
New Revision: 59086

Modified:
   trunk/server/src/main/org/jboss/ejb/plugins/StatefulSessionInstanceInterceptor.java
Log:
check if there was really a push of a null subject context

Modified: trunk/server/src/main/org/jboss/ejb/plugins/StatefulSessionInstanceInterceptor.java
===================================================================
--- trunk/server/src/main/org/jboss/ejb/plugins/StatefulSessionInstanceInterceptor.java	2006-12-18 18:36:50 UTC (rev 59085)
+++ trunk/server/src/main/org/jboss/ejb/plugins/StatefulSessionInstanceInterceptor.java	2006-12-18 18:37:25 UTC (rev 59086)
@@ -212,6 +212,7 @@
       EnterpriseContext ctx = null;
       
       BeanLock lock = container.getLockManager().getLock(methodID);
+      boolean callerRunAsIdentityPresent = SecurityActions.peekRunAsIdentity() != null;
       try
       {
          /* The security context must be established before the cache
@@ -225,7 +226,7 @@
          of the ejb spec requirement that runtime exceptions should invalidate
          the session.
           */
-         if(SecurityActions.peekRunAsIdentity() == null)
+         if(!callerRunAsIdentityPresent)
             SecurityActions.pushSubjectContext(mi.getPrincipal(), mi.getCredential(), null);
 
          lock.sync();
@@ -317,7 +318,7 @@
          }
 
          // Set the current security information
-         ctx.setPrincipal(mi.getPrincipal());
+         ctx.setPrincipal(mi.getPrincipal()); 
 
          if (ejbTimeout.equals(mi.getMethod()))
             AllowedOperationsAssociation.pushInMethodFlag(IN_EJB_TIMEOUT);
@@ -390,7 +391,8 @@
       finally
       {
          container.getLockManager().removeLockRef(lock.getId());
-         SecurityActions.popSubjectContext();
+         if(!callerRunAsIdentityPresent)
+           SecurityActions.popSubjectContext();
       }
    }
    




More information about the jboss-cvs-commits mailing list