Yuta HIGUCHI

Minor fixes

- Format string fix
- FlowRuleEventTest: minor bugfix
- HexString: accept null
- byte[] toString() format change

Change-Id: I9db419cfc211670cc2abd796a21396ba960e23a9
...@@ -85,7 +85,7 @@ public class ResourceAvailableCommand extends AbstractShellCommand { ...@@ -85,7 +85,7 @@ public class ResourceAvailableCommand extends AbstractShellCommand {
85 } 85 }
86 86
87 } catch (Exception e) { 87 } catch (Exception e) {
88 - print("Invalid link", e.getMessage()); 88 + print("Invalid link %s", e.getMessage());
89 } 89 }
90 } 90 }
91 } 91 }
......
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 +
3 import java.util.Arrays; 5 import java.util.Arrays;
4 6
5 import com.google.common.base.MoreObjects; 7 import com.google.common.base.MoreObjects;
...@@ -64,7 +66,7 @@ public class VersionedValue { ...@@ -64,7 +66,7 @@ public class VersionedValue {
64 public String toString() { 66 public String toString() {
65 return MoreObjects.toStringHelper(getClass()) 67 return MoreObjects.toStringHelper(getClass())
66 .add("version", version) 68 .add("version", version)
67 - .add("value", Arrays.toString(value)) 69 + .add("value", toHexString(value))
68 .toString(); 70 .toString();
69 } 71 }
70 } 72 }
......
...@@ -3,6 +3,7 @@ package org.onlab.onos.store.service; ...@@ -3,6 +3,7 @@ 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;
6 7
7 import java.util.Objects; 8 import java.util.Objects;
8 9
...@@ -189,9 +190,9 @@ public class WriteRequest { ...@@ -189,9 +190,9 @@ public class WriteRequest {
189 .add("type", type) 190 .add("type", type)
190 .add("tableName", tableName) 191 .add("tableName", tableName)
191 .add("key", key) 192 .add("key", key)
192 - .add("newValue", newValue) 193 + .add("newValue", toHexString(newValue))
193 .add("previousVersion", previousVersion) 194 .add("previousVersion", previousVersion)
194 - .add("oldValue", oldValue) 195 + .add("oldValue", toHexString(oldValue))
195 .toString(); 196 .toString();
196 } 197 }
197 198
......
...@@ -68,7 +68,7 @@ public class FlowRuleEventTest extends AbstractEventTest { ...@@ -68,7 +68,7 @@ public class FlowRuleEventTest extends AbstractEventTest {
68 final long time = System.currentTimeMillis(); 68 final long time = System.currentTimeMillis();
69 final FlowRule flowRule = new IntentTestsMocks.MockFlowRule(1); 69 final FlowRule flowRule = new IntentTestsMocks.MockFlowRule(1);
70 final FlowRuleEvent event = 70 final FlowRuleEvent event =
71 - new FlowRuleEvent(FlowRuleEvent.Type.RULE_UPDATED, flowRule); 71 + new FlowRuleEvent(FlowRuleEvent.Type.RULE_UPDATED, flowRule, time);
72 validateEvent(event, FlowRuleEvent.Type.RULE_UPDATED, flowRule, time); 72 validateEvent(event, FlowRuleEvent.Type.RULE_UPDATED, flowRule, time);
73 } 73 }
74 } 74 }
......
...@@ -28,6 +28,9 @@ public final class HexString { ...@@ -28,6 +28,9 @@ public final class HexString {
28 * @return "0f:ca:fe:de:ad:be:ef" 28 * @return "0f:ca:fe:de:ad:be:ef"
29 */ 29 */
30 public static String toHexString(final byte[] bytes) { 30 public static String toHexString(final byte[] bytes) {
31 + if (bytes == null) {
32 + return "(null)";
33 + }
31 int i; 34 int i;
32 StringBuilder ret = new StringBuilder(bytes.length * 3 - 1); 35 StringBuilder ret = new StringBuilder(bytes.length * 3 - 1);
33 String tmp; 36 String tmp;
......