You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2020/02/12 03:41:38 UTC
[GitHub] [rocketmq] duhenglucky commented on a change in pull request #1758:
Fix bug in MessageClientIDSetter
duhenglucky commented on a change in pull request #1758: Fix bug in MessageClientIDSetter
URL: https://github.com/apache/rocketmq/pull/1758#discussion_r378026223
##########
File path: common/src/main/java/org/apache/rocketmq/common/message/MessageClientIDSetter.java
##########
@@ -37,13 +37,10 @@
} catch (Exception e) {
ip = createFakeIP();
}
- LEN = ip.length + 2 + 4 + 4 + 2;
- ByteBuffer tempBuffer = ByteBuffer.allocate(ip.length + 2 + 4);
- tempBuffer.position(0);
+ LEN = ip.length + 4 + 4 + 4 + 2;
+ ByteBuffer tempBuffer = ByteBuffer.allocate(ip.length + 4 + 4);
tempBuffer.put(ip);
- tempBuffer.position(ip.length);
tempBuffer.putInt(UtilAll.getPid());
- tempBuffer.position(ip.length + 2);
Review comment:
pid is short,so maybe putShort can resolve this issue,and this indeed a bug, ip.length + 2 will keep the lower 2 bytes.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services