History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: BATCH-630
Type: Improvement Improvement
Status: Open Open
Priority: Minor Minor
Assignee: Unassigned
Reporter: Markus Thielen
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Spring Batch

Possibility to trim input line and fields in Fieldset in LineTokenizer's

Created: 17/May/08 05:57 PM   Updated: 19/May/08 12:37 PM
Component/s: Infrastructure
Affects Version/s: 1.0.1
Fix Version/s: None

Time Tracking:
Not Specified

File Attachments: 1. Java Source File TrimDelimitedLineTokenizer.java (1 kb)



 Description  « Hide
My flatfiles often have many whitespaces around their lines and fields. So it would be nice to have a property to set automatic trimming the inputline and/or the resulting fieldset-fields.
I subclassed DelimitedLineTokenizer for this situation, but it might be something interesting in general.

 All   Comments   Work Log   Change History   FishEye   Related Builds      Sort Order: Ascending order - Click to sort in descending order
Markus Thielen - 17/May/08 05:59 PM
Subclass of DelimitedLineTokenizer for trimming ability

Robert Kasanicky - 19/May/08 02:47 AM
DefaultFieldSet trims the values by default and allows you to access the non-trimmed value using readRawString(..) - doesn't this meet your needs?

Markus Thielen - 19/May/08 12:37 PM
Hi Robert and thanks for the quick response.
I really need the fieldnames be trimmed, too. DefaultFieldSet doesnt trim them but only the field contents. I also need the hole line getting trimmed before mapping.
I have a situation where I process csv-style files where the delimiter is a Tab. Sometimes the lines begin with a tab which will result to a field that has no name. So trimming the field-contents is not enough here.
Maybe its a bit of a exotic use-case :)