tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amy...@apache.org
Subject cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans MBeanUtils.java
Date Tue, 22 Jan 2002 18:05:26 GMT
amyroh      02/01/22 10:05:25

  Modified:    catalina/src/share/org/apache/catalina/mbeans
                        MBeanUtils.java
  Log:
  Fix NPE problem to be more robust so that it allows to have custom components.
  Thanks to Remy for noticing the problem.
  
  Revision  Changes    Path
  1.10      +72 -4     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/MBeanUtils.java
  
  Index: MBeanUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/MBeanUtils.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- MBeanUtils.java	21 Jan 2002 21:24:04 -0000	1.9
  +++ MBeanUtils.java	22 Jan 2002 18:05:25 -0000	1.10
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/MBeanUtils.java,v
1.9 2002/01/21 21:24:04 remm Exp $
  - * $Revision: 1.9 $
  - * $Date: 2002/01/21 21:24:04 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/mbeans/MBeanUtils.java,v
1.10 2002/01/22 18:05:25 amyroh Exp $
  + * $Revision: 1.10 $
  + * $Date: 2002/01/22 18:05:25 $
    *
    * ====================================================================
    *
  @@ -103,7 +103,7 @@
    *
    * @author Craig R. McClanahan
    * @author Amy Roh
  - * @version $Revision: 1.9 $ $Date: 2002/01/21 21:24:04 $
  + * @version $Revision: 1.10 $ $Date: 2002/01/22 18:05:25 $
    */
   
   public class MBeanUtils {
  @@ -177,6 +177,11 @@
   
           String mname = createManagedName(connector);
           ManagedBean managed = registry.findManagedBean(mname);
  +        if (managed == null) {
  +            // FIX ME
  +            // shoud we log "ManagedBean not found with ManagedName " + mname?
  +            return null;
  +        }
           String domain = managed.getDomain();
           if (domain == null)
               domain = mserver.getDefaultDomain();
  @@ -201,6 +206,9 @@
   
           String mname = createManagedName(context);
           ManagedBean managed = registry.findManagedBean(mname);
  +        if (managed == null) {
  +            return null;
  +        }
           String domain = managed.getDomain();
           if (domain == null)
               domain = mserver.getDefaultDomain();
  @@ -225,6 +233,9 @@
   
           String mname = createManagedName(engine);
           ManagedBean managed = registry.findManagedBean(mname);
  +        if (managed == null) {
  +            return null;
  +        }
           String domain = managed.getDomain();
           if (domain == null)
               domain = mserver.getDefaultDomain();
  @@ -249,6 +260,9 @@
   
           String mname = createManagedName(host);
           ManagedBean managed = registry.findManagedBean(mname);
  +        if (managed == null) {
  +            return null;
  +        }
           String domain = managed.getDomain();
           if (domain == null)
               domain = mserver.getDefaultDomain();
  @@ -273,6 +287,9 @@
   
           String mname = createManagedName(loader);
           ManagedBean managed = registry.findManagedBean(mname);
  +        if (managed == null) {
  +            return null;
  +        }
           String domain = managed.getDomain();
           if (domain == null)
               domain = mserver.getDefaultDomain();
  @@ -296,6 +313,9 @@
   
           String mname = createManagedName(logger);
           ManagedBean managed = registry.findManagedBean(mname);
  +        if (managed == null) {
  +            return null;
  +        }
           String domain = managed.getDomain();
           if (domain == null)
               domain = mserver.getDefaultDomain();
  @@ -320,6 +340,9 @@
   
           String mname = createManagedName(manager);
           ManagedBean managed = registry.findManagedBean(mname);
  +        if (managed == null) {
  +            return null;
  +        }
           String domain = managed.getDomain();
           if (domain == null)
               domain = mserver.getDefaultDomain();
  @@ -343,6 +366,9 @@
   
           String mname = createManagedName(realm);
           ManagedBean managed = registry.findManagedBean(mname);
  +        if (managed == null) {
  +            return null;
  +        }
           String domain = managed.getDomain();
           if (domain == null)
               domain = mserver.getDefaultDomain();
  @@ -365,6 +391,9 @@
   
           String mname = createManagedName(server);
           ManagedBean managed = registry.findManagedBean(mname);
  +        if (managed == null) {
  +            return null;
  +        }
           String domain = managed.getDomain();
           if (domain == null)
               domain = mserver.getDefaultDomain();
  @@ -389,6 +418,9 @@
   
           String mname = createManagedName(service);
           ManagedBean managed = registry.findManagedBean(mname);
  +        if (managed == null) {
  +            return null;
  +        }
           String domain = managed.getDomain();
           if (domain == null)
               domain = mserver.getDefaultDomain();
  @@ -413,6 +445,9 @@
   
           String mname = createManagedName(valve);
           ManagedBean managed = registry.findManagedBean(mname);
  +        if (managed == null) {
  +            return null;
  +        }
           String domain = managed.getDomain();
           if (domain == null)
               domain = mserver.getDefaultDomain();
  @@ -839,6 +874,9 @@
   
           String mname = createManagedName(connector);
           ManagedBean managed = registry.findManagedBean(mname);
  +        if (managed == null) {
  +            return null;
  +        }
           String domain = managed.getDomain();
           if (domain == null)
               domain = mserver.getDefaultDomain();
  @@ -861,6 +899,9 @@
   
           String mname = createManagedName(context);
           ManagedBean managed = registry.findManagedBean(mname);
  +        if (managed == null) {
  +            return null;
  +        }
           String domain = managed.getDomain();
           if (domain == null)
               domain = mserver.getDefaultDomain();
  @@ -883,6 +924,9 @@
   
           String mname = createManagedName(engine);
           ManagedBean managed = registry.findManagedBean(mname);
  +        if (managed == null) {
  +            return null;
  +        }
           String domain = managed.getDomain();
           if (domain == null)
               domain = mserver.getDefaultDomain();
  @@ -905,6 +949,9 @@
   
           String mname = createManagedName(host);
           ManagedBean managed = registry.findManagedBean(mname);
  +        if (managed == null) {
  +            return null;
  +        }
           String domain = managed.getDomain();
           if (domain == null)
               domain = mserver.getDefaultDomain();
  @@ -927,6 +974,9 @@
   
           String mname = createManagedName(loader);
           ManagedBean managed = registry.findManagedBean(mname);
  +        if (managed == null) {
  +            return null;
  +        }
           String domain = managed.getDomain();
           if (domain == null)
               domain = mserver.getDefaultDomain();
  @@ -949,6 +999,9 @@
   
           String mname = createManagedName(logger);
           ManagedBean managed = registry.findManagedBean(mname);
  +        if (managed == null) {
  +            return null;
  +        }
           String domain = managed.getDomain();
           if (domain == null)
               domain = mserver.getDefaultDomain();
  @@ -971,6 +1024,9 @@
   
           String mname = createManagedName(manager);
           ManagedBean managed = registry.findManagedBean(mname);
  +        if (managed == null) {
  +            return null;
  +        }
           String domain = managed.getDomain();
           if (domain == null)
               domain = mserver.getDefaultDomain();
  @@ -992,6 +1048,9 @@
   
           String mname = createManagedName(realm);
           ManagedBean managed = registry.findManagedBean(mname);
  +        if (managed == null) {
  +            return null;
  +        }
           String domain = managed.getDomain();
           if (domain == null)
               domain = mserver.getDefaultDomain();
  @@ -1014,6 +1073,9 @@
   
           String mname = createManagedName(server);
           ManagedBean managed = registry.findManagedBean(mname);
  +        if (managed == null) {
  +            return null;
  +        }
           String domain = managed.getDomain();
           if (domain == null)
               domain = mserver.getDefaultDomain();
  @@ -1036,6 +1098,9 @@
   
           String mname = createManagedName(service);
           ManagedBean managed = registry.findManagedBean(mname);
  +        if (managed == null) {
  +            return null;
  +        }
           String domain = managed.getDomain();
           if (domain == null)
               domain = mserver.getDefaultDomain();
  @@ -1058,6 +1123,9 @@
   
           String mname = createManagedName(valve);
           ManagedBean managed = registry.findManagedBean(mname);
  +        if (managed == null) {
  +            return null;
  +        }
           String domain = managed.getDomain();
           if (domain == null)
               domain = mserver.getDefaultDomain();
  
  
  

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message