Results 1 to 3 of 3

Thread: Cannot change DefaultLineMapper delimiter ?

  1. #1
    Join Date
    Feb 2012
    Posts
    8

    Default Cannot change DefaultLineMapper delimiter ?

    Greetings,

    I got the following behaviour which I do not understand :
    In the following bean property, the | is never used as a separator thus I get incorrect number of fields exception.
    If I remove the constructor-arg, remove the delimiter property and thus use the comma separator, then, the fields are correctly tokenized.

    It is as if I was not allowed to change the separator. Is this a bug or did I miss something (more likely) ?

    <property name="lineMapper">
    <bean class="org.springframework.batch.item.file.mapping .DefaultLineMapper">

    <property name="lineTokenizer">
    <bean
    class="org.springframework.batch.item.file.transfo rm.DelimitedLineTokenizer">
    <constructor-arg value="|"/>
    <property name="names"
    value="CUST_ID|CUST_NAME" />

    </bean>
    </property>

    Many thanks !

  2. #2

    Default

    The delimiter is only used to tokenize the contents of the file you are reading. The "names" attribute of DelimitedLineTokenizer is a String[] of column names and you configure this in the application context by seperating the values with commas.

  3. #3
    Join Date
    Feb 2012
    Posts
    8

    Default

    aah ok !
    That is clear enough !

    Thank you very much

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •