Printing a summary (total size) when generating toString representation of byte arrays in WriteRequest and VersionedValue
Change-Id: If068a4e602fd5cc3932f09fc3ab54a7dea47f1f2
diff --git a/core/api/src/main/java/org/onlab/onos/store/service/VersionedValue.java b/core/api/src/main/java/org/onlab/onos/store/service/VersionedValue.java
index c3a4fac..72c5bcd 100644
--- a/core/api/src/main/java/org/onlab/onos/store/service/VersionedValue.java
+++ b/core/api/src/main/java/org/onlab/onos/store/service/VersionedValue.java
@@ -1,7 +1,5 @@
package org.onlab.onos.store.service;
-import static org.onlab.util.HexString.toHexString;
-
import java.util.Arrays;
import com.google.common.base.MoreObjects;
@@ -66,7 +64,7 @@
public String toString() {
return MoreObjects.toStringHelper(getClass())
.add("version", version)
- .add("value", toHexString(value))
+ .add("value", value != null ? "[" + value.length + " bytes]" : value)
.toString();
}
}
diff --git a/core/api/src/main/java/org/onlab/onos/store/service/WriteRequest.java b/core/api/src/main/java/org/onlab/onos/store/service/WriteRequest.java
index bc2f527..3800a83 100644
--- a/core/api/src/main/java/org/onlab/onos/store/service/WriteRequest.java
+++ b/core/api/src/main/java/org/onlab/onos/store/service/WriteRequest.java
@@ -3,7 +3,6 @@
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.onlab.onos.store.service.WriteRequest.Type.*;
-import static org.onlab.util.HexString.toHexString;
import java.util.Objects;
@@ -190,9 +189,9 @@
.add("type", type)
.add("tableName", tableName)
.add("key", key)
- .add("newValue", toHexString(newValue))
+ .add("newValue", newValue != null ? "[" + newValue.length + " bytes]" : newValue)
.add("previousVersion", previousVersion)
- .add("oldValue", toHexString(oldValue))
+ .add("oldValue", oldValue != null ? "[" + oldValue.length + " bytes]" : oldValue)
.toString();
}