Package org.springframework.batch.core.step.item

# Class DefaultItemFailureHandler

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

All Implemented Interfaces:
  `ItemProcessListener<Object,Object>`, `ItemReadListener<Object>`, `ItemWriteListener<Object>`, `StepListener`

public class DefaultItemFailureHandler extends ItemListenerSupport<Object,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
  Description
  `protected static final org.apache.commons.logging.Log`
  `logger`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DefaultItemFailureHandler()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `onReadError(Exception ex)`
  Called if an error occurs while trying to read.
  `void`
  `onWriteError(Exception ex, List<? extends Object> item)`
  Called if an error occurs while trying to write.

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

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

  ### Methods inherited from interface org.springframework.batch.core.ItemProcessListener

  `afterProcess, beforeProcess, onProcessError`

  ### Methods inherited from interface org.springframework.batch.core.ItemReadListener

  `afterRead, beforeRead`

  ### Methods inherited from interface org.springframework.batch.core.ItemWriteListener

  `afterWrite, beforeWrite`

- ## Field Details

  - ### logger

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

- ## Constructor Details

  - ### DefaultItemFailureHandler

    public DefaultItemFailureHandler()

- ## Method Details

  - ### onReadError

    public void onReadError(Exception ex)
    Description copied from interface: `ItemReadListener`
    Called if an error occurs while trying to read.
    Parameters:
      `ex` - thrown from `ItemReader`

  - ### onWriteError

    public void onWriteError(Exception ex, List<? extends 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.
    Parameters:
      `ex` - thrown from `ItemWriter`
      `item` - attempted to be written.