Munoon commented on PR #1451:
URL: https://github.com/apache/incubator-fury/pull/1451#issuecomment-2034646795

   Oh, and by the way, I've also received an exception when testing my channel 
in `MemoryBuffer#increaseReaderIndex` method. I guess, current implementation 
in this PR is incorrect, since the `MemoryBuffer#size` property didn't 
represent actual size of this buffer no more.
   
   I've fixed this method as follow:
   ```java
     public void increaseReaderIndex(int diff) {
       int readerIdx = readerIndex + diff;
       if (readerIdx < 0) {
         throw new IndexOutOfBoundsException(
             String.format(
                 "readerIndex: %d (expected: 0 <= readerIndex <= size(%d))", 
readerIdx, size));
       } else if (readerIdx > size) {
         int readCount = streamReader.fillBuffer(diff);
         if (diff > readCount) {
           throw new IndexOutOfBoundsException(
                   String.format(
                           "readerIndex: %d (expected: 0 <= readerIndex <= 
size(%d))", readerIdx, size));
         }
       }
       this.readerIndex = readerIdx;
     }
   ```


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to