[jira] [Commented] (SLING-11041) CsvPipe: InputStream closed before Iterator is finished
[ https://issues.apache.org/jira/browse/SLING-11041?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17469267#comment-17469267 ] Lukas Kummer commented on SLING-11041: -- [~npeltier] That's really great. Tested it, and it works :D(y) I'll provide an example. > 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 > > 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)
[jira] [Commented] (SLING-11041) CsvPipe: InputStream closed before Iterator is finished
[ https://issues.apache.org/jira/browse/SLING-11041?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17469227#comment-17469227 ] Nicolas Peltier commented on SLING-11041: - [~luckyluke80] we could also move the IS closing to the "after" hook. > 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 > > 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)