Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-3781

PositionedStoreStream.reposition(pos) with pos greater than length leaves the stream object in an inconsistent state

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 10.3.3.0, 10.4.1.3, 10.5.1.1
    • Fix Version/s: 10.4.2.0, 10.5.1.1
    • Component/s: Store
    • Labels:
      None

      Description

      PositionedStoreStream.reposition(pos) with pos greater than the stream length leaves the stream object in an inconsistent state, causing subsequent calls to fail or the state to remain inconsistent (which can cause the wrong data to be returned).

      The problem is that the position variable gets out of sync with the underlying stream.
      There are at least two ways to fix this (assuming the positioned store stream does not know the length of the underlying stream):
      a) Reset stream to position zero.
      b) Let the stream be positioned at EOF and update the internal position variable.

      Option b) leaves the stream in an unusable state, and the next request will cause option a) to be performed. It also require a slight rewrite of 'PositionedStoreStream.skipFully' and 'PositionedStoreStream.reposition' to be able to determine the position of the stream (the length in this case).

      Option a) will cause the first page of the stream to be read into the cache (if not already there), but taken the reason for doing this is an error condition it seems acceptable.

      A correct value of the position variable is required for correct/valid operation of PositionedStoreStream.

        Attachments

        1. derby-3781-2b-remove_convenience_link.diff
          2 kB
          Kristian Waagan
        2. derby-3781-2a-remove_convenience_link.diff
          2 kB
          Kristian Waagan
        3. derby-3781-1a-fix_and_test.diff
          5 kB
          Kristian Waagan

          Issue Links

            Activity

              People

              • Assignee:
                kristwaa Kristian Waagan
                Reporter:
                kristwaa Kristian Waagan
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: