cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r882312 - /incubator/cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
Date Thu, 19 Nov 2009 21:51:16 GMT
Author: jbellis
Date: Thu Nov 19 21:51:15 2009
New Revision: 882312

URL: http://svn.apache.org/viewvc?rev=882312&view=rev
Log:
check for listenaddress misconfiguration
patch by jbellis; reviewed by gdusbabek for CASSANDRA-298

Modified:
    incubator/cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java?rev=882312&r1=882311&r2=882312&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
(original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
Thu Nov 19 21:51:15 2009
@@ -37,6 +37,7 @@
 import java.lang.reflect.InvocationTargetException;
 import java.util.*;
 import java.net.InetAddress;
+import java.net.UnknownHostException;
 
 public class DatabaseDescriptor
 {
@@ -278,9 +279,20 @@
 
             /* Local IP or hostname to bind services to */
             String listenAddress = xmlUtils.getNodeValue("/Storage/ListenAddress");
-            if ( listenAddress != null)
-                listenAddress_ = InetAddress.getByName(listenAddress);
-            
+            if (listenAddress != null)
+            {
+                if (listenAddress.equals("0.0.0.0"))
+                    throw new ConfigurationException("ListenAddress must be a single interface.
 See http://wiki.apache.org/cassandra/FAQ#cant_listen_on_ip_any");
+                try
+                {
+                    listenAddress_ = InetAddress.getByName(listenAddress);
+                }
+                catch (UnknownHostException e)
+                {
+                    throw new ConfigurationException("Unknown ListenAddress '" + listenAddress
+ "'");
+                }
+            }
+
             /* Local IP or hostname to bind thrift server to */
             String thriftAddress = xmlUtils.getNodeValue("/Storage/ThriftAddress");
             if ( thriftAddress != null )



Mime
View raw message