Fix regression producing invalid MBean names when using IPV6
authorrjung <rjung@13f79535-47bb-0310-9956-ffa450edef68>
Sun, 10 Jul 2011 06:53:36 +0000 (06:53 +0000)
committerrjung <rjung@13f79535-47bb-0310-9956-ffa450edef68>
Sun, 10 Jul 2011 06:53:36 +0000 (06:53 +0000)
addresses for connectors.

- revert r1135088

- remove the surrounding quotes only when
  passing the name to the endpoint, so they
  don't end up in the middle of thread names.
  The thread names are used as MBean attribute
  values, but not in MBean names.

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

java/org/apache/coyote/AbstractProtocol.java
test/org/apache/catalina/mbeans/TestRegistration.java
webapps/docs/changelog.xml

index bb46867..63142cf 100644 (file)
@@ -233,8 +233,7 @@ public abstract class AbstractProtocol implements ProtocolHandler,
             name.append('-');
         }
         name.append(endpoint.getPort());
-        String quotedName = ObjectName.quote(name.toString());
-        return quotedName.substring(1, quotedName.length()-1);
+        return ObjectName.quote(name.toString());
     }
 
     
@@ -363,7 +362,8 @@ public abstract class AbstractProtocol implements ProtocolHandler,
                     getHandler().getGlobal(), rgOname, null );
         }
 
-        endpoint.setName(getName());
+        String endpointName = getName();
+        endpoint.setName(endpointName.substring(1, endpointName.length()-1));
 
         try {
             endpoint.init();
index caed0eb..de6d4c3 100644 (file)
@@ -80,10 +80,10 @@ public class TestRegistration extends TomcatBaseTest {
     private static String[] connectorMBeanNames(String port, String type) {
         return new String[] {
         "Tomcat:type=Connector,port=" + port,
-        "Tomcat:type=GlobalRequestProcessor,name=http-" + type + "-" + port,
+        "Tomcat:type=GlobalRequestProcessor,name=\"http-" + type + "-" + port + "\"",
         "Tomcat:type=Mapper,port=" + port,
         "Tomcat:type=ProtocolHandler,port=" + port,
-        "Tomcat:type=ThreadPool,name=http-" + type + "-" + port,
+        "Tomcat:type=ThreadPool,name=\"http-" + type + "-" + port + "\"",
         };
     }
 
index 60599f0..8014057 100644 (file)
         Correct regression introduced in 7.0.17 that triggered 400 entries in
         the AccessLog when using the AJP/BIO connector. (markt)
       </fix>
+      <fix>
+        Fix regression producing invalid MBean names when using IPV6
+        addresses for connectors. (rjung)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Cluster">