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

  • UnmappableCharacterException has no effect on job's status


    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 [ nSynchronizationUtils]#[main] TransactionSynchronization.afterCompletion threw exception hFailedException: Could not write to output buffer
    at sactionAwareBufferedWriter$1.afterCompletion(Trans
    at nSynchronizationUtils.invokeAfterCompletion(Transa
    at atformTransactionManager.invokeAfterCompletion(Abs
    at atformTransactionManager.triggerAfterCompletion(Ab
    at atformTransactionManager.processCommit(AbstractPla
    at atformTransactionManager.commit(AbstractPlatformTr
    at org.springframework.batch.core.step.tasklet.Taskle tStep$2.doInChunkContext(
    at org.springframework.batch.core.scope.context.StepC ontextRepeatCallback.doInIteration(StepContextRepe
    at plate.getNextResult(
    at plate.executeInternal(
    at plate.iterate(
    at org.springframework.batch.core.step.tasklet.Taskle tStep.doExecute(
    at org.springframework.batch.core.step.AbstractStep.e xecute(
    at org.springframework.batch.core.job.AbstractJob.han dleStep(
    at cess$100(
    at org.springframework.batch.core.job.flow.FlowJob$Jo bFlowExecutor.executeStep(
    at ate.StepState.handle(
    at mpleFlow.resume(
    at mpleFlow.start(
    at Execute(
    at org.springframework.batch.core.job.AbstractJob.exe cute(
    at leJobLauncher$
    at org.springframework.core.task.SyncTaskExecutor.exe cute(
    at andLineJobRunner.start( 07)
    at andLineJobRunner.main( 4)
    Caused by: java.nio.charset.UnmappableCharacterException: Input length = 1
    at java.nio.charset.CoderResult.throwException(CoderR
    at sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.j ava:266)
    at sun.nio.cs.StreamEncoder.write( 106)
    at sun.nio.cs.StreamEncoder.write( 116)
    at sactionAwareBufferedWriter$1.afterCompletion(Trans
    ... 25 more

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


    • #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 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.