Repository: cassandra Updated Branches: refs/heads/cassandra-1.2 73e1eff68 -> 135513cf9
Fix compilation with java 6 (JAVA-7147 regression) Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/135513cf Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/135513cf Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/135513cf Branch: refs/heads/cassandra-1.2 Commit: 135513cf9b95edadf7ab52be8b05c2d83019f3cd Parents: 73e1eff Author: Sylvain Lebresne <[email protected]> Authored: Wed Jul 2 10:23:19 2014 +0200 Committer: Sylvain Lebresne <[email protected]> Committed: Wed Jul 2 10:23:19 2014 +0200 ---------------------------------------------------------------------- src/java/org/apache/cassandra/locator/CloudstackSnitch.java | 3 +-- src/java/org/apache/cassandra/utils/ByteBufferUtil.java | 7 +++---- src/java/org/apache/cassandra/utils/FBUtilities.java | 3 +++ 3 files changed, 7 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/135513cf/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 57c973b..eb671d7 100644 --- a/src/java/org/apache/cassandra/locator/CloudstackSnitch.java +++ b/src/java/org/apache/cassandra/locator/CloudstackSnitch.java @@ -27,7 +27,6 @@ import java.net.HttpURLConnection; import java.net.InetAddress; import java.net.URL; import java.net.URI; -import java.nio.charset.StandardCharsets; import java.util.Map; import java.util.regex.Pattern; import java.util.regex.Matcher; @@ -137,7 +136,7 @@ public class CloudstackSnitch extends AbstractNetworkTopologySnitch byte[] b = new byte[cl]; is = new DataInputStream(new BufferedInputStream(conn.getInputStream())); is.readFully(b); - return new String(b, StandardCharsets.UTF_8); + return new String(b, FBUtilities.UTF_8); } finally { http://git-wip-us.apache.org/repos/asf/cassandra/blob/135513cf/src/java/org/apache/cassandra/utils/ByteBufferUtil.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/utils/ByteBufferUtil.java b/src/java/org/apache/cassandra/utils/ByteBufferUtil.java index 86f3f02..acc4885 100644 --- a/src/java/org/apache/cassandra/utils/ByteBufferUtil.java +++ b/src/java/org/apache/cassandra/utils/ByteBufferUtil.java @@ -74,7 +74,6 @@ import org.apache.cassandra.io.util.FileUtils; */ public class ByteBufferUtil { - private static final Charset UTF_8 = Charset.forName("UTF-8"); public static final ByteBuffer EMPTY_BYTE_BUFFER = ByteBuffer.wrap(new byte[0]); public static int compareUnsigned(ByteBuffer o1, ByteBuffer o2) @@ -121,7 +120,7 @@ public class ByteBufferUtil */ public static String string(ByteBuffer buffer) throws CharacterCodingException { - return string(buffer, UTF_8); + return string(buffer, FBUtilities.UTF_8); } /** @@ -135,7 +134,7 @@ public class ByteBufferUtil */ public static String string(ByteBuffer buffer, int position, int length) throws CharacterCodingException { - return string(buffer, position, length, UTF_8); + return string(buffer, position, length, FBUtilities.UTF_8); } /** @@ -228,7 +227,7 @@ public class ByteBufferUtil */ public static ByteBuffer bytes(String s) { - return ByteBuffer.wrap(s.getBytes(UTF_8)); + return ByteBuffer.wrap(s.getBytes(FBUtilities.UTF_8)); } /** http://git-wip-us.apache.org/repos/asf/cassandra/blob/135513cf/src/java/org/apache/cassandra/utils/FBUtilities.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/utils/FBUtilities.java b/src/java/org/apache/cassandra/utils/FBUtilities.java index 8cb6dae..437b6a8 100644 --- a/src/java/org/apache/cassandra/utils/FBUtilities.java +++ b/src/java/org/apache/cassandra/utils/FBUtilities.java @@ -27,6 +27,7 @@ import java.net.SocketException; import java.net.URL; import java.net.UnknownHostException; import java.nio.ByteBuffer; +import java.nio.charset.Charset; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.*; @@ -63,6 +64,8 @@ import org.codehaus.jackson.map.ObjectMapper; public class FBUtilities { + public static final Charset UTF_8 = Charset.forName("UTF-8"); + private static final Logger logger = LoggerFactory.getLogger(FBUtilities.class); private static ObjectMapper jsonMapper = new ObjectMapper(new JsonFactory());
