commit | 33048e804c9f7603c30a17e3e8ee34eab50cbdb5 | [log] [tgz] |
---|---|---|
author | Pavlin Radoslavov <pavlin@onlab.us> | Wed Apr 09 14:40:59 2014 -0700 |
committer | Pavlin Radoslavov <pavlin@onlab.us> | Wed Apr 09 14:40:59 2014 -0700 |
tree | 91cebbf114bbb5476370e24b3a05c8c7a8004ce1 | |
parent | 8ed69c5c54025ccda23c2e72c68028b9073f038f [diff] |
Fix issues found by FindBugs: INT_BAD_COMPARISON_WITH_SIGNED_BYTE http://findbugs.sourceforge.net/bugDescriptions.html#INT_BAD_COMPARISON_WITH_SIGNED_BYTE Change-Id: I144336de47c844d526d245ea5cab64c133ff3741
diff --git a/src/main/java/net/onrc/onos/core/packet/DHCP.java b/src/main/java/net/onrc/onos/core/packet/DHCP.java index e414802..3d51cf8 100644 --- a/src/main/java/net/onrc/onos/core/packet/DHCP.java +++ b/src/main/java/net/onrc/onos/core/packet/DHCP.java
@@ -360,7 +360,8 @@ // minimum size 240 including magic cookie, options generally padded to 300 int optionsLength = 0; for (DHCPOption option : this.options) { - if (option.getCode() == 0 || option.getCode() == 255) { + int code = option.getCode() & 0xff; + if (code == 0 || code == 255) { optionsLength += 1; } else { optionsLength += 2 + (int) (0xff & option.getLength());