Announcement Announcement Module
Collapse
No announcement yet.
UnmappableCharacterException has no effect on job's status Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • UnmappableCharacterException has no effect on job's status

    Hi,

    I've been thru a case where some invalid character is triggering the following exception: java.nio.charset.UnmappableCharacterException: Input length = 1

    When I look at the stack trace (included below)/debugger/source code, it looks like this exception is catched, logged but not re-throwned.

    The job is then COMPLETED which is not true (the last buffer to be written is missing from the file).

    Is there something I miss? I can't see any place where I could catch the error and change the job status to FAILED.

    Any idea?

    Regards, Gino.

    Here's the stacktrace:

    [2010-03-29 16:10:14,431] ERROR [org.springframework.transaction.support.Transactio nSynchronizationUtils]#[main] TransactionSynchronization.afterCompletion threw exception
    org.springframework.batch.support.transaction.Flus hFailedException: Could not write to output buffer
    at org.springframework.batch.support.transaction.Tran sactionAwareBufferedWriter$1.afterCompletion(Trans actionAwareBufferedWriter.java:71)
    at org.springframework.transaction.support.Transactio nSynchronizationUtils.invokeAfterCompletion(Transa ctionSynchronizationUtils.java:157)
    at org.springframework.transaction.support.AbstractPl atformTransactionManager.invokeAfterCompletion(Abs tractPlatformTransactionManager.java:974)
    at org.springframework.transaction.support.AbstractPl atformTransactionManager.triggerAfterCompletion(Ab stractPlatformTransactionManager.java:949)
    at org.springframework.transaction.support.AbstractPl atformTransactionManager.processCommit(AbstractPla tformTransactionManager.java:777)
    at org.springframework.transaction.support.AbstractPl atformTransactionManager.commit(AbstractPlatformTr ansactionManager.java:701)
    at org.springframework.batch.core.step.tasklet.Taskle tStep$2.doInChunkContext(TaskletStep.java:297)
    at org.springframework.batch.core.scope.context.StepC ontextRepeatCallback.doInIteration(StepContextRepe atCallback.java:67)
    at org.springframework.batch.repeat.support.RepeatTem plate.getNextResult(RepeatTemplate.java:352)
    at org.springframework.batch.repeat.support.RepeatTem plate.executeInternal(RepeatTemplate.java:212)
    at org.springframework.batch.repeat.support.RepeatTem plate.iterate(RepeatTemplate.java:143)
    at org.springframework.batch.core.step.tasklet.Taskle tStep.doExecute(TaskletStep.java:239)
    at org.springframework.batch.core.step.AbstractStep.e xecute(AbstractStep.java:197)
    at org.springframework.batch.core.job.AbstractJob.han dleStep(AbstractJob.java:348)
    at org.springframework.batch.core.job.flow.FlowJob.ac cess$100(FlowJob.java:43)
    at org.springframework.batch.core.job.flow.FlowJob$Jo bFlowExecutor.executeStep(FlowJob.java:137)
    at org.springframework.batch.core.job.flow.support.st ate.StepState.handle(StepState.java:60)
    at org.springframework.batch.core.job.flow.support.Si mpleFlow.resume(SimpleFlow.java:144)
    at org.springframework.batch.core.job.flow.support.Si mpleFlow.start(SimpleFlow.java:124)
    at org.springframework.batch.core.job.flow.FlowJob.do Execute(FlowJob.java:105)
    at org.springframework.batch.core.job.AbstractJob.exe cute(AbstractJob.java:250)
    at org.springframework.batch.core.launch.support.Simp leJobLauncher$1.run(SimpleJobLauncher.java:110)
    at org.springframework.core.task.SyncTaskExecutor.exe cute(SyncTaskExecutor.java:49)
    at org.springframework.batch.core.launch.support.Simp leJobLauncher.run(SimpleJobLauncher.java:105)
    at org.springframework.batch.core.launch.support.Comm andLineJobRunner.start(CommandLineJobRunner.java:2 07)
    at org.springframework.batch.core.launch.support.Comm andLineJobRunner.main(CommandLineJobRunner.java:25 4)
    Caused by: java.nio.charset.UnmappableCharacterException: Input length = 1
    at java.nio.charset.CoderResult.throwException(CoderR esult.java:261)
    at sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.j ava:266)
    at sun.nio.cs.StreamEncoder.write(StreamEncoder.java: 106)
    at sun.nio.cs.StreamEncoder.write(StreamEncoder.java: 116)
    at java.io.Writer.write(Writer.java:140)
    at org.springframework.batch.support.transaction.Tran sactionAwareBufferedWriter$1.afterCompletion(Trans actionAwareBufferedWriter.java:67)
    ... 25 more

  • #2
    which version are you using? Can you reproduce with Spring Batch 2.1.0?

    Comment


    • #3
      I'm using 2.0.0.

      I've just tried with 2.1.0 with same result.

      It looks to me that the source of the problem resides in the TransactionSynchronizationUtils class (that is part of the org.springframework.transaction.support package) which is not a Spring Batch class.

      I don't understand why this class keeps the exception to itself instead of rethrowing it in order to let the job FAILED.

      Comment

      Working...
      X