cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbros...@apache.org
Subject [1/2] git commit: make sure zone info gets completely read
Date Sun, 04 May 2014 04:09:31 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.0 65cd825d0 -> 4233ee43d


make sure zone info gets completely read


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

Branch: refs/heads/cassandra-2.0
Commit: 2f32783bd60081b7798b73c58f9d973776dfd7b5
Parents: 6f4853e
Author: Dave Brosius <dbrosius@mebigfatguy.com>
Authored: Sun May 4 00:07:40 2014 -0400
Committer: Dave Brosius <dbrosius@mebigfatguy.com>
Committed: Sun May 4 00:07:40 2014 -0400

----------------------------------------------------------------------
 src/java/org/apache/cassandra/locator/CloudstackSnitch.java | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/2f32783b/src/java/org/apache/cassandra/locator/CloudstackSnitch.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/locator/CloudstackSnitch.java b/src/java/org/apache/cassandra/locator/CloudstackSnitch.java
index 6d06556..af26ef9 100644
--- a/src/java/org/apache/cassandra/locator/CloudstackSnitch.java
+++ b/src/java/org/apache/cassandra/locator/CloudstackSnitch.java
@@ -17,9 +17,8 @@
  */
 package org.apache.cassandra.locator;
 
-import java.io.InputStream;
+import java.io.DataInputStream;
 import java.io.BufferedInputStream;
-import java.io.FilterInputStream;
 import java.io.BufferedReader;
 import java.io.FileReader;
 import java.io.IOException;
@@ -112,7 +111,7 @@ public class CloudstackSnitch extends AbstractNetworkTopologySnitch
     String csQueryMetadata(String url) throws ConfigurationException, IOException
     {
         HttpURLConnection conn = null;
-        BufferedInputStream is = null;
+        DataInputStream is = null;
 
         try {
             conn = (HttpURLConnection) new URL(url).openConnection();
@@ -127,8 +126,8 @@ public class CloudstackSnitch extends AbstractNetworkTopologySnitch
 
             int cl = conn.getContentLength();
             byte[] b = new byte[cl];
-            is = new BufferedInputStream(conn.getInputStream());
-            is.read(b, 0, cl);
+            is = new DataInputStream(new BufferedInputStream(conn.getInputStream()));
+            is.readFully(b);
             return new String(b, StandardCharsets.UTF_8);
         } finally {
             FileUtils.close(is);


Mime
View raw message