Skip to content

Commit 3161bcf

Browse files
Artem LabazinArtem Labazin
authored andcommitted
Fix print HEX dump bug
1 parent 609d4ad commit 3161bcf

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1212
- Add more tests.
1313
- Add `JavaDoc`.
1414

15+
## [1.16.2](https://github.com/appulse-projects/utils-java/releases/tag/1.16.2) - 2019-04-26
16+
17+
### Changed
18+
19+
- `HexUtil`.`prettyHexDump` bug, which calculate wrong buffer's limit.
20+
1521
## [1.16.1](https://github.com/appulse-projects/utils-java/releases/tag/1.16.1) - 2019-04-26
1622

1723
### Added

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ limitations under the License.
2424

2525
<groupId>io.appulse</groupId>
2626
<artifactId>utils-java</artifactId>
27-
<version>1.16.1</version>
27+
<version>1.16.2</version>
2828
<packaging>jar</packaging>
2929

3030
<properties>
@@ -66,7 +66,7 @@ limitations under the License.
6666
<url>https://github.com/appulse-projects/utils-java</url>
6767
<connection>scm:git:https://github.com/appulse-projects/utils-java.git</connection>
6868
<developerConnection>scm:git:https://github.com/appulse-projects/utils-java.git</developerConnection>
69-
<tag>1.16.1</tag>
69+
<tag>1.16.2</tag>
7070
</scm>
7171

7272
<distributionManagement>

src/main/java/io/appulse/utils/HexUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ public static String prettyHexDump (@NonNull Bytes buffer, int offset, int lengt
185185
val asciiDump = new StringBuilder(" ");
186186

187187
val rowStartIndex = row * elementsInRow + offset;
188-
val limit = Math.min(buffer.capacity() - rowStartIndex, elementsInRow);
188+
val limit = Math.min(buffer.writerIndex() - rowStartIndex, elementsInRow);
189189
for (int index = 0; index < limit; index++) {
190190
val value = buffer.getUnsignedByte(rowStartIndex + index);
191191

0 commit comments

Comments
 (0)