Uploaded image for project: 'Bookkeeper'
  1. Bookkeeper
  2. BOOKKEEPER-958

ZeroBuffer readOnlyBuffer returns ByteBuffer with 0 remaining bytes for length > 64k

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.5.0
    • Component/s: None
    • Labels:
      None

      Description

      in ZeroBuffer
      here, if the length is > zeroBytes.length (64K), then it is returning zero ByteBuffer but its position is set to limit and hence its remaining will be 0, which is not expected, but if it is < 64k then its position is set to 0 and the remaining will be length.

      Looking at the call hierearchy, it seems there are no callers for this function, but since this is utility class it needs to be corrected.

      public static ByteBuffer readOnlyBuffer(int length) {
      ByteBuffer buffer;
      if (length <= zeroBytes.length)

      { buffer = ByteBuffer.wrap(zeroBytes, 0, length); }

      else

      { buffer = ByteBuffer.allocate(length); put(buffer); }

      return buffer.asReadOnlyBuffer();
      }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                reddycharan18@gmail.com Charan Reddy Guttapalem
                Reporter:
                reddycharan18@gmail.com Charan Reddy Guttapalem
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: