Fix the issue of incorrectly calculating the number of dump lines when using PrettyDump in ByteBufUtil (#9304)
Motivation: Fix the issue of incorrectly calculating the number of dump rows when using prettyHexDumpmethod in ByteBufUtil. The way to find the remainder is either length % 16 or length & 15 Modification: Fixed the way to calculate the remainder Result: Fixed #9301
This commit is contained in:
parent
262ced7ce4
commit
4596f9e139
@ -1095,7 +1095,7 @@ public final class ByteBufUtil {
|
||||
if (length == 0) {
|
||||
return StringUtil.EMPTY_STRING;
|
||||
} else {
|
||||
int rows = length / 16 + (length % 15 == 0? 0 : 1) + 4;
|
||||
int rows = length / 16 + ((length & 15) == 0? 0 : 1) + 4;
|
||||
StringBuilder buf = new StringBuilder(rows * 80);
|
||||
appendPrettyHexDump(buf, buffer, offset, length);
|
||||
return buf.toString();
|
||||
|
Loading…
Reference in New Issue
Block a user