Skip to content

Commit 6ed1940

Browse files
authored
fix: correctly use bytebuffer slice in decodecontexts method (#2925)
* fix: correctly use bytebuffer slice in decodecontexts method Signed-off-by: Tino Britty <[email protected]> * eckstyle] [ERROR] RESOLVED --------- Signed-off-by: Tino Britty <[email protected]>
1 parent e3c45d9 commit 6ed1940

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)