Skip to content

Commit 7babea6

Browse files
authored
[core] Add exception handing in zstd compressor (#4183)
1 parent 5da3ff5 commit 7babea6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

paimon-common/src/main/java/org/apache/paimon/compression/ZstdBlockCompressor.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,14 @@ public void write(int b) {
8484

8585
@Override
8686
public void write(byte[] b, int off, int len) throws IOException {
87+
if (b == null || buf == null) {
88+
throw new NullPointerException("Input array or buffer is null");
89+
}
8790
if ((off < 0) || (off > b.length) || (len < 0) || ((off + len) - b.length > 0)) {
88-
throw new IndexOutOfBoundsException();
91+
throw new IndexOutOfBoundsException("Invalid offset or length");
92+
}
93+
if (b.length == 0) {
94+
return;
8995
}
9096
try {
9197
System.arraycopy(b, off, buf, position, len);

0 commit comments

Comments
 (0)