[
https://issues.apache.org/jira/browse/SLING-11041?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Nicolas Peltier resolved SLING-11041.
-------------------------------------
Resolution: Fixed
> CsvPipe: InputStream closed before Iterator is finished
> -------------------------------------------------------
>
> Key: SLING-11041
> URL: https://issues.apache.org/jira/browse/SLING-11041
> Project: Sling
> Issue Type: Bug
> Components: pipes
> Affects Versions: Pipes 4.3.0
> Reporter: Lukas Kummer
> Priority: Major
> Fix For: Pipes 4.4.0
>
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> When using the
> [CsvPipe|https://sling.apache.org/documentation/bundles/sling-pipes/readers.html#csv-pipe-csv-expr-1]
> and using a remote source for the expr such as:
> {code:java}
> csv
> https://raw.githubusercontent.com/apache/sling-org-apache-sling-pipes/5660af99a75f36915bbd5b226c459952cb972f30/src/test/resources/standardTest.csv
> | echo ${item.apple}
> {code}
> 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|https://github.com/apache/sling-org-apache-sling-pipes/blob/5660af99a75f36915bbd5b226c459952cb972f30/src/main/java/org/apache/sling/pipes/AbstractInputStreamPipe.java#L118]
> 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.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)