From 6d26e40cc8ead4dcd2829e18d9242b5655b78eb0 Mon Sep 17 00:00:00 2001 From: Chris Schaefer Date: Wed, 18 Dec 2013 13:54:07 -0500 Subject: [PATCH] Implement onSkipInWrite for delegate to handle Fixes TCK tests: testChunkSkipWrite and testChunkSkipWriteExceedSkip --- .../batch/core/jsr/SkipListenerAdapter.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/SkipListenerAdapter.java b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/SkipListenerAdapter.java index ab0834c5f..2fd7e7f44 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/SkipListenerAdapter.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/jsr/SkipListenerAdapter.java @@ -7,8 +7,9 @@ import javax.batch.operations.BatchRuntimeException; import org.springframework.batch.core.SkipListener; -public class SkipListenerAdapter implements SkipListener { +import java.util.List; +public class SkipListenerAdapter implements SkipListener { private final SkipReadListener skipReadDelegate; private final SkipProcessListener skipProcessDelegate; private final SkipWriteListener skipWriteDelegate; @@ -32,7 +33,13 @@ public class SkipListenerAdapter implements SkipListener { @Override public void onSkipInWrite(S item, Throwable t) { - //TODO: This will take more than just wrapping... + if(skipWriteDelegate != null && t instanceof Exception) { + try { + skipWriteDelegate.onSkipWriteItem((List) item, (Exception) t); + } catch (Exception e) { + throw new BatchRuntimeException(e); + } + } } @Override