2012/1/8  <kkoli...@apache.org>:
> Author: kkolinko
> Date: Sun Jan  8 19:33:57 2012
> New Revision: 1228929
>
> URL: http://svn.apache.org/viewvc?rev=1228929&view=rev
> Log:
> Followup to Mark's r1228724
> The ObjectName.quote() must always be called with address, because ip6 
> addresses have characters that are must be quoted in QName. The 
> Connector.java changes in r1228724 bypassed that call.
> Update TestRegistration.java accordingly.
>
> Modified:
>    tomcat/trunk/java/org/apache/catalina/connector/Connector.java
>    tomcat/trunk/test/org/apache/catalina/mbeans/TestRegistration.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=1228929&r1=1228928&r2=1228929&view=diff
> ==============================================================================
> --- tomcat/trunk/java/org/apache/catalina/connector/Connector.java (original)
> +++ tomcat/trunk/java/org/apache/catalina/connector/Connector.java Sun Jan  8 
> 19:33:57 2012
> @@ -882,15 +882,15 @@ public class Connector extends Lifecycle
>             sb.append("auto-");
>             sb.append(getProperty("nameIndex"));
>         }
> +        String address = "";
>         if (addressObj instanceof InetAddress) {
> +            address = ((InetAddress) addressObj).getHostAddress();
> +        } else if (addressObj != null) {
> +            address = addressObj.toString();
> +        }
> +        if (address.length() > 0) {
>             sb.append(",address=");
> -            sb.append(((InetAddress) addressObj).getHostAddress());
> -        } else if(addressObj != null) {
> -            String address = addressObj.toString();
> -            if (address.length() > 0) {
> -                sb.append(",address=");
> -                sb.append(ObjectName.quote(address));
> -            }
> +            sb.append(ObjectName.quote(address));
>         }
>         return sb.toString();
>     }
>
> Modified: tomcat/trunk/test/org/apache/catalina/mbeans/TestRegistration.java
> URL: 
> http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/mbeans/TestRegistration.java?rev=1228929&r1=1228928&r2=1228929&view=diff
> ==============================================================================
> --- tomcat/trunk/test/org/apache/catalina/mbeans/TestRegistration.java 
> (original)
> +++ tomcat/trunk/test/org/apache/catalina/mbeans/TestRegistration.java Sun 
> Jan  8 19:33:57 2012
> @@ -110,14 +110,16 @@ public class TestRegistration extends To
>
>     private static String[] connectorMBeanNames(String port, String type) {
>         return new String[] {
> -        "Tomcat:type=Connector,port=" + port + ",address=" + ADDRESS,
> -        "Tomcat:type=GlobalRequestProcessor,name=\"http-" + type + "-" +
> -                ADDRESS + "-" + port + "\"",
> -        "Tomcat:type=Mapper,port=" + port + ",address=" + ADDRESS,
> -        "Tomcat:type=ProtocolHandler,port=" + port + ",address=\"" + ADDRESS 
> +
> -                "\"",
> -        "Tomcat:type=ThreadPool,name=\"http-" + type + "-" + ADDRESS + "-" +
> -                port + "\"",
> +        "Tomcat:type=Connector,port=" + port + ",address="
> +                + ObjectName.quote(ADDRESS),
> +        "Tomcat:type=GlobalRequestProcessor,name="
> +                + ObjectName.quote("http-" + type + "-" + ADDRESS + "-" + 
> port),
> +        "Tomcat:type=Mapper,port=" + port + ",address="
> +                + ObjectName.quote(ADDRESS),
> +        "Tomcat:type=ProtocolHandler,port=" + port + ",address="
> +                + ObjectName.quote(ADDRESS),
> +        "Tomcat:type=ThreadPool,name="
> +                + ObjectName.quote("http-" + type + "-" + ADDRESS + "-" + 
> port),
>         };
>     }
>

It would be nice if someone could test this on an ip6-only machine,
or make the "localhost" name from r1228724 configurable so that it
could be set to "localhost6" or explicit "::1".

Both Gump and buildbot use "127.0.0.1" is the tests.

Best regards,
Konstantin Kolinko

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

Reply via email to