User: juhalindfors
  Date: 02/03/13 13:17:40

  Modified:    src/main/org/jboss/mx/server/registry Tag: BranchMX_1_0
                        BasicMBeanRegistry.java
  Log:
  fixed an issue with MBeanRegistration potentially wrapped twice
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.9.2.1   +29 -3     
jmx/src/main/org/jboss/mx/server/registry/BasicMBeanRegistry.java
  
  Index: BasicMBeanRegistry.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jmx/src/main/org/jboss/mx/server/registry/BasicMBeanRegistry.java,v
  retrieving revision 1.9
  retrieving revision 1.9.2.1
  diff -u -r1.9 -r1.9.2.1
  --- BasicMBeanRegistry.java   8 Mar 2002 11:50:44 -0000       1.9
  +++ BasicMBeanRegistry.java   13 Mar 2002 21:17:40 -0000      1.9.2.1
  @@ -55,7 +55,7 @@
    * @author  <a href="mailto:[EMAIL PROTECTED]";>Juha Lindfors</a>.
    * @author  <a href="mailto:[EMAIL PROTECTED]";>Trevor Squires</a>.
    * @author  <a href="mailto:[EMAIL PROTECTED]";>Adrian Brock</a>.
  - * @version $Revision: 1.9 $
  + * @version $Revision: 1.9.2.1 $
    */
   public class BasicMBeanRegistry
      implements MBeanRegistry, BasicMBeanRegistryMBean
  @@ -210,11 +210,22 @@
               }
               catch (Exception e)
               {
  -               throw new MBeanRegistrationException(e, "Registration failed: " + 
e.toString());
  +               // if the MBean throws MBeanRegistrationException, don't rewrap it
  +               if (e instanceof MBeanRegistrationException)
  +               {
  +                  e.fillInStackTrace();
  +                  throw e;
  +               }
  +               
  +               throw new MBeanRegistrationException(e, "preRegister() failed: " + 
e.toString());
               }
               catch (Throwable t)
               {
  -               log.debug("Registration failed: ", t);
  +               // we can't wrap errors with MBeanRegistrationException
  +               
  +               log.debug("preRegister() failed: ", t);
  +               
  +               t.fillInStackTrace();
                  throw t;
               }
            }
  @@ -256,6 +267,8 @@
                     // Problem, remove a classloader from the repository
                     if (object instanceof ClassLoader)
                        loaderRepository.removeClassLoader((ClassLoader)object);
  +                     
  +                  t.fillInStackTrace();
                     throw t;
                  }
               }
  @@ -263,6 +276,8 @@
               {
                  // Problem, remove the mbean from the registry
                  remove(regName);
  +               
  +               t.fillInStackTrace();
                  throw t;
               }
            }
  @@ -275,6 +290,8 @@
            {
               // Something is broken
               log.error("Unexpected Exception:", t);
  +            
  +            t.fillInStackTrace();
               throw t;
            }
         }
  @@ -288,6 +305,8 @@
         {
            // The MBean cancelled the registration
            registrationDone = false;
  +         
  +         e.fillInStackTrace();
            throw e;
         }
         catch (RuntimeOperationsException e)
  @@ -332,6 +351,13 @@
            }
            catch (Exception e)
            {
  +            // don't double wrap MBeanRegistrationException
  +            if (e instanceof MBeanRegistrationException)
  +            {
  +               e.fillInStackTrace();
  +               throw (MBeanRegistrationException)e;
  +            }
  +            
               throw new MBeanRegistrationException(e, "preDeregister");
            }
         }
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to