This is an automated email from the ASF dual-hosted git repository.
clesaec pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/avro.git
The following commit(s) were added to refs/heads/main by this push:
new 6d6728b56 AVRO-3887: Remove redundant casts in BinaryDecoder (#2558)
6d6728b56 is described below
commit 6d6728b56ecc642f6212bb3137efaca5895fe582
Author: Fokko Driesprong <[email protected]>
AuthorDate: Thu Oct 19 09:59:57 2023 +0200
AVRO-3887: Remove redundant casts in BinaryDecoder (#2558)
As it's simple & obvious changes with CI ok, i merge it
---
.../avro/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 3fa675d79..95030c4a6 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 @@ package org.apache.avro.io;
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 class BinaryDecoder extends Decoder {
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;
}