Madan Jampani
Committed by Pavlin Radoslavov

Printing a summary (total size) when generating toString representation of byte …

…arrays in WriteRequest and VersionedValue

Change-Id: If068a4e602fd5cc3932f09fc3ab54a7dea47f1f2
1 package org.onlab.onos.store.service; 1 package org.onlab.onos.store.service;
2 2
3 -import static org.onlab.util.HexString.toHexString;
4 -
5 import java.util.Arrays; 3 import java.util.Arrays;
6 4
7 import com.google.common.base.MoreObjects; 5 import com.google.common.base.MoreObjects;
...@@ -66,7 +64,7 @@ public class VersionedValue { ...@@ -66,7 +64,7 @@ public class VersionedValue {
66 public String toString() { 64 public String toString() {
67 return MoreObjects.toStringHelper(getClass()) 65 return MoreObjects.toStringHelper(getClass())
68 .add("version", version) 66 .add("version", version)
69 - .add("value", toHexString(value)) 67 + .add("value", value != null ? "[" + value.length + " bytes]" : value)
70 .toString(); 68 .toString();
71 } 69 }
72 } 70 }
......
...@@ -3,7 +3,6 @@ package org.onlab.onos.store.service; ...@@ -3,7 +3,6 @@ package org.onlab.onos.store.service;
3 import static com.google.common.base.Preconditions.checkArgument; 3 import static com.google.common.base.Preconditions.checkArgument;
4 import static com.google.common.base.Preconditions.checkNotNull; 4 import static com.google.common.base.Preconditions.checkNotNull;
5 import static org.onlab.onos.store.service.WriteRequest.Type.*; 5 import static org.onlab.onos.store.service.WriteRequest.Type.*;
6 -import static org.onlab.util.HexString.toHexString;
7 6
8 import java.util.Objects; 7 import java.util.Objects;
9 8
...@@ -190,9 +189,9 @@ public class WriteRequest { ...@@ -190,9 +189,9 @@ public class WriteRequest {
190 .add("type", type) 189 .add("type", type)
191 .add("tableName", tableName) 190 .add("tableName", tableName)
192 .add("key", key) 191 .add("key", key)
193 - .add("newValue", toHexString(newValue)) 192 + .add("newValue", newValue != null ? "[" + newValue.length + " bytes]" : newValue)
194 .add("previousVersion", previousVersion) 193 .add("previousVersion", previousVersion)
195 - .add("oldValue", toHexString(oldValue)) 194 + .add("oldValue", oldValue != null ? "[" + oldValue.length + " bytes]" : oldValue)
196 .toString(); 195 .toString();
197 } 196 }
198 197
......