From c6118ad92ea628423cebe5457d99bd24ed369f84 Mon Sep 17 00:00:00 2001 From: Daan Hoogland Date: Thu, 30 Jan 2014 23:16:24 +0100 Subject: [PATCH] findbugs bitwise or guaranteed positively bitfields --- .../cloud/bridge/io/DimeDelimitedInputStream.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/awsapi/src/com/cloud/bridge/io/DimeDelimitedInputStream.java b/awsapi/src/com/cloud/bridge/io/DimeDelimitedInputStream.java index 0f40c934de2..d901c53aebe 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 =