Bug 7209 - Null Pointer Exception in LearnCodecUtil when add learn flow for ipv6 98/48498/1
authorVinh Nguyen <vinh.nguyen@hcl.com>
Fri, 18 Nov 2016 23:03:39 +0000 (15:03 -0800)
committerVinh Nguyen <vinh.nguyen@hcl.com>
Fri, 18 Nov 2016 23:38:20 +0000 (15:38 -0800)
The exception caused by using ByteBuf::readShort
(valid range: -32,768 32,767) for ipv6 etherType '0x86dd'
The fix is to use ByteBuf::readUnsignedShort

Change-Id: I238535565a66692b5d4dbe39b8cb7809867f3cde
Signed-off-by: Vinh Nguyen <vinh.nguyen@hcl.com>
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/LearnCodecUtil.java

index 0a08c8958bd3e893f917ab66209359608b33d3d0..01b3004cf030139e46497fea2b308649eeb73c01 100644 (file)
@@ -261,7 +261,7 @@ public class LearnCodecUtil {
 
     private static FlowMods readFlowModAddMatchFromValue(ByteBuf message, short numBits) {
         FlowModAddMatchFromValueBuilder builder = new FlowModAddMatchFromValueBuilder();
-        builder.setValue((int) message.readShort());
+        builder.setValue((int) message.readUnsignedShort());
         builder.setSrcField((long) message.readInt());
         builder.setSrcOfs((int) message.readShort());
         builder.setFlowModNumBits((int) numBits);
@@ -292,7 +292,7 @@ public class LearnCodecUtil {
 
     private static FlowMods readFlowModCopyFromValue(ByteBuf message, short numBits) {
         FlowModCopyValueIntoFieldBuilder builder = new FlowModCopyValueIntoFieldBuilder();
-        builder.setValue((int) message.readShort());
+        builder.setValue((int) message.readUnsignedShort());
         builder.setDstField((long) message.readInt());
         builder.setDstOfs((int) message.readShort());
         builder.setFlowModNumBits((int) numBits);