cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [2/3] git commit: Raise a meaningful exception instead of NPE when PFS encounters an unconfigured node patch by jbellis; reviewed by brandonwilliams for CASSANDRA-4349
Date Mon, 18 Jun 2012 19:18:53 GMT
Raise a meaningful exception instead of NPE when PFS encounters an unconfigured node
patch by jbellis; reviewed by brandonwilliams for CASSANDRA-4349


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/45c8f53a
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/45c8f53a
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/45c8f53a

Branch: refs/heads/trunk
Commit: 45c8f53a2c42f48317110908734119a7cb24baf1
Parents: 0ba2631
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Mon Jun 18 14:15:27 2012 -0500
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Mon Jun 18 14:15:36 2012 -0500

----------------------------------------------------------------------
 CHANGES.txt                                        |    2 ++
 .../locator/AbstractNetworkTopologySnitch.java     |    2 --
 .../cassandra/locator/PropertyFileSnitch.java      |    8 ++++++++
 3 files changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/45c8f53a/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index ec03ca6..b6702cb 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,6 @@
 1.1.2
+ * Raise a meaningful exception instead of NPE when PFS encounters
+   an unconfigured node + no default (CASSANDRA-4349)
  * fix bug in sstable blacklisting with LCS (CASSANDRA-4343)
  * LCS no longer promotes tiny sstables out of L0 (CASSANDRA-4341)
  * skip tombstones during hint replay (CASSANDRA-4320)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/45c8f53a/src/java/org/apache/cassandra/locator/AbstractNetworkTopologySnitch.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/locator/AbstractNetworkTopologySnitch.java b/src/java/org/apache/cassandra/locator/AbstractNetworkTopologySnitch.java
index c2df7e4..68404c9 100644
--- a/src/java/org/apache/cassandra/locator/AbstractNetworkTopologySnitch.java
+++ b/src/java/org/apache/cassandra/locator/AbstractNetworkTopologySnitch.java
@@ -34,7 +34,6 @@ public abstract class AbstractNetworkTopologySnitch extends AbstractEndpointSnit
      * Return the rack for which an endpoint resides in
      * @param endpoint a specified endpoint
      * @return string of rack
-     * @throws UnknownHostException
      */
     abstract public String getRack(InetAddress endpoint);
 
@@ -42,7 +41,6 @@ public abstract class AbstractNetworkTopologySnitch extends AbstractEndpointSnit
      * Return the data center for which an endpoint resides in
      * @param endpoint a specified endpoint
      * @return string of data center
-     * @throws UnknownHostException
      */
     abstract public String getDatacenter(InetAddress endpoint);
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/45c8f53a/src/java/org/apache/cassandra/locator/PropertyFileSnitch.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/locator/PropertyFileSnitch.java b/src/java/org/apache/cassandra/locator/PropertyFileSnitch.java
index 00adc7e..0bf5850 100644
--- a/src/java/org/apache/cassandra/locator/PropertyFileSnitch.java
+++ b/src/java/org/apache/cassandra/locator/PropertyFileSnitch.java
@@ -84,6 +84,14 @@ public class PropertyFileSnitch extends AbstractNetworkTopologySnitch
      */
     public String[] getEndpointInfo(InetAddress endpoint)
     {
+        String[] rawEndpointInfo = getRawEndpointInfo(endpoint);
+        if (rawEndpointInfo == null)
+            throw new RuntimeException("Unknown host " + endpoint + " with no default configured");
+        return rawEndpointInfo;
+    }
+
+    private String[] getRawEndpointInfo(InetAddress endpoint)
+    {
         String[] value = endpointMap.get(endpoint);
         if (value == null)
         {


Mime
View raw message