Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-11041

CsvPipe: InputStream closed before Iterator is finished

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • Pipes 4.3.0
    • Pipes 4.4.0
    • pipes
    • None

    Description

      When using the CsvPipe and using a remote source for the expr such as:

      csv https://raw.githubusercontent.com/apache/sling-org-apache-sling-pipes/5660af99a75f36915bbd5b226c459952cb972f30/src/test/resources/standardTest.csv
      | echo ${item.apple}
      

      an Exception will be thrown, that `next()` cannot be called because the stream is closed. The reason is, that the AbstractInputStreamPipe is closing the InputStream quietly before the CsvIterator has finished it's task.

      One solution could be to delegate the task of closing the InputStream to the inherited classes of the Abstract Class (CsvPipe, JsonPipe, RegexPipe).

      Another solution could be to create an AbstractIterator. This iterator could also read in the InputStream to a defined size (to limit the used memory) into a String. This String can then be used again to create a stream.

      This problem mainly affects CsvPipe and RegexPipe for remote connections. It does not affect the JsonPipe because the JsonPipe is reading in the full String from the InputStream.

      Attachments

        Activity

          People

            Unassigned Unassigned
            luckyluke80 Lukas Kummer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 0.5h
                0.5h