Skip to content

Commit 7c47716

Browse files
Gezi-lzqbrittytino
andauthored
fix: correctly use bytebuffer slice in decodecontexts method (#2925) (#2976)
* fix: correctly use bytebuffer slice in decodecontexts method * eckstyle] [ERROR] RESOLVED --------- Signed-off-by: Tino Britty <[email protected]> Co-authored-by: Tino Britty <[email protected]>
1 parent 1299fb8 commit 7c47716

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

core/src/main/java/kafka/automq/failover/FailoverListener.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ private Optional<FailoverContext[]> getContexts(MetadataDelta delta) {
8080
.map(kv -> kv.get(FailoverConstants.FAILOVER_KEY))
8181
.map(this::decodeContexts);
8282
}
83-
83+
8484
private FailoverContext[] decodeContexts(ByteBuffer byteBuffer) {
85-
byteBuffer.slice();
86-
byte[] data = new byte[byteBuffer.remaining()];
87-
byteBuffer.get(data);
85+
ByteBuffer slice = byteBuffer.slice();
86+
byte[] data = new byte[slice.remaining()];
87+
slice.get(data);
8888
return JsonUtils.decode(new String(data, StandardCharsets.UTF_8), FailoverContext[].class);
8989
}
9090

0 commit comments

Comments
 (0)