This is an automated email from the ASF dual-hosted git repository.
lzljs3620320 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git
The following commit(s) were added to refs/heads/master by this push:
new 7babea64b [core] Add exception handing in zstd compressor (#4183)
7babea64b is described below
commit 7babea64b2bc36105ad376a7fc4789a5b13d8a47
Author: Jie Feng <[email protected]>
AuthorDate: Fri Sep 13 13:02:07 2024 +0800
[core] Add exception handing in zstd compressor (#4183)
---
.../java/org/apache/paimon/compression/ZstdBlockCompressor.java | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git
a/paimon-common/src/main/java/org/apache/paimon/compression/ZstdBlockCompressor.java
b/paimon-common/src/main/java/org/apache/paimon/compression/ZstdBlockCompressor.java
index 2da979479..1f52e0813 100644
---
a/paimon-common/src/main/java/org/apache/paimon/compression/ZstdBlockCompressor.java
+++
b/paimon-common/src/main/java/org/apache/paimon/compression/ZstdBlockCompressor.java
@@ -84,8 +84,14 @@ public class ZstdBlockCompressor implements BlockCompressor {
@Override
public void write(byte[] b, int off, int len) throws IOException {
+ if (b == null || buf == null) {
+ throw new NullPointerException("Input array or buffer is
null");
+ }
if ((off < 0) || (off > b.length) || (len < 0) || ((off + len) -
b.length > 0)) {
- throw new IndexOutOfBoundsException();
+ throw new IndexOutOfBoundsException("Invalid offset or
length");
+ }
+ if (b.length == 0) {
+ return;
}
try {
System.arraycopy(b, off, buf, position, len);