Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/com/github/luben/zstd/ZstdCompressCtx.java
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ public boolean compressDirectByteBufferStream(ByteBuffer dst, ByteBuffer src, En
try {
long result = compressDirectByteBufferStream0(nativePtr, dst, dst.position(), dst.limit(), src, src.position(), src.limit(), endOp.value());
if ((result & 0x80000000L) != 0) {
long code = result & 0xFF;
long code = -(result & 0xFF);
throw new ZstdException(code, Zstd.getErrorName(code));
}
src.position((int)(result & 0x7FFFFFFF));
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/github/luben/zstd/ZstdDecompressCtx.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public boolean decompressDirectByteBufferStream(ByteBuffer dst, ByteBuffer src)
try {
long result = decompressDirectByteBufferStream0(nativePtr, dst, dst.position(), dst.limit(), src, src.position(), src.limit());
if ((result & 0x80000000L) != 0) {
long code = result & 0xFF;
long code = -(result & 0xFF);
throw new ZstdException(code, Zstd.getErrorName(code));
}
src.position((int) (result & 0x7FFFFFFF));
Expand Down
3 changes: 2 additions & 1 deletion src/test/scala/Zstd.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1486,7 +1486,8 @@ class ZstdSpec extends AnyFlatSpec with ScalaCheckPropertyChecks {
cctx.compressDirectByteBufferStream(compressedBuffer, inputBuffer, EndDirective.END)
fail("compression succeeded, but should have failed")
} catch {
case _: ZstdException => // compression should throw a ZstdException
case ex: ZstdException => // compression should throw a ZstdException
assert(ex.getErrorCode == -106)
}
}
}
Expand Down
Loading