Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=49522
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 1 Jul 2010 18:06:47 +0000 (18:06 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 1 Jul 2010 18:06:47 +0000 (18:06 +0000)
Just use host and path in NamingResources MBean name rather than full Context MBean name

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@959736 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/core/StandardContext.java
webapps/docs/changelog.xml

index 0e0ec5e..ba8779d 100644 (file)
@@ -1755,7 +1755,7 @@ public class StandardContext extends ContainerBase
         
         unregister(onameNamingResoucres);
         onameNamingResoucres = register(namingResources,
-                "type=NamingResources," + getObjectNameKeyProperties());
+                "type=NamingResources," + getObjectKeyPropertiesNameOnly());
     }
 
 
@@ -5546,30 +5546,34 @@ public class StandardContext extends ContainerBase
     protected String getObjectNameKeyProperties() {
 
         StringBuilder keyProperties =
-            new StringBuilder("j2eeType=WebModule,name=");
-        
-        String hostName = getParent().getName();
-        if (hostName == null) {
-            keyProperties.append("DEFAULT");
+            new StringBuilder("j2eeType=WebModule,");
+        keyProperties.append(getObjectKeyPropertiesNameOnly());
+        keyProperties.append(",J2EEApplication=");
+        keyProperties.append(getJ2EEApplication());
+        keyProperties.append(",J2EEServer=");
+        keyProperties.append(getJ2EEServer());
+
+        return keyProperties.toString();
+    }
+    
+    private String getObjectKeyPropertiesNameOnly() {
+        StringBuilder result = new StringBuilder("name=");
+        String hostname = getParent().getName();
+        if (hostname == null) {
+            result.append("DEFAULT");
         } else {
-            keyProperties.append(hostName);
+            result.append(hostname);
         }
         
         String pathName = getName();
         if ("".equals(pathName)) {
-            keyProperties.append('/');
+            result.append('/');
         } else {
-            keyProperties.append(pathName);
+            result.append(pathName);
         }
 
-        keyProperties.append(",J2EEApplication=");
-        keyProperties.append(getJ2EEApplication());
-        keyProperties.append(",J2EEServer=");
-        keyProperties.append(getJ2EEServer());
-
-        return keyProperties.toString();
+        return result.toString();
     }
-    
 
     @Override
     protected void initInternal() throws LifecycleException {
index 5b6f2b5..d79b9c9 100644 (file)
       <fix>
         <bug>49518</bug>: Fix typo in extras documentation. (markt)
       </fix>
+      <fix>
+        <bug>49522</bug>: Fix regression due to change of name for MBeans for
+        naming resources that broke the complete server status page in the
+        manager application. Note these MBeans now have a new name. (markt)
+      </fix>
     </changelog>
   </subsection>
 </section>