Correctly render Text output in randomwalk debug message (#300)
Add a case to the randomwalk debug state output to correctly render Text objects
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/Module.java b/src/main/java/org/apache/accumulo/testing/randomwalk/Module.java
index bb78a5b..574dfb3 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/Module.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/Module.java
@@ -44,7 +44,9 @@
import javax.xml.validation.SchemaFactory;
import org.apache.accumulo.core.client.security.tokens.PasswordToken;
+import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.util.threads.ThreadPools;
+import org.apache.hadoop.io.Text;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
@@ -354,7 +356,11 @@
logMsg += value;
else if (value instanceof byte[])
logMsg += new String((byte[]) value, UTF_8);
- else if (value instanceof PasswordToken)
+ else if (value instanceof Text) {
+ Text text = (Text) value;
+ logMsg +=
+ Key.toPrintableString(text.getBytes(), 0, text.getLength(), text.getLength());
+ } else if (value instanceof PasswordToken)
logMsg += new String(((PasswordToken) value).getPassword(), UTF_8);
else
logMsg += value.getClass() + " - " + value;