Permalink
Browse files

Use Arrays.toString() when printing the contents of an array

Just printing an array will print a useless value. Calling the
Arrays.toString() function will at least try to print something
useful.

Change-Id: Ifd6a3da495835694b300cf7f94b96c79ee03f4bd
Reviewed-on: http://review.couchbase.org/21153
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Tested-by: Michael Wiederhold <mike@couchbase.com>
  • Loading branch information...
1 parent 495b4ee commit 388fd0edbdbd1eba90299c36c2d7dede284cfd65 @mikewied mikewied committed with mikewied Sep 26, 2012
@@ -23,6 +23,7 @@
package net.spy.memcached.protocol.ascii;
import java.nio.ByteBuffer;
+import java.util.Arrays;
import net.spy.memcached.ops.OperationState;
import net.spy.memcached.ops.OperationStatus;
@@ -74,6 +75,6 @@ protected void wasCancelled() {
@Override
public String toString() {
- return "Cmd: " + msg;
+ return "Cmd: " + Arrays.toString(msg);
}
}
@@ -23,6 +23,7 @@
package net.spy.memcached;
+import java.util.Arrays;
import java.util.Iterator;
import org.jmock.Mock;
@@ -48,8 +49,8 @@ private void runSequenceAssertion(NodeLocator l, String k, int... seq) {
} catch (UnsupportedOperationException e) {
// pass
} catch (ArrayIndexOutOfBoundsException ex) {
- throw new RuntimeException("Tried to access nodes[" + seq + "[" + pos
- + "]] erroneously.", ex);
+ throw new RuntimeException("Tried to access nodes["
+ + Arrays.toString(seq) + "[" + pos + "]] erroneously.", ex);
}
pos++;
}

0 comments on commit 388fd0e

Please sign in to comment.