You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by "lifepuzzlefun (via GitHub)" <gi...@apache.org> on 2023/08/07 05:00:59 UTC
[GitHub] [bookkeeper] lifepuzzlefun commented on a diff in pull request #4021: Fix negative position read on BufferedChannel cause data can't read problem.
lifepuzzlefun commented on code in PR #4021:
URL: https://github.com/apache/bookkeeper/pull/4021#discussion_r1285379241
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BufferedChannel.java:
##########
@@ -243,6 +243,11 @@ public long forceWrite(boolean forceMetadata) throws IOException {
@Override
public synchronized int read(ByteBuf dest, long pos, int length) throws IOException {
+ // protect negative position read
+ if (pos < 0) {
+ throw new IllegalArgumentException("Negative position pos:" + pos);
Review Comment:
Thanks for review. my concern on using IOException is that current code base seems not process IOException directly. I didn't check what will happen if the IOException throws outside. For this case I think the `IllegalArgumentException` is the same as origin behaviour as this is the same exception throw by jdk.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org