geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dwo...@apache.org
Subject svn commit: r718350 - in /geronimo/server/branches/2.1/plugins/activemq/geronimo-activemq/src: main/java/org/apache/geronimo/activemq/TransportConnectorGBeanImpl.java test/java/org/apache/geronimo/activemq/ConnectorTest.java
Date Mon, 17 Nov 2008 19:50:05 GMT
Author: dwoods
Date: Mon Nov 17 11:50:04 2008
New Revision: 718350

URL: http://svn.apache.org/viewvc?rev=718350&view=rev
Log:
GERONIMO-4404 ActiveMQ connectors default to 0.0.0.0 when ServerHostname is set to localhost.
 Thanks Shawn for the patch.

Modified:
    geronimo/server/branches/2.1/plugins/activemq/geronimo-activemq/src/main/java/org/apache/geronimo/activemq/TransportConnectorGBeanImpl.java
    geronimo/server/branches/2.1/plugins/activemq/geronimo-activemq/src/test/java/org/apache/geronimo/activemq/ConnectorTest.java

Modified: geronimo/server/branches/2.1/plugins/activemq/geronimo-activemq/src/main/java/org/apache/geronimo/activemq/TransportConnectorGBeanImpl.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/activemq/geronimo-activemq/src/main/java/org/apache/geronimo/activemq/TransportConnectorGBeanImpl.java?rev=718350&r1=718349&r2=718350&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/activemq/geronimo-activemq/src/main/java/org/apache/geronimo/activemq/TransportConnectorGBeanImpl.java
(original)
+++ geronimo/server/branches/2.1/plugins/activemq/geronimo-activemq/src/main/java/org/apache/geronimo/activemq/TransportConnectorGBeanImpl.java
Mon Nov 17 11:50:04 2008
@@ -53,7 +53,12 @@
     public TransportConnectorGBeanImpl(BrokerServiceGBean brokerServiceGBean, String protocol,
String host, int port) {
         this.brokerServiceGBean = brokerServiceGBean;
         this.protocol = protocol;
-        this.host = host;
+        //force localhost to 127.0.0.1 to avoid activemq amplify localhost to 0.0.0.0
+        if (host.equalsIgnoreCase("localhost")) {
+            this.host = "127.0.0.1";
+        } else {
+            this.host = host;
+        }
         this.port = port;
     }
 

Modified: geronimo/server/branches/2.1/plugins/activemq/geronimo-activemq/src/test/java/org/apache/geronimo/activemq/ConnectorTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/activemq/geronimo-activemq/src/test/java/org/apache/geronimo/activemq/ConnectorTest.java?rev=718350&r1=718349&r2=718350&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/activemq/geronimo-activemq/src/test/java/org/apache/geronimo/activemq/ConnectorTest.java
(original)
+++ geronimo/server/branches/2.1/plugins/activemq/geronimo-activemq/src/test/java/org/apache/geronimo/activemq/ConnectorTest.java
Mon Nov 17 11:50:04 2008
@@ -32,9 +32,9 @@
 
     public void testURLManipulation() {
         test = new TransportConnectorGBeanImpl(null, "foo", "localhost", 1234);
-        assertEquals("foo://localhost:1234", test.getUrl());
+        assertEquals("foo://127.0.0.1:1234", test.getUrl());
         assertEquals("foo", test.getProtocol());
-        assertEquals("localhost", test.getHost());
+        assertEquals("127.0.0.1", test.getHost());
         assertEquals(1234, test.getPort());
         test.setHost("0.0.0.0");
         assertEquals("foo://0.0.0.0:1234", test.getUrl());
@@ -52,9 +52,9 @@
         assertEquals("0.0.0.0", test.getHost());
         assertEquals(8765, test.getPort());
         test = new TransportConnectorGBeanImpl(null, "vm", "localhost", -1);
-        assertEquals("vm://localhost", test.getUrl());
+        assertEquals("vm://127.0.0.1", test.getUrl());
         assertEquals("vm", test.getProtocol());
-        assertEquals("localhost", test.getHost());
+        assertEquals("127.0.0.1", test.getHost());
         assertEquals(-1, test.getPort());
     }
 }



Mime
View raw message