Ray Milkey
Committed by Gerrit Code Review

ONOS-4033 - 500 error when ethType is not specified

Change-Id: Ib2c440450abf94b9e93f7bdf59f9e5b1109c977f
...@@ -107,12 +107,13 @@ public final class DecodeCriterionCodecHelper { ...@@ -107,12 +107,13 @@ public final class DecodeCriterionCodecHelper {
107 private class EthTypeDecoder implements CriterionDecoder { 107 private class EthTypeDecoder implements CriterionDecoder {
108 @Override 108 @Override
109 public Criterion decodeCriterion(ObjectNode json) { 109 public Criterion decodeCriterion(ObjectNode json) {
110 + JsonNode ethTypeNode = nullIsIllegal(json.get(CriterionCodec.ETH_TYPE),
111 + CriterionCodec.ETH_TYPE + MISSING_MEMBER_MESSAGE);
110 int ethType; 112 int ethType;
111 - if (json.get(CriterionCodec.ETH_TYPE).isInt()) { 113 + if (ethTypeNode.isInt()) {
112 - ethType = nullIsIllegal(json.get(CriterionCodec.ETH_TYPE), 114 + ethType = ethTypeNode.asInt();
113 - CriterionCodec.ETH_TYPE + MISSING_MEMBER_MESSAGE).asInt();
114 } else { 115 } else {
115 - ethType = Integer.decode(json.get(CriterionCodec.ETH_TYPE).textValue()); 116 + ethType = Integer.decode(ethTypeNode.textValue());
116 } 117 }
117 return Criteria.matchEthType(ethType); 118 return Criteria.matchEthType(ethType);
118 } 119 }
......