[jboss-cvs] JBossAS SVN: r109637 - branches/JBoss-AS-6.0.x-ipv6/console/src/main/java/org/jboss/console/twiddle.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Dec 1 19:38:44 EST 2010


Author: rachmatowicz at jboss.com
Date: 2010-12-01 19:38:44 -0500 (Wed, 01 Dec 2010)
New Revision: 109637

Modified:
   branches/JBoss-AS-6.0.x-ipv6/console/src/main/java/org/jboss/console/twiddle/Twiddle.java
Log:
Fix JMX service URL generation in Twiddle (JBAS-8540)

Modified: branches/JBoss-AS-6.0.x-ipv6/console/src/main/java/org/jboss/console/twiddle/Twiddle.java
===================================================================
--- branches/JBoss-AS-6.0.x-ipv6/console/src/main/java/org/jboss/console/twiddle/Twiddle.java	2010-12-01 23:38:06 UTC (rev 109636)
+++ branches/JBoss-AS-6.0.x-ipv6/console/src/main/java/org/jboss/console/twiddle/Twiddle.java	2010-12-02 00:38:44 UTC (rev 109637)
@@ -99,14 +99,27 @@
    // build JMXServiceURL, should look like  "service:jmx:rmi:///jndi/rmi://localhost:1090/jmxrmi";
    private String buildJMXServiceUrl()
    {
+	   // JBAS-8540
       return
          DEFAULT_BASEURL +
-         (hostname != null ? hostname : DEFAULT_HOSTNAME) +
+         fixHostnameForURL(hostname != null ? hostname : DEFAULT_HOSTNAME) +
          ":" +
          (port != null ? port : DEFAULT_PORT) +
          DEFAULT_RMIOBJECTNAME;
    }
+   
+   // would ordinarily use ServerConfigUtil.fixHostnameForURL() but not on client classpath
+   private String fixHostnameForURL(String host) {
+       if (host == null)
+    	   return host ;
 
+       // if the hostname is an IPv6 literal, enclose it in brackets
+       if (host.indexOf(':') != -1)
+    	   return "[" + host + "]" ;
+       else 
+    	   return host ;
+   }
+
    public String getUsername() {
       return username;
    }



More information about the jboss-cvs-commits mailing list