Charles M.C. Chan
Committed by Pavlin Radoslavov

Bugfix: Criteria.toString() does not convert unsigned variables properly.

For example, in the response of 'flows' command, the ethType of IPv6 (0x86dd) is shown as ff..ff86dd instead of 86dd
Note: VlanId/VlanPcp still remains in signed format in this commit since:
  * VLAN tag is actually 12 bits. There should be no problem even if it is printed as signed short.
  * VLAN PCP is actually 3 bits. There should be no problem even if it is printed as signed short.
  * -1 is used in many places to indicate untagged vlan

[Merged from master]

Change-Id: Ib68161d552a0011e6a6666970907cf9ca846f620
(cherry picked from commit 36eb6e11)
......@@ -298,7 +298,8 @@ public final class Criteria {
@Override
public String toString() {
return toStringHelper(type().toString())
.add("ethType", Long.toHexString(ethType)).toString();
.add("ethType", Long.toHexString(ethType & 0xffff))
.toString();
}
@Override
......@@ -396,7 +397,8 @@ public final class Criteria {
@Override
public String toString() {
return toStringHelper(type().toString())
.add("protocol", Long.toHexString(proto)).toString();
.add("protocol", Long.toHexString(proto & 0xff))
.toString();
}
@Override
......@@ -542,7 +544,7 @@ public final class Criteria {
@Override
public String toString() {
return toStringHelper(type().toString())
.add("tcpPort", tcpPort).toString();
.add("tcpPort", tcpPort & 0xffff).toString();
}
@Override
......@@ -589,7 +591,7 @@ public final class Criteria {
@Override
public String toString() {
return toStringHelper(type().toString())
.add("mpls", mplsLabel.intValue()).toString();
.add("mpls", mplsLabel & 0xffffffffL).toString();
}
@Override
......@@ -639,7 +641,7 @@ public final class Criteria {
@Override
public String toString() {
return toStringHelper(type().toString())
.add("lambda", lambda).toString();
.add("lambda", lambda & 0xffff).toString();
}
@Override
......@@ -686,7 +688,7 @@ public final class Criteria {
@Override
public String toString() {
return toStringHelper(type().toString())
.add("signalType", signalType).toString();
.add("signalType", signalType & 0xffff).toString();
}
@Override
......