From 30a4631c19d76e823de10e33dd41b5528daf0e46 Mon Sep 17 00:00:00 2001 From: lucasward Date: Wed, 13 Feb 2008 21:05:57 +0000 Subject: [PATCH] BATCH-220: More refinements to chunking, both the chunker and dechunker now return a 'result'. The chunker returns a ChunkingResult, and the Dechunker returns a DechunkingResult, allowing for the step to handle exceptions in a uniform way. --- .../io/exception/WriteFailureException.java | 21 ++++++++++++++++--- .../batch/item/ExecutionAttributes.java | 2 ++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/exception/WriteFailureException.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/exception/WriteFailureException.java index 93d6aefdb..5387c02f4 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/exception/WriteFailureException.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/exception/WriteFailureException.java @@ -27,16 +27,31 @@ import org.springframework.batch.item.ItemWriter; */ public class WriteFailureException extends BatchCriticalException { private static final long serialVersionUID = -1933213086873834098L; + + private final Object item; - public WriteFailureException(String msg, Throwable ex) { + public WriteFailureException(String msg, Throwable ex, Object item) { super(msg, ex); + this.item = item; } public WriteFailureException(String msg) { - super(msg); + this(msg, null, null); } public WriteFailureException(Throwable nested) { - super(nested); + this("", nested, null); + } + + public WriteFailureException(String msg, Object item){ + this(msg, null, item); + } + + public WriteFailureException(Throwable nested, Object item){ + this("", nested, item); + } + + public Object getItem() { + return item; } } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ExecutionAttributes.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ExecutionAttributes.java index 80be0ebc5..17cc5548e 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ExecutionAttributes.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ExecutionAttributes.java @@ -31,6 +31,8 @@ import org.springframework.util.Assert; * essentially a thin wrapper for a map that allows for type safety on reads. It * also allows for dirty checking by setting a 'dirty' flag whenever any put is * called. + * + * @author Lucas Ward */ public class ExecutionAttributes {