Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-7415

lazyLoad with CSV blows up on last line

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.12.3, 2.13.0
    • Fix Version/s: 2.12.4, 2.13.2, 2.14.0
    • Component/s: camel-csv
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      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() 
      
      

      Here is the exception when camel try to access the last line of the file.

      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) 
      

        Attachments

          Activity

            People

            • Assignee:
              njiang Willem Jiang
              Reporter:
              njiang Willem Jiang
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: