[jboss-jira] [JBoss JIRA] Created: (JBWEB-183) "Wrong" encoding of ObjectNames for connector mbeans

Dimitris Andreadis (JIRA) jira-events at lists.jboss.org
Thu Sep 30 10:14:40 EDT 2010


"Wrong" encoding of ObjectNames for connector mbeans
----------------------------------------------------

                 Key: JBWEB-183
                 URL: https://jira.jboss.org/browse/JBWEB-183
             Project: JBoss Web
          Issue Type: Bug
      Security Level: Public (Everyone can see)
          Components: Tomcat
    Affects Versions: JBossWeb-2.0.0.GA_CP10
            Reporter: Dimitris Andreadis
            Assignee: Remy Maucherat


Looking into this bug report: JBPAPP-3050:

I think the "problem" is in tomcat/jbossweb. When it creates the JMX ObjectNames for connector MBeans, e.g. look at:

http://anonsvn.jboss.org/repos/jbossweb/tags/JBOSSWEB_2_0_0_GA_CP15/src/share/classes/org/apache/coyote/http11/Http11Protocol.java
...
    public String getName() {
        String encodedAddr = "";
        if (getAddress() != null) {
            encodedAddr = "" + getAddress();
            if (encodedAddr.startsWith("/"))
                encodedAddr = encodedAddr.substring(1);
            encodedAddr = URLEncoder.encode(encodedAddr) + "-"; <=== HERE
        }
        return ("http-" + encodedAddr + endpoint.getPort())
...
Basically it encodes the address and so
http-localhost/127.0.0.1-8080
becomes
http-localhost%2F127.0.0.1-8080

If you address the MBean like this, it is visible to any JMX subystem (twiddle, SNMP, concole, etc.), so that could be considered a valid workaround: jboss.web:type=ThreadPool,name=http-localhost%2F127.0.0.1-8080

I guess tomcat/jboss should be using javax.management.ObjectName.quote(String) to encode the name:
http://download.oracle.com/javase/1.5.0/docs/api/javax/management/ObjectName.html#quote%28java.lang.String%29

No big deal.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list