tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r896193 - in /tomcat/trunk/java/org/apache/catalina: connector/Connector.java mbeans/MBeanUtils.java
Date Tue, 05 Jan 2010 19:53:40 GMT
Author: markt
Date: Tue Jan  5 19:53:38 2010
New Revision: 896193

URL: http://svn.apache.org/viewvc?rev=896193&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=48424
Based on a patch by Ivan
Ensure that the ObjectNames for the Connectors are always generated using the same method

Modified:
    tomcat/trunk/java/org/apache/catalina/connector/Connector.java
    tomcat/trunk/java/org/apache/catalina/mbeans/MBeanUtils.java

Modified: tomcat/trunk/java/org/apache/catalina/connector/Connector.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/Connector.java?rev=896193&r1=896192&r2=896193&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/connector/Connector.java (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/Connector.java Tue Jan  5 19:53:38 2010
@@ -932,14 +932,21 @@
 
     protected ObjectName createObjectName(String domain, String type)
             throws MalformedObjectNameException {
-        String encodedAddr = null;
-        if (getProperty("address") != null) {
-            encodedAddr = URLEncoder.encode(getProperty("address").toString());
-        }
-        String addSuffix = (getProperty("address") == null) ? "" : ",address="
-                + encodedAddr;
-        ObjectName _oname = new ObjectName(domain + ":type=" + type + ",port="
-                + getPort() + addSuffix);
+        Object addressObj = getProperty("address");
+
+        StringBuilder sb = new StringBuilder(domain);
+        sb.append(":type=");
+        sb.append(type);
+        sb.append(",port=");
+        sb.append(getPort());
+        if (addressObj != null) {
+            String address = addressObj.toString();
+            if (address.length() > 0) {
+                sb.append(",address=");
+                sb.append(ObjectName.quote(address));
+            }
+        }
+        ObjectName _oname = new ObjectName(sb.toString());
         return _oname;
     }
 

Modified: tomcat/trunk/java/org/apache/catalina/mbeans/MBeanUtils.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/mbeans/MBeanUtils.java?rev=896193&r1=896192&r2=896193&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/mbeans/MBeanUtils.java (original)
+++ tomcat/trunk/java/org/apache/catalina/mbeans/MBeanUtils.java Tue Jan  5 19:53:38 2010
@@ -461,15 +461,20 @@
 
         ObjectName name = null;
         try {
-            String address = (String)
-                IntrospectionUtils.getProperty(connector, "address");
+            Object addressObj = IntrospectionUtils.getProperty(connector, "address");   
        
             Integer port = (Integer)
                 IntrospectionUtils.getProperty(connector, "port");
+
             StringBuilder sb = new StringBuilder(domain);
             sb.append(":type=Connector");
-            sb.append(",port=" + port);
-            if ((address != null) && (address.length()>0)) {
-                sb.append(",address=" + address);
+            sb.append(",port=");
+            sb.append(port);
+            if (addressObj != null) {
+                String address = addressObj.toString();
+                if (address.length() > 0) {
+                    sb.append(",address=");
+                    sb.append(ObjectName.quote(address));
+                }
             }
             name = new ObjectName(sb.toString());
             return (name);



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


Mime
View raw message