From 2fea09b9cec7c13a0618556b073a24018b7cdbd4 Mon Sep 17 00:00:00 2001 From: Michael Minella Date: Fri, 12 Oct 2012 15:22:00 -0500 Subject: [PATCH 1/2] BATCH-1780: Updated usage of StepLIstenerFailedException to match doc --- .../core/listener/MulticasterBatchListener.java | 16 ++++++++-------- .../listener/StepListenerFailedException.java | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/MulticasterBatchListener.java b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/MulticasterBatchListener.java index eaad22e98..df2d301fd 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/MulticasterBatchListener.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/MulticasterBatchListener.java @@ -30,7 +30,7 @@ import org.springframework.batch.item.ItemStream; /** * @author Dave Syer - * + * */ public class MulticasterBatchListener implements StepExecutionListener, ChunkListener, ItemReadListener, ItemProcessListener, ItemWriteListener, SkipListener { @@ -57,7 +57,7 @@ public class MulticasterBatchListener implements StepExecutionListener, Ch /** * Register each of the objects as listeners. Once registered, calls to the * {@link MulticasterBatchListener} broadcast to the individual listeners. - * + * * @param listeners listener objects of types known to the multicaster. */ public void setListeners(List listeners) { @@ -169,7 +169,7 @@ public class MulticasterBatchListener implements StepExecutionListener, Ch } /** - * + * * @see org.springframework.batch.core.listener.CompositeChunkListener#afterChunk() */ public void afterChunk() { @@ -182,7 +182,7 @@ public class MulticasterBatchListener implements StepExecutionListener, Ch } /** - * + * * @see org.springframework.batch.core.listener.CompositeChunkListener#beforeChunk() */ public void beforeChunk() { @@ -208,7 +208,7 @@ public class MulticasterBatchListener implements StepExecutionListener, Ch } /** - * + * * @see org.springframework.batch.core.listener.CompositeItemReadListener#beforeRead() */ public void beforeRead() { @@ -229,12 +229,12 @@ public class MulticasterBatchListener implements StepExecutionListener, Ch itemReadListener.onReadError(ex); } catch (RuntimeException e) { - throw new StepListenerFailedException("Error in onReadError.", ex, e); + throw new StepListenerFailedException("Error in onReadError.", e, ex); } } /** - * + * * @see ItemWriteListener#afterWrite(List) */ public void afterWrite(List items) { @@ -269,7 +269,7 @@ public class MulticasterBatchListener implements StepExecutionListener, Ch itemWriteListener.onWriteError(ex, items); } catch (RuntimeException e) { - throw new StepListenerFailedException("Error in onWriteError.", ex, e); + throw new StepListenerFailedException("Error in onWriteError.", e, ex); } } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/StepListenerFailedException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/StepListenerFailedException.java index a5b2ad053..223457584 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/listener/StepListenerFailedException.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/StepListenerFailedException.java @@ -18,7 +18,7 @@ package org.springframework.batch.core.listener; /** * Exception to indicate a problem in a step listener. - * + * * @author Dave Syer * */ @@ -37,8 +37,8 @@ public class StepListenerFailedException extends RuntimeException { * @param ex the exception that was thrown by a listener * @param e the exception that caused the skip */ - public StepListenerFailedException(String message, Throwable ex, RuntimeException e) { - super(message + "\n" + e.getClass().getName() + ": " + e.getMessage(), ex); + public StepListenerFailedException(String message, RuntimeException ex, Throwable e) { + super(message + "\n" + e.getMessage() + ": " + e.getClass().getName(), ex); } } From b41b92af3333e9e82d1e724ac0694db4c940ef1c Mon Sep 17 00:00:00 2001 From: Michael Minella Date: Fri, 12 Oct 2012 15:37:26 -0500 Subject: [PATCH 2/2] BATCH-1780: Updated test to expect listner exception as "cause" --- .../MulticasterBatchListenerTests.java | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/listener/MulticasterBatchListenerTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/listener/MulticasterBatchListenerTests.java index 8bf4f7cc6..c02d9d108 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/listener/MulticasterBatchListenerTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/listener/MulticasterBatchListenerTests.java @@ -28,7 +28,7 @@ import org.springframework.batch.core.StepExecution; /** * @author Dave Syer - * + * */ public class MulticasterBatchListenerTests { @@ -276,7 +276,7 @@ public class MulticasterBatchListenerTests { catch (StepListenerFailedException e) { // expected String message = e.getCause().getMessage(); - assertEquals("Wrong message: " + message, "foo", message); + assertEquals("Wrong message: " + message, "listener error", message); } assertEquals(1, count); } @@ -369,7 +369,7 @@ public class MulticasterBatchListenerTests { catch (StepListenerFailedException e) { // expected String message = e.getCause().getMessage(); - assertEquals("Wrong message: " + message, "foo", message); + assertEquals("Wrong message: " + message, "listener error", message); } assertEquals(1, count); } @@ -508,7 +508,7 @@ public class MulticasterBatchListenerTests { /** * @author Dave Syer - * + * */ private final class CountingStepListenerSupport extends StepListenerSupport { @Override @@ -522,7 +522,7 @@ public class MulticasterBatchListenerTests { /* * (non-Javadoc) - * + * * @see * org.springframework.batch.core.listener.StepListenerSupport#afterChunk * () @@ -538,7 +538,7 @@ public class MulticasterBatchListenerTests { /* * (non-Javadoc) - * + * * @see * org.springframework.batch.core.listener.StepListenerSupport#afterRead * (java.lang.Object) @@ -554,7 +554,7 @@ public class MulticasterBatchListenerTests { /* * (non-Javadoc) - * + * * @see * org.springframework.batch.core.listener.StepListenerSupport#afterStep * (org.springframework.batch.core.StepExecution) @@ -570,7 +570,7 @@ public class MulticasterBatchListenerTests { /* * (non-Javadoc) - * + * * @see * org.springframework.batch.core.listener.StepListenerSupport#beforeChunk * () @@ -586,7 +586,7 @@ public class MulticasterBatchListenerTests { /* * (non-Javadoc) - * + * * @see * org.springframework.batch.core.listener.StepListenerSupport#beforeRead * () @@ -602,7 +602,7 @@ public class MulticasterBatchListenerTests { /* * (non-Javadoc) - * + * * @see * org.springframework.batch.core.listener.StepListenerSupport#beforeStep * (org.springframework.batch.core.StepExecution) @@ -618,7 +618,7 @@ public class MulticasterBatchListenerTests { /* * (non-Javadoc) - * + * * @see * org.springframework.batch.core.listener.StepListenerSupport#afterWrite * (java.util.List) @@ -634,7 +634,7 @@ public class MulticasterBatchListenerTests { /* * (non-Javadoc) - * + * * @see * org.springframework.batch.core.listener.StepListenerSupport#beforeWrite * (java.util.List) @@ -650,7 +650,7 @@ public class MulticasterBatchListenerTests { /* * (non-Javadoc) - * + * * @see * org.springframework.batch.core.listener.StepListenerSupport#onWriteError * (java.lang.Exception, java.util.List)