User: fleury  
  Date: 00/08/16 17:23:19

  Modified:    src/main/org/jboss/security EJBSecurityManagerService.java
  Log:
  message fix from hugo pinto
  
  Revision  Changes    Path
  1.2       +32 -26    jboss/src/main/org/jboss/security/EJBSecurityManagerService.java
  
  Index: EJBSecurityManagerService.java
  ===================================================================
  RCS file: 
/products/cvs/ejboss/jboss/src/main/org/jboss/security/EJBSecurityManagerService.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- EJBSecurityManagerService.java    2000/08/06 21:52:14     1.1
  +++ EJBSecurityManagerService.java    2000/08/17 00:23:18     1.2
  @@ -21,6 +21,7 @@
   import javax.naming.Reference;
   import javax.naming.Name;
   import javax.naming.spi.ObjectFactory;
  +import javax.naming.CommunicationException;
   
   import javax.management.MBeanServer;
   import javax.management.ObjectName;
  @@ -39,6 +40,7 @@
    *      
    *   @see EJBSecurityManager
    *   @author Daniel O'Connor [EMAIL PROTECTED]
  + *   @author <a href="mailto:[EMAIL PROTECTED]">Hugo Pinto</a>
    */
   public class EJBSecurityManagerService
      extends ServiceMBeanSupport
  @@ -48,7 +50,7 @@
      public static String JNDI_NAME = "EJBSecurityManager";
       
      // Attributes ----------------------------------------------------
  -     MBeanServer server;
  +    MBeanServer server;
      
      // Static --------------------------------------------------------
      static EJBSecurityManager sm;
  @@ -57,26 +59,26 @@
      public String getName()
      {
         return "Security manager";
  -     }
  +    }
      
      protected ObjectName getObjectName(MBeanServer server, ObjectName name)
         throws javax.management.MalformedObjectNameException
      {
  -     this.server = server;
  +    this.server = server;
         return new ObjectName(OBJECT_NAME);
      }
  -     
  +    
      protected void initService()
         throws Exception
      {
  -        // Create a new SM
  -        sm = new EJBSecurityManagerDefaultImpl();
  -        
  -        // Bind reference to SM in JNDI
  -        Reference ref = new Reference(sm.getClass().toString(), 
getClass().getName(), null);
  -        new InitialContext().bind(JNDI_NAME, ref);
  +       // Create a new SM
  +       sm = new EJBSecurityManagerDefaultImpl();
  +       
  +       // Bind reference to SM in JNDI
  +       Reference ref = new Reference(sm.getClass().toString(), 
getClass().getName(), null);
  +       new InitialContext().bind(JNDI_NAME, ref);
      }
  -     
  +    
      protected void startService()
         throws Exception
      {
  @@ -84,25 +86,29 @@
      
      protected void stopService()
      {
  -             try
  -             {
  -                     // Remove SM from JNDI
  -                     new InitialContext().unbind(JNDI_NAME);
  -             } catch (Exception e)
  -             {
  -                     log.exception(e);
  -             }
  +       try
  +       {
  +         // Remove SM from JNDI
  +         new InitialContext().unbind(JNDI_NAME);
  +        } catch (CommunicationException e) {
  +            // Do nothing, the naming services is already stopped   
  +        }
  +        
  +       } catch (Exception e)
  +       {
  +         log.exception(e);
  +       }
      }
  -     
  -     // ObjectFactory implementation ----------------------------------
  -     public Object getObjectInstance(Object obj,
  +    
  +    // ObjectFactory implementation ----------------------------------
  +    public Object getObjectInstance(Object obj,
                                   Name name,
                                   Context nameCtx,
                                   Hashtable environment)
                            throws Exception
  -     {
  -             // Return the security manager
  -             return sm;
  -     }
  +    {
  +       // Return the security manager
  +       return sm;
  +    }
   }
   
  
  
  

Reply via email to