Uploaded image for project: 'Spring Batch'
  1. Spring Batch
  2. BATCH-2424

Spring batch issue with double quote with version 1.1.2

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Invalid
    • Affects Version/s: 1.1.Maintenance
    • Fix Version/s: None
    • Component/s: Core, Integration
    • Labels:
      None

      Description

      The batch application I am working on reads and processes lines from a delimited text file. Application to use a `FlatFileReader` to read the delimited text file,
      `test.txt`

      ( aa|bb|cc|vv|nn|mm|ff|gg|ee|"rr|gg|jj||||ii| )

      But the issue is that some of the data in the file has double quote, I need to process the data with double quote.

      Unfortunately `FieldSet` method in spring batch is reading string after double quote has single string. Even if there are two or three double quote its throwing an exception my program throwing an exception.
      exception:

          ArrayIndexOutOfBoundsException: Array index out of range,
          mapping.DefaultFieldSet.readAndTrim(DefaultFieldSet.java).
      

      Anyone come across this issue, if so, what would be the proper resolution?

      Manipulating the data itself is not an option unfortunately. I have tried adding an escape character before every double quote, but an exception is still thrown regardless.

      Any help would be greatly appreciated.

      I have added below property tag to my DelimiterLineTokenizer then issues has been resolved but some time I'm getting an error "item.DefaultItemFailureHandler - Error encountered while reading",
      "*Caused by:
      org.springframework.batch.core.JobInterruptedException: JobExecution interrupted.*"

               <Property name="lineTokenizer"> 
               <beanclass="org.springframework.batch.item.file.transform.DelimitedLineTokenizer">
               <property name="quoteCharacter" value="@" /> 
               </bean> 
               </property> 
       

      Any help can Be greatly appreciated.

      I'm currently using spring batch version 1.1.2, I'm unable to process the data with single double quote (I mean only with one double quote). I'm getting the exception as:
      "***quartz.SimpleThreadPoolTaskExecutor - Error while executing the Runnable:
      org.springframework.batch.core.UnexpectedJobExecutionException: Unexpected checked exception in job execution***"

      "***org.springframework.batch.core.JobInterruptedException: JobExecution interrupted.
      at org.springframework.batch.core.job.SimpleJob.execute***"
      Again manipulating the data is not an option. I have seen many other post but no one is using spring batch 1.1.2 at this time. version upgrade is not option too.
      Any help greatly appreciated.

        Activity

        Hide
        mminella Michael Minella added a comment -

        A couple things:

        1. Spring Batch 1.x hasn't been maintained in many years so if this were a bug, I'd ask that you upgrade to the latest maintained version (3.x) and try again.
        2. StackOverflow is the appropriate place to be asking configuration questions. Can you please post a question there including the pertinent configuration?
        Show
        mminella Michael Minella added a comment - A couple things: Spring Batch 1.x hasn't been maintained in many years so if this were a bug, I'd ask that you upgrade to the latest maintained version (3.x) and try again. StackOverflow is the appropriate place to be asking configuration questions. Can you please post a question there including the pertinent configuration?
        Hide
        jr.sonu sandeep sandy added a comment - - edited

        Thanks for the quick response Sir, I have couple of questions.
        1.I mean Upgrade is not an option for us at this time, because it require huge amount of time and effort,Is there any other way I can fix this.
        2. If we upgrade to spring batch 3.x, Do you think I can resolve this issue with latest version.
        3. I have posted my question in stackOverflow but I haven't got any response yet.

        Show
        jr.sonu sandeep sandy added a comment - - edited Thanks for the quick response Sir, I have couple of questions. 1.I mean Upgrade is not an option for us at this time, because it require huge amount of time and effort,Is there any other way I can fix this. 2. If we upgrade to spring batch 3.x, Do you think I can resolve this issue with latest version. 3. I have posted my question in stackOverflow but I haven't got any response yet.
        Hide
        mminella Michael Minella added a comment -

        Without seeing full stack traces, I can't be sure.

        Show
        mminella Michael Minella added a comment - Without seeing full stack traces, I can't be sure.
        Hide
        mminella Michael Minella added a comment -

        URL for the stack overflow question?

        Show
        mminella Michael Minella added a comment - URL for the stack overflow question?
        Hide
        jr.sonu sandeep sandy added a comment -
        Show
        jr.sonu sandeep sandy added a comment - Here is URL for question I have posted in StackOverflow: https://stackoverflow.com/questions/31859184/spring-batch-fieldset-with-double-quote-issue

          People

          • Assignee:
            mminella Michael Minella
            Reporter:
            jr.sonu sandeep sandy
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: