This is an automated email from the ASF dual-hosted git repository.
tanxinyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new 9ae4c88415 combine the byte value with 0xff and cast one of the
operands of addition to long (#5889)
9ae4c88415 is described below
commit 9ae4c8841501dff1c9e761a2e421369fcf3f5dbe
Author: greenhandatsjtu <[email protected]>
AuthorDate: Sat May 28 22:47:27 2022 +0800
combine the byte value with 0xff and cast one of the operands of addition
to long (#5889)
---
consensus/src/main/java/org/apache/iotdb/consensus/ratis/Utils.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git
a/consensus/src/main/java/org/apache/iotdb/consensus/ratis/Utils.java
b/consensus/src/main/java/org/apache/iotdb/consensus/ratis/Utils.java
index e34ec9d60f..93a351082c 100644
--- a/consensus/src/main/java/org/apache/iotdb/consensus/ratis/Utils.java
+++ b/consensus/src/main/java/org/apache/iotdb/consensus/ratis/Utils.java
@@ -118,7 +118,7 @@ public class Utils {
/** Given raftGroupId, decrypt ConsensusGroupId out of it */
public static ConsensusGroupId fromRaftGroupIdToConsensusGroupId(RaftGroupId
raftGroupId) {
byte[] padded = raftGroupId.toByteString().toByteArray();
- long type = (padded[10] << 8) + padded[11];
+ long type = (long) ((padded[10] & 0xff) << 8) + (padded[11] & 0xff);
ByteBuffer byteBuffer = ByteBuffer.allocate(Integer.BYTES);
byteBuffer.put(padded, 12, 4);
byteBuffer.flip();