findbugs bitwise or guaranteed positively bitfields Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/c6118ad9 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/c6118ad9 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/c6118ad9
Branch: refs/heads/rbac Commit: c6118ad92ea628423cebe5457d99bd24ed369f84 Parents: 41fd0a2 Author: Daan Hoogland <d...@onecht.net> Authored: Thu Jan 30 23:16:24 2014 +0100 Committer: Daan Hoogland <d...@onecht.net> Committed: Thu Jan 30 23:16:24 2014 +0100 ---------------------------------------------------------------------- .../com/cloud/bridge/io/DimeDelimitedInputStream.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c6118ad9/awsapi/src/com/cloud/bridge/io/DimeDelimitedInputStream.java ---------------------------------------------------------------------- diff --git a/awsapi/src/com/cloud/bridge/io/DimeDelimitedInputStream.java b/awsapi/src/com/cloud/bridge/io/DimeDelimitedInputStream.java index 0f40c93..d901c53 100644 --- a/awsapi/src/com/cloud/bridge/io/DimeDelimitedInputStream.java +++ b/awsapi/src/com/cloud/bridge/io/DimeDelimitedInputStream.java @@ -354,13 +354,19 @@ public class DimeDelimitedInputStream extends FilterInputStream { } //OPTIONS_LENGTH - int optionsLength = ((((int)header[2]) << 8) & 0xff00) | ((int)header[3]); + int oneButLastByte = (((int)header[2]) << 8) & 0xff00; + int lastByte = (int)header[3] & 0xff; + int optionsLength = oneButLastByte | lastByte; //ID_LENGTH - int idLength = ((((int)header[4]) << 8) & 0xff00) | ((int)header[5]); + oneButLastByte = ((((int)header[4]) << 8) & 0xff00); + lastByte = ((int)header[5]) & 0xff; + int idLength = oneButLastByte | lastByte; //TYPE_LENGTH - int typeLength = ((((int)header[6]) << 8) & 0xff00) | ((int)header[7]); + oneButLastByte = ((((int)header[6]) << 8) & 0xff00); + lastByte = ((int)header[7]) & 0xff; + int typeLength = oneButLastByte | lastByte; //DATA_LENGTH recordLength =