Skip to content

Commit

Permalink
AVRO-3887: Remove redundant casts in BinaryDecoder (apache#2558)
Browse files Browse the repository at this point in the history
As it's simple & obvious changes with CI ok, i merge it
  • Loading branch information
Fokko authored and Ranbir Kumar committed May 13, 2024
1 parent 21c5982 commit f425572
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit f425572

Please sign in to comment.