Uploaded image for project: 'ShrinkWrap'
  1. ShrinkWrap
  2. SHRINKWRAP-470

SeekableInMemoryByteChannel.truncate misimplements the contract

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 1.2.1
    • Component/s: None
    • Labels:
      None

      Description

      At the tail end of truncate, is this logic:

      // If we've been given a size greater than we are
      if (newSize > currentSize) {
          // Reset the position only
          this.position = newSize;
      }
      

      which is not what the API says: "If the given size is less than the current size then the entity is truncated, discarding any bytes beyond the new end. If the given size is greater than or equal to the current size then the entity is not modified."

      I think you wanted this instead, which should be inside the above array truncation:

      // If we've been given a size less than we are
      if (newSize < currentSize) {
          // Reset the size only
          this.size = newSize;
      }
      

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                mmatloka Michal Matloka
                Reporter:
                undertheflowerpot Under Flowerpot
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: