lifepuzzlefun commented on code in PR #4021:
URL: https://github.com/apache/bookkeeper/pull/4021#discussion_r1272996004


##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BufferedReadChannel.java:
##########
@@ -86,14 +86,25 @@ public synchronized int read(ByteBuf dest, long pos, int 
length) throws IOExcept
                 // here we reached eof.
                 break;
             } else {
-                // We don't have it in the buffer, so put necessary data in 
the buffer
-                readBufferStartPosition = currentPosition;
                 int readBytes = 0;
-                if ((readBytes = 
validateAndGetFileChannel().read(readBuffer.internalNioBuffer(0, readCapacity),
-                        currentPosition)) <= 0) {
+                try {
+                    // We don't have it in the buffer, so put necessary data 
in the buffer
+                    readBufferStartPosition = currentPosition;

Review Comment:
   changed to method early statement to protect negative pos read.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to