Skip to content

Commit 388fd0e

Browse files
author
Mike Wiederhold
committed
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 <[email protected]> Tested-by: Michael Wiederhold <[email protected]>
1 parent 495b4ee commit 388fd0e

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/main/java/net/spy/memcached/protocol/ascii/StatsOperationImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
package net.spy.memcached.protocol.ascii;
2424

2525
import java.nio.ByteBuffer;
26+
import java.util.Arrays;
2627

2728
import net.spy.memcached.ops.OperationState;
2829
import net.spy.memcached.ops.OperationStatus;
@@ -74,6 +75,6 @@ protected void wasCancelled() {
7475

7576
@Override
7677
public String toString() {
77-
return "Cmd: " + msg;
78+
return "Cmd: " + Arrays.toString(msg);
7879
}
7980
}

src/test/java/net/spy/memcached/AbstractNodeLocationCase.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
package net.spy.memcached;
2525

26+
import java.util.Arrays;
2627
import java.util.Iterator;
2728

2829
import org.jmock.Mock;
@@ -48,8 +49,8 @@ private void runSequenceAssertion(NodeLocator l, String k, int... seq) {
4849
} catch (UnsupportedOperationException e) {
4950
// pass
5051
} catch (ArrayIndexOutOfBoundsException ex) {
51-
throw new RuntimeException("Tried to access nodes[" + seq + "[" + pos
52-
+ "]] erroneously.", ex);
52+
throw new RuntimeException("Tried to access nodes["
53+
+ Arrays.toString(seq) + "[" + pos + "]] erroneously.", ex);
5354
}
5455
pos++;
5556
}

0 commit comments

Comments
 (0)