org.springframework.batch.core.step.item

## Class DefaultItemFailureHandler

- java.lang.Object
- - org.springframework.batch.core.listener.ItemListenerSupport<java.lang.Object,java.lang.Object>
  - - org.springframework.batch.core.step.item.DefaultItemFailureHandler

- All Implemented Interfaces:
    ItemProcessListener<java.lang.Object,java.lang.Object>, ItemReadListener<java.lang.Object>, ItemWriteListener<java.lang.Object>, StepListener

      public class DefaultItemFailureHandler
      extends ItemListenerSupport<java.lang.Object,java.lang.Object>

  Default implementation of the `ItemListenerSupport` class that writes all exceptions via commons logging. Since generics can't be used to ensure the list contains exceptions, any non exceptions will be logged out by calling toString on the object.
  Author:
    Lucas Ward

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static org.apache.commons.logging.Log` | `logger`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultItemFailureHandler()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `onReadError(java.lang.Exception ex)` Called if an error occurs while trying to read.
    `void` | `onWriteError(java.lang.Exception ex, java.util.List<? extends java.lang.Object> item)` Called if an error occurs while trying to write.

    - ### Methods inherited from class org.springframework.batch.core.listener.ItemListenerSupport

      `afterProcess, afterRead, afterWrite, beforeProcess, beforeRead, beforeWrite, onProcessError`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### logger

          protected static final org.apache.commons.logging.Log logger

  - ### Constructor Detail

    - #### DefaultItemFailureHandler

          public DefaultItemFailureHandler()

  - ### Method Detail

    - #### onReadError

          public void onReadError(java.lang.Exception ex)

      Description copied from interface: `ItemReadListener`
      Called if an error occurs while trying to read.
      Specified by:
        `onReadError` in interface `ItemReadListener<java.lang.Object>`
      Overrides:
        `onReadError` in class `ItemListenerSupport<java.lang.Object,java.lang.Object>`
      Parameters:
        `ex` - thrown from `ItemWriter`

    - #### onWriteError

          public void onWriteError(java.lang.Exception ex,
                                   java.util.List<? extends java.lang.Object> item)

      Description copied from interface: `ItemWriteListener`
      Called if an error occurs while trying to write. Will be called inside a transaction, but the transaction will normally be rolled back. There is no way to identify from this callback which of the items (if any) caused the error.
      Specified by:
        `onWriteError` in interface `ItemWriteListener<java.lang.Object>`
      Overrides:
        `onWriteError` in class `ItemListenerSupport<java.lang.Object,java.lang.Object>`
      Parameters:
        `ex` - thrown from `ItemWriter`
        `item` - attempted to be written.