[jira] [Commented] (CAMEL-7415) lazyLoad with CSV blows up on last line
[ https://issues.apache.org/jira/browse/CAMEL-7415?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14008067#comment-14008067 ] Antoine DESSAIGNE commented on CAMEL-7415: -- Hi Willem, Correct me if I'm wrong but the InputStream won't be closed if the iterator is not processed until the end. This case can happen if you're processing manually the iterator and not rely on split. For my pull request of CAMEL-7447, I've called exchange.addOnCompletion in order to close the inputstream. Is it correct ? lazyLoad with CSV blows up on last line --- Key: CAMEL-7415 URL: https://issues.apache.org/jira/browse/CAMEL-7415 Project: Camel Issue Type: Bug Components: camel-csv Affects Versions: 2.12.3, 2.13.0 Reporter: Willem Jiang Assignee: Willem Jiang Fix For: 2.12.4, 2.13.2 {code} CsvDataFormat csv = new CsvDataFormat() csv.setDelimiter(' ') csv.setSkipFirstLine(false) csv.setLazyLoad(true) CamelContext camelContext = new DefaultCamelContext() camelContext.addRoutes(new RouteBuilder() { def void configure() { from('direct:start') .unmarshal(csv) .split(body()).streaming() .log('row: ${body}') } }) camelContext.start() ProducerTemplate t = camelContext.createProducerTemplate() t.sendBody('direct:start', new File('/Users/timbo/data/test.txt')) camelContext.stop() {code} Here is the exception when camel try to access the last line of the file. {code} java.lang.IllegalStateException: java.io.IOException: Stream closed at org.apache.camel.dataformat.csv.CsvIterator.next(CsvIterator.java:61) at org.apache.camel.processor.Splitter$SplitterIterable$1.next(Splitter.java:170) at org.apache.camel.processor.Splitter$SplitterIterable$1.next(Splitter.java:146) at org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:502) {code} -- This message was sent by Atlassian JIRA (v6.2#6252)
[jira] [Commented] (CAMEL-7415) lazyLoad with CSV blows up on last line
[ https://issues.apache.org/jira/browse/CAMEL-7415?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14008086#comment-14008086 ] Willem Jiang commented on CAMEL-7415: - Hi Antoine I think we need to let the user close the iterator or the input stream when he finish the process. Closing the stream in exchange.onCompletion could cause some trouble if we just route the message to other system which is not part of camel route, As the exchange onCompletion is called when the route processes the exchange. we may hit the same issue as we meet in CAMEL-7415. Regards, Willem lazyLoad with CSV blows up on last line --- Key: CAMEL-7415 URL: https://issues.apache.org/jira/browse/CAMEL-7415 Project: Camel Issue Type: Bug Components: camel-csv Affects Versions: 2.12.3, 2.13.0 Reporter: Willem Jiang Assignee: Willem Jiang Fix For: 2.12.4, 2.13.2 {code} CsvDataFormat csv = new CsvDataFormat() csv.setDelimiter(' ') csv.setSkipFirstLine(false) csv.setLazyLoad(true) CamelContext camelContext = new DefaultCamelContext() camelContext.addRoutes(new RouteBuilder() { def void configure() { from('direct:start') .unmarshal(csv) .split(body()).streaming() .log('row: ${body}') } }) camelContext.start() ProducerTemplate t = camelContext.createProducerTemplate() t.sendBody('direct:start', new File('/Users/timbo/data/test.txt')) camelContext.stop() {code} Here is the exception when camel try to access the last line of the file. {code} java.lang.IllegalStateException: java.io.IOException: Stream closed at org.apache.camel.dataformat.csv.CsvIterator.next(CsvIterator.java:61) at org.apache.camel.processor.Splitter$SplitterIterable$1.next(Splitter.java:170) at org.apache.camel.processor.Splitter$SplitterIterable$1.next(Splitter.java:146) at org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:502) {code} -- This message was sent by Atlassian JIRA (v6.2#6252)
[jira] [Commented] (CAMEL-7415) lazyLoad with CSV blows up on last line
[ https://issues.apache.org/jira/browse/CAMEL-7415?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14008094#comment-14008094 ] Antoine DESSAIGNE commented on CAMEL-7415: -- Hi Willem, Thanks you very much for sharing your insights. Antoine lazyLoad with CSV blows up on last line --- Key: CAMEL-7415 URL: https://issues.apache.org/jira/browse/CAMEL-7415 Project: Camel Issue Type: Bug Components: camel-csv Affects Versions: 2.12.3, 2.13.0 Reporter: Willem Jiang Assignee: Willem Jiang Fix For: 2.12.4, 2.13.2, 2.14.0 {code} CsvDataFormat csv = new CsvDataFormat() csv.setDelimiter(' ') csv.setSkipFirstLine(false) csv.setLazyLoad(true) CamelContext camelContext = new DefaultCamelContext() camelContext.addRoutes(new RouteBuilder() { def void configure() { from('direct:start') .unmarshal(csv) .split(body()).streaming() .log('row: ${body}') } }) camelContext.start() ProducerTemplate t = camelContext.createProducerTemplate() t.sendBody('direct:start', new File('/Users/timbo/data/test.txt')) camelContext.stop() {code} Here is the exception when camel try to access the last line of the file. {code} java.lang.IllegalStateException: java.io.IOException: Stream closed at org.apache.camel.dataformat.csv.CsvIterator.next(CsvIterator.java:61) at org.apache.camel.processor.Splitter$SplitterIterable$1.next(Splitter.java:170) at org.apache.camel.processor.Splitter$SplitterIterable$1.next(Splitter.java:146) at org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:502) {code} -- This message was sent by Atlassian JIRA (v6.2#6252)
[jira] [Commented] (CAMEL-7415) lazyLoad with CSV blows up on last line
[ https://issues.apache.org/jira/browse/CAMEL-7415?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13990360#comment-13990360 ] Willem Jiang commented on CAMEL-7415: - This issue is caused by the UnmarshalProcessor always wants to close the inputstream even the marshalled object is iterator. The input stream can be closed by the iterator, so leave the input stream if the result object is iterator solve the issue. lazyLoad with CSV blows up on last line --- Key: CAMEL-7415 URL: https://issues.apache.org/jira/browse/CAMEL-7415 Project: Camel Issue Type: Bug Components: camel-csv Affects Versions: 2.12.3, 2.13.0 Reporter: Willem Jiang Assignee: Willem Jiang Fix For: 2.12.4, 2.13.1 {code} CsvDataFormat csv = new CsvDataFormat() csv.setDelimiter(' ') csv.setSkipFirstLine(false) csv.setLazyLoad(true) CamelContext camelContext = new DefaultCamelContext() camelContext.addRoutes(new RouteBuilder() { def void configure() { from('direct:start') .unmarshal(csv) .split(body()).streaming() .log('row: ${body}') } }) camelContext.start() ProducerTemplate t = camelContext.createProducerTemplate() t.sendBody('direct:start', new File('/Users/timbo/data/test.txt')) camelContext.stop() {code} Here is the exception when camel try to access the last line of the file. {code} java.lang.IllegalStateException: java.io.IOException: Stream closed at org.apache.camel.dataformat.csv.CsvIterator.next(CsvIterator.java:61) at org.apache.camel.processor.Splitter$SplitterIterable$1.next(Splitter.java:170) at org.apache.camel.processor.Splitter$SplitterIterable$1.next(Splitter.java:146) at org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:502) {code} -- This message was sent by Atlassian JIRA (v6.2#6252)