xadisk
  1. xadisk
  2. XADISK-128

NativeXAFileInputStream skip method throws an unexpected IllegalArgumentException with message "New position cannot be negative or more than file size"

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 1.2.1
    • Fix Version/s: 1.2.2
    • Component/s: filesystem
    • Labels:
      None

      Description

      Calling skip method on XAFileInputStream generate IllegalArgumentException due to wrongly calculated readPositionAfterSkip.
      This variable is evaluated with this expression:

      (NativeXAFileInputStream.java line 175)
      long readPositionAfterSkip = (position - byteBuffer.remaining()) + n;

      Using a position equals to 0 and skipping 200 bytes with a generic file larger than 200 bytes this expression return a negative value and than, the subsequential calling to "position(readPositionAfterSkip)" method, will throws IllegalArgumentException.

      Why don't simply use this?
      long readPositionAfterSkip = position + n;

      Thank you
      Marco

        Activity

          People

          • Assignee:
            Nitin Verma
            Reporter:
            Marco Quaranta
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: