ACCUMULO-2292 Fix findbugs errors in trace module
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/cfc7fecc Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/cfc7fecc Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/cfc7fecc Branch: refs/heads/2292-findbugs Commit: cfc7feccad3c52af162d56243733a0204dbc95b6 Parents: 5fe2ccc Author: Josh Elser <els...@apache.org> Authored: Thu Jan 30 15:29:40 2014 -0500 Committer: Josh Elser <els...@apache.org> Committed: Thu Jan 30 17:19:27 2014 -0500 ---------------------------------------------------------------------- .../org/apache/accumulo/trace/instrument/TraceRunnable.java | 9 +++++++++ .../accumulo/trace/instrument/receivers/ZooSpanClient.java | 4 +++- 2 files changed, 12 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/cfc7fecc/trace/src/main/java/org/apache/accumulo/trace/instrument/TraceRunnable.java ---------------------------------------------------------------------- diff --git a/trace/src/main/java/org/apache/accumulo/trace/instrument/TraceRunnable.java b/trace/src/main/java/org/apache/accumulo/trace/instrument/TraceRunnable.java index a13f2be..41c765d 100644 --- a/trace/src/main/java/org/apache/accumulo/trace/instrument/TraceRunnable.java +++ b/trace/src/main/java/org/apache/accumulo/trace/instrument/TraceRunnable.java @@ -48,6 +48,15 @@ public class TraceRunnable implements Runnable, Comparable<TraceRunnable> { } } + @Override + public boolean equals(Object o) { + if (o instanceof TraceRunnable) { + return 0 == this.compareTo((TraceRunnable) o); + } + + return false; + } + @SuppressWarnings({"rawtypes", "unchecked"}) @Override public int compareTo(TraceRunnable o) { http://git-wip-us.apache.org/repos/asf/accumulo/blob/cfc7fecc/trace/src/main/java/org/apache/accumulo/trace/instrument/receivers/ZooSpanClient.java ---------------------------------------------------------------------- diff --git a/trace/src/main/java/org/apache/accumulo/trace/instrument/receivers/ZooSpanClient.java b/trace/src/main/java/org/apache/accumulo/trace/instrument/receivers/ZooSpanClient.java index d6db906..049b2a2 100644 --- a/trace/src/main/java/org/apache/accumulo/trace/instrument/receivers/ZooSpanClient.java +++ b/trace/src/main/java/org/apache/accumulo/trace/instrument/receivers/ZooSpanClient.java @@ -17,6 +17,7 @@ package org.apache.accumulo.trace.instrument.receivers; import java.io.IOException; +import java.nio.charset.Charset; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -38,6 +39,7 @@ public class ZooSpanClient extends SendSpansViaThrift { private static final Logger log = Logger.getLogger(ZooSpanClient.class); private static final int TOTAL_TIME_WAIT_CONNECT_MS = 10 * 1000; private static final int TIME_WAIT_CONNECT_CHECK_MS = 100; + private static final Charset UTF8 = Charset.forName("UTF-8"); ZooKeeper zoo = null; final String path; @@ -108,7 +110,7 @@ public class ZooSpanClient extends SendSpansViaThrift { List<String> hosts = new ArrayList<String>(); for (String child : children) { byte[] data = zoo.getData(path + "/" + child, null, null); - hosts.add(new String(data)); + hosts.add(new String(data, UTF8)); } this.hosts.clear(); this.hosts.addAll(hosts);