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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Jan 10 18:15:19 EST 2007


Author: anil.saldhana at jboss.com
Date: 2007-01-10 18:15:18 -0500 (Wed, 10 Jan 2007)
New Revision: 59498

Modified:
   trunk/server/src/main/org/jboss/ejb/plugins/StatefulSessionInstanceInterceptor.java
   trunk/server/src/main/org/jboss/ejb/plugins/StatefulSessionSecurityInterceptor.java
Log:
JBAS-3976: use the ctx on the invocation plus some comments added

Modified: trunk/server/src/main/org/jboss/ejb/plugins/StatefulSessionInstanceInterceptor.java
===================================================================
--- trunk/server/src/main/org/jboss/ejb/plugins/StatefulSessionInstanceInterceptor.java	2007-01-10 22:12:46 UTC (rev 59497)
+++ trunk/server/src/main/org/jboss/ejb/plugins/StatefulSessionInstanceInterceptor.java	2007-01-10 23:15:18 UTC (rev 59498)
@@ -133,7 +133,9 @@
       ctx.lock();
       
       // Set the current security information
-      //ctx.setPrincipal(mi.getPrincipal());
+      /**
+       * JBAS-3976: Setting principal on the context has been moved to a separate interceptor
+       */ 
  
       AllowedOperationsAssociation.pushInMethodFlag(IN_EJB_HOME);
 
@@ -318,7 +320,9 @@
          }
 
          // Set the current security information
-         //ctx.setPrincipal(mi.getPrincipal()); 
+         /**
+          * JBAS-3976: Setting principal on the context has been moved to a separate interceptor
+          */ 
 
          if (ejbTimeout.equals(mi.getMethod()))
             AllowedOperationsAssociation.pushInMethodFlag(IN_EJB_TIMEOUT);

Modified: trunk/server/src/main/org/jboss/ejb/plugins/StatefulSessionSecurityInterceptor.java
===================================================================
--- trunk/server/src/main/org/jboss/ejb/plugins/StatefulSessionSecurityInterceptor.java	2007-01-10 22:12:46 UTC (rev 59497)
+++ trunk/server/src/main/org/jboss/ejb/plugins/StatefulSessionSecurityInterceptor.java	2007-01-10 23:15:18 UTC (rev 59498)
@@ -37,7 +37,13 @@
  *  
  *  This interceptor is needed because the security interceptor happens after
  *  the instance interceptor in the case of SFSB due to the reason that 
- *  security exceptions need to invalidate the session
+ *  security exceptions need to invalidate the session.
+ *  
+ *  Note: This interceptor has to follow the SFSB instance interceptor in the 
+ *  call path as it obtains the enterprise context from the invocation
+ *  
+ *  JIRA Reference: JBAS-3976
+ *  
  *  @author <a href="mailto:Anil.Saldhana at jboss.org">Anil Saldhana</a>
  *  @since  Jan 10, 2007 
  *  @version $Revision$
@@ -63,7 +69,10 @@
    
    public Object invoke(Invocation mi) throws Exception
    {
-      EnterpriseContext ctx = container.getInstancePool().get();
+      EnterpriseContext ctx = (EnterpriseContext) mi.getEnterpriseContext();
+      if(ctx == null)
+         throw new IllegalStateException("EJBContext is null");
+      
       //Set the current security information
       ctx.setPrincipal(mi.getPrincipal());
       
@@ -83,7 +92,9 @@
       if (EJBObject.class.getMethod("getEJBHome", new Class[0]).equals(mi.getMethod()))
          return getNext().invokeHome(mi);
       
-      EnterpriseContext ctx = container.getInstancePool().get();
+      EnterpriseContext ctx = (EnterpriseContext) mi.getEnterpriseContext();
+      if(ctx == null)
+         throw new IllegalStateException("EJBContext is null");
       //Set the current security information
       ctx.setPrincipal(mi.getPrincipal());
        




More information about the jboss-cvs-commits mailing list