From f425572293f0b0d543879e72c85261ee5593dc00 Mon Sep 17 00:00:00 2001 From: Fokko Driesprong Date: Thu, 19 Oct 2023 09:59:57 +0200 Subject: [PATCH] AVRO-3887: Remove redundant casts in BinaryDecoder (#2558) As it's simple & obvious changes with CI ok, i merge it --- .../src/main/java/org/apache/avro/io/BinaryDecoder.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/BinaryDecoder.java b/lang/java/avro/src/main/java/org/apache/avro/io/BinaryDecoder.java index 3fa675d793a..95030c4a60a 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/io/BinaryDecoder.java +++ b/lang/java/avro/src/main/java/org/apache/avro/io/BinaryDecoder.java @@ -20,7 +20,6 @@ import java.io.EOFException; import java.io.IOException; import java.io.InputStream; -import java.nio.Buffer; import java.nio.ByteBuffer; import java.util.Arrays; @@ -309,12 +308,12 @@ public ByteBuffer readBytes(ByteBuffer old) throws IOException { final ByteBuffer result; if (old != null && length <= old.capacity()) { result = old; - ((Buffer) result).clear(); + result.clear(); } else { - result = ByteBuffer.allocate((int) length); + result = ByteBuffer.allocate(length); } - doReadBytes(result.array(), result.position(), (int) length); - ((Buffer) result).limit((int) length); + doReadBytes(result.array(), result.position(), length); + result.limit(length); return result; }