commit | 3e0e92e254c9697ae9274b4f16cdf6c72923b77d | [log] [tgz] |
---|---|---|
author | Ray Milkey <ray@opennetworking.org> | Fri Jan 12 16:41:29 2018 -0800 |
committer | Thomas Vachuska <tom@opennetworking.org> | Wed Jan 17 00:17:43 2018 +0000 |
tree | 8b8fa48946f4d1d7a39041a99db2201bf9029e23 | |
parent | 4a76f3785546761a218f13bc2317da89817bd689 [diff] |
SONAR suggestion - don't ignore stream read() return value Change-Id: I470d7d5a382f43ae5c6e5e577f23fd69517a69a9
diff --git a/core/store/serializers/src/main/java/org/onosproject/store/serializers/ImmutableByteSequenceSerializer.java b/core/store/serializers/src/main/java/org/onosproject/store/serializers/ImmutableByteSequenceSerializer.java index 24c0ebe..1cbd021 100644 --- a/core/store/serializers/src/main/java/org/onosproject/store/serializers/ImmutableByteSequenceSerializer.java +++ b/core/store/serializers/src/main/java/org/onosproject/store/serializers/ImmutableByteSequenceSerializer.java
@@ -46,7 +46,11 @@ public ImmutableByteSequence read(Kryo kryo, Input input, Class<ImmutableByteSequence> type) { int length = input.readInt(); byte[] data = new byte[length]; - input.read(data); + int bytesRead = input.read(data); + if (bytesRead != length) { + throw new IllegalStateException("Byte sequence serializer read expected " + length + + " but got " + bytesRead); + } return ImmutableByteSequence.copyFrom(data); } }