Hi!

Can you check both files in a Hex Editor/Viewer? Text Editors usually  
understand all kind of line breaks but eventually the splitter does not 
recognize it (you are using the line sep from your hosting system eg unix and 
your file is created under windows)?

Jens

Von meinem iPhone gesendet

> Am 27.10.2015 um 22:01 schrieb furchess123 <con...@hotmail.com>:
> 
> I have a route configuration that uses splitter().tokenize(...):
> 
> from(FILE_SPLITTER_ENDPOINT).routeId("fileSplitterRoute").
>            split().
>                tokenize(System.lineSeparator(), config.getLinesPerChunk()).
>                streaming().          // enable streaming vs. reading all
> into memory
>                parallelProcessing(readerConfig.isParallelProcessing()). //
> on/off concurrent processing of multiple chunks
>                stopOnException().    // stop processing file if system
> exception occurs (handled by onException clause)
>                unmarshal().csv().    // unmarshal each chunk to Java (list
> of String lists) using Camel's CSV component
>                bean(csvHandler).     // hand each unmarshalled list of
> lines/fields to bean that parses and validates codes
>                bean(importProcessor).// process codes for import (depending
> on operational mode and errors in exchange)
>                to(AGGREGATE_ERRORS_ENDPOINT).      // delegate to nested
> route to update error report
>            end();
> 
> The number of lines for the tokenizer to group is taken from a configuration
> bean. This works most of the time - unless the poller reads a file uploaded
> into the staging directory by a Spring Web MVC application that uses the
> exact text-book method described  here.
> <https://spring.io/guides/gs/uploading-files/>   
> 
> When I view the uploaded file in any editor/viewer, it appears fine, all
> line breaks are preserved! Nevertheless, Camel's tokenizer completely fails
> to group the lines into separate exchanges, and the route always puts all
> lines into the same exchange body that is eventually handed over to my
> "csvHandler" bean.  Note that the individual lines are recognized and get
> unmarshalled correctly. But all lines are processed in a single exchange. So
> far, this strange behavior /only/ happens with files the have been uploaded
> and via my Spring MVC application with the bytes extracted from the
> insurance of Spring's MultipartFile object that arrives at the MVC
> controller's request handler method.
> 
> Anyone has an idea why? Is this a bug? 
> Thanks for any help!
> CV
> 
> 
> 
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/splitter-tokenize-does-not-recognize-new-lines-in-file-uploaded-using-Spring-MVC-MultipartFile-tp5773127.html
> Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to