User: oleg    
  Date: 00/10/02 08:40:00

  Modified:    src/main/org/jboss/ejb MethodInvocation.java
  Log:
  BugFix: on rollback NullPointerException was thrown
  
  Revision  Changes    Path
  1.8       +89 -87    jboss/src/main/org/jboss/ejb/MethodInvocation.java
  
  Index: MethodInvocation.java
  ===================================================================
  RCS file: /products/cvs/ejboss/jboss/src/main/org/jboss/ejb/MethodInvocation.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- MethodInvocation.java     2000/09/30 00:59:39     1.7
  +++ MethodInvocation.java     2000/10/02 15:40:00     1.8
  @@ -20,14 +20,14 @@
   import org.jboss.logging.Logger;
   
   /**
  - *   MethodInvocation
  + *  MethodInvocation
    *
    *  This object carries the method to invoke and an identifier for the target ojbect
    *
  - *   @see <related>
  - *   @author Rickard �berg ([EMAIL PROTECTED])
  + *  @see <related>
  + *  @author Rickard �berg ([EMAIL PROTECTED])
    *  @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>.
  - *   @version $Revision: 1.7 $
  + *  @version $Revision: 1.8 $
    */
   public class MethodInvocation
   {
  @@ -36,13 +36,13 @@
      // Attributes ----------------------------------------------------
      Object id;
      Object[] args;
  -     
  -     Transaction tx;
  -     Principal identity;
  +    
  +    Transaction tx;
  +    Principal identity;
     Object credential;
   
  -     Method m;
  -     EnterpriseContext ctx;
  +    Method m;
  +    EnterpriseContext ctx;
   
      // Static --------------------------------------------------------
   
  @@ -50,11 +50,11 @@
      public MethodInvocation(Object id, Method m, Object[] args, Transaction tx,
       Principal identity, Object credential )
      {
  -             this.id = id;
  -             this.m = m;
  -             this.args = args;
  -             this.tx = tx;
  -             this.identity = identity;
  +        this.id = id;
  +        this.m = m;
  +        this.args = args;
  +        this.tx = tx;
  +        this.identity = identity;
       this.credential = credential;
      }
      // Public --------------------------------------------------------
  @@ -62,91 +62,93 @@
   
      public Method getMethod()
      {
  -             return m;       
  +        return m;   
      }
   
      public Object[] getArguments()
      {
         return args;
      }
  -     
  -     /*
  -     * setTransaction()
  -     *
  -     * This method sets the transaction associated with the method 
  -     * Note that this doesn't mean that the transaction is associated 
  -     * with the thread.  In fact this is the only place it exists until 
  -     * the TxInterceptor logic.  Notably it might be the case that the 
  +    
  +    /*
  +    * setTransaction()
  +    *
  +    * This method sets the transaction associated with the method 
  +    * Note that this doesn't mean that the transaction is associated 
  +    * with the thread.  In fact this is the only place it exists until 
  +    * the TxInterceptor logic.  Notably it might be the case that the 
       * tx associated here is different than the one on the target instance.
  -     */
  -     public void setTransaction(Transaction tx)
  -     {
  -             
  -//DEBUG              Logger.debug("Setting a transaction on Method 
invocation"+hashCode()+" "+m.getName()+" with "+tx);
  -             
  -             this.tx = tx;
  -             
  -     }
  -     
  -     public Transaction getTransaction()
  -     {
  -             return tx;
  -     }
  -
  -     public void setPrincipal(Principal identity)
  -     {
  -             this.identity = identity;
  -     }
  -
  -     public Principal getPrincipal()
  -     {
  -             return identity;
  -     }
  -
  -     public void setCredential(Object credential)
  -     {
  -             this.credential = credential;
  -     }
  -
  -     public Object getCredential()
  -     {
  -             return credential;
  -     }
  -
  -     /*
  -     * setEnterpriseContext()
  -     *
  -     * Once a context is associated to a Method Invocation the MI can pass it all 
the relevant information
  -     * We set Transaction and Principal
  -     */
  -     public void setEnterpriseContext(EnterpriseContext ctx)
  -     {
  -             this.ctx = ctx;
  -             
  -             //Set the transaction
  -             // MF FIXME: wrong decision. Setting the context is just an assocation 
of the
  -             // the Method invocation to the instance.  Decisions on the 
transaction association
  -             // should be done elsewhere (new interceptor)
  -             //ctx.setTransaction(tx);
  -             
  -             // Set the principal
  -             // MF FIXME: a warning really.  The association of the context 
variables (tx, principal)
  -             // to the enterprise Context should not be done here but by the final 
interceptor in the
  -             // container, it will signify that the instance is indeed ready for 
calling
  -             ctx.setPrincipal(identity);
  -     }
  -
  -     public EnterpriseContext getEnterpriseContext()
  -     {
  -             return ctx;
  -     }
  +    */
  +    public void setTransaction(Transaction tx)
  +    {
  +        
  +//DEBUG     Logger.debug("Setting a transaction on Method invocation"+hashCode()+" 
"+m.getName()+" with "+tx);
  +        
  +        this.tx = tx;
  +        
  +    }
  +    
  +    public Transaction getTransaction()
  +    {
  +        return tx;
  +    }
  +
  +    public void setPrincipal(Principal identity)
  +    {
  +        this.identity = identity;
  +    }
  +
  +    public Principal getPrincipal()
  +    {
  +        return identity;
  +    }
  +
  +    public void setCredential(Object credential)
  +    {
  +        this.credential = credential;
  +    }
  +
  +    public Object getCredential()
  +    {
  +        return credential;
  +    }
  +
  +    /*
  +    * setEnterpriseContext()
  +    *
  +    * Once a context is associated to a Method Invocation the MI can pass it all 
the relevant information
  +    * We set Transaction and Principal
  +    */
  +    public void setEnterpriseContext(EnterpriseContext ctx)
  +    {
  +        this.ctx = ctx;
  +        
  +        //Set the transaction
  +        // MF FIXME: wrong decision. Setting the context is just an assocation of 
the
  +        // the Method invocation to the instance.  Decisions on the transaction 
association
  +        // should be done elsewhere (new interceptor)
  +        //ctx.setTransaction(tx);
  +        
  +        // Set the principal
  +        // MF FIXME: a warning really.  The association of the context variables 
(tx, principal)
  +        // to the enterprise Context should not be done here but by the final 
interceptor in the
  +        // container, it will signify that the instance is indeed ready for calling
  +        if (ctx != null) {
  +            ctx.setPrincipal(identity);
  +        }
  +    }
  +
  +    public EnterpriseContext getEnterpriseContext()
  +    {
  +        return ctx;
  +    }
   
      // Package protected ---------------------------------------------
   
      // Protected -----------------------------------------------------
   
      // Private -------------------------------------------------------
  -     
  -     // Inner classes -------------------------------------------------
  +    
  +    // Inner classes -------------------------------------------------
   }
   
  
  
  

Reply via email to