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

The skip method for some InputStreams and Readers return invalid values

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 10.3.1.4
    • 10.3.1.4
    • JDBC, Store
    • None

    Description

      The Java API docs for InputStream.skip and Reader.skip seem to indicate that returning a negative value is breaking the contract.
      The contract for Reader.skip is the more clear one, while I have taken the assumption that all Derby InputStreams will return 0 only when EOF has been reached or 0 is passed in as the amount of bytes to skip.

      Bad checking in a skip method also caused Derby to enter an infinite loop in a skip method.

      It should also be noted that skipping bytes/characters should be done in a loop, as skip is free to skip a smaller amount of bytes than requested. This is true even if EOF is not reached.

      Attachments

        1. derby-2686-1a.diff
          5 kB
          Kristian Waagan
        2. derby-2686-1a.stat
          0.5 kB
          Kristian Waagan
        3. derby-2686-2a-reader.diff
          2 kB
          Kristian Waagan
        4. derby-2686-2a-reader.stat
          0.1 kB
          Kristian Waagan
        5. derby-2686-3a.diff
          2 kB
          Kristian Waagan
        6. derby-2686-3a.stat
          0.2 kB
          Kristian Waagan

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: