diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/JobInterruptedException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/JobInterruptedException.java index 231a137d4..dc64368bc 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/JobInterruptedException.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/JobInterruptedException.java @@ -21,7 +21,7 @@ package org.springframework.batch.core; * Exception to indicate the the job has been interrupted. The exception state * indicated is not normally recoverable by batch application clients, but * internally it is useful to force a check. The exception will often be wrapped - * in a runtime exception (usually {@link InfrastructureException} before + * in a runtime exception (usually {@link UnexpectedJobExecutionException} before * reaching the client. * * @author Lucas Ward diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/InfrastructureException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/UnexpectedJobExecutionException.java similarity index 82% rename from spring-batch-core/src/main/java/org/springframework/batch/core/InfrastructureException.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/UnexpectedJobExecutionException.java index 1c363f44b..d2667b6e5 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/InfrastructureException.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/UnexpectedJobExecutionException.java @@ -23,7 +23,7 @@ package org.springframework.batch.core; * @author Lucas Ward * */ -public class InfrastructureException extends RuntimeException { +public class UnexpectedJobExecutionException extends RuntimeException { private static final long serialVersionUID = 8838982304219248527L; /** @@ -32,7 +32,7 @@ public class InfrastructureException extends RuntimeException { * @param msg the exception message. * */ - public InfrastructureException(String msg) { + public UnexpectedJobExecutionException(String msg) { super(msg); } @@ -42,7 +42,7 @@ public class InfrastructureException extends RuntimeException { * @param msg the exception message. * */ - public InfrastructureException(String msg, Throwable nested) { + public UnexpectedJobExecutionException(String msg, Throwable nested) { super(msg, nested); } @@ -50,7 +50,7 @@ public class InfrastructureException extends RuntimeException { * Constructs a new instance with a nested exception. The error code is * defaulted to 1 and the message is empty. */ - public InfrastructureException(Throwable nested) { + public UnexpectedJobExecutionException(Throwable nested) { super(nested); } @@ -58,7 +58,7 @@ public class InfrastructureException extends RuntimeException { * Constructs a new instance, the error code is defaulted to one and the * message is empty. */ - public InfrastructureException() { + public UnexpectedJobExecutionException() { super(); } diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/JobSupport.java b/spring-batch-core/src/test/java/org/springframework/batch/core/JobSupport.java index f4e1baf2a..4c25f9d9e 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/JobSupport.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/JobSupport.java @@ -135,7 +135,7 @@ public class JobSupport implements BeanNameAware, Job { /* (non-Javadoc) * @see org.springframework.batch.core.domain.Job#run(org.springframework.batch.core.domain.JobExecution) */ - public void execute(JobExecution execution) throws InfrastructureException { + public void execute(JobExecution execution) throws UnexpectedJobExecutionException { throw new UnsupportedOperationException("JobSupport does not provide an implementation of run(). Use a smarter subclass."); } diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/StepSupport.java b/spring-batch-core/src/test/java/org/springframework/batch/core/StepSupport.java index a4e329968..08760978e 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/StepSupport.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/StepSupport.java @@ -109,7 +109,7 @@ public class StepSupport implements Step, BeanNameAware { * * @see org.springframework.batch.core.Step#execute(org.springframework.batch.core.StepExecution) */ - public void execute(StepExecution stepExecution) throws JobInterruptedException, InfrastructureException { + public void execute(StepExecution stepExecution) throws JobInterruptedException, UnexpectedJobExecutionException { throw new UnsupportedOperationException( "Cannot process a StepExecution. Use a smarter subclass of StepSupport."); } diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/job/SimpleJob.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/job/SimpleJob.java index 912915900..6c6a2cef1 100644 --- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/job/SimpleJob.java +++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/job/SimpleJob.java @@ -21,7 +21,7 @@ import java.util.Iterator; import java.util.List; import org.springframework.batch.core.BatchStatus; -import org.springframework.batch.core.InfrastructureException; +import org.springframework.batch.core.UnexpectedJobExecutionException; import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.JobExecutionException; import org.springframework.batch.core.JobInstance; @@ -175,7 +175,7 @@ public class SimpleJob extends AbstractJob { return true; } else { // start max has been exceeded, throw an exception. - throw new InfrastructureException("Maximum start limit exceeded for step: " + step.getName() + "StartMax: " + throw new UnexpectedJobExecutionException("Maximum start limit exceeded for step: " + step.getName() + "StartMax: " + step.getStartLimit()); } } @@ -187,7 +187,7 @@ public class SimpleJob extends AbstractJob { if (t instanceof RuntimeException) { throw (RuntimeException) t; } else { - throw new InfrastructureException(t); + throw new UnexpectedJobExecutionException(t); } } diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/dao/JdbcStepExecutionDao.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/dao/JdbcStepExecutionDao.java index ce4bfb77a..72462fb5f 100644 --- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/dao/JdbcStepExecutionDao.java +++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/dao/JdbcStepExecutionDao.java @@ -13,7 +13,7 @@ import org.apache.commons.lang.SerializationUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.batch.core.BatchStatus; -import org.springframework.batch.core.InfrastructureException; +import org.springframework.batch.core.UnexpectedJobExecutionException; import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.Step; import org.springframework.batch.core.StepExecution; @@ -110,7 +110,7 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao implement executionContext.put(key, rs.getObject("OBJECT_VAL")); } else { - throw new InfrastructureException("Invalid type found: [" + typeCd + "] for execution id: [" + throw new UnexpectedJobExecutionException("Invalid type found: [" + typeCd + "] for execution id: [" + executionId + "]"); } } diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/AbstractStep.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/AbstractStep.java index bd9db3476..2b612237f 100644 --- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/AbstractStep.java +++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/AbstractStep.java @@ -15,7 +15,7 @@ */ package org.springframework.batch.execution.step; -import org.springframework.batch.core.InfrastructureException; +import org.springframework.batch.core.UnexpectedJobExecutionException; import org.springframework.batch.core.JobInterruptedException; import org.springframework.batch.core.Step; import org.springframework.batch.core.StepExecution; @@ -90,5 +90,5 @@ public abstract class AbstractStep implements Step { this.name = name; } - public abstract void execute(StepExecution stepExecution) throws JobInterruptedException, InfrastructureException; + public abstract void execute(StepExecution stepExecution) throws JobInterruptedException, UnexpectedJobExecutionException; } \ No newline at end of file diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/ItemOrientedStep.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/ItemOrientedStep.java index 9296368f4..876ad7a0c 100644 --- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/ItemOrientedStep.java +++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/ItemOrientedStep.java @@ -20,7 +20,7 @@ import java.util.Date; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.batch.core.BatchStatus; -import org.springframework.batch.core.InfrastructureException; +import org.springframework.batch.core.UnexpectedJobExecutionException; import org.springframework.batch.core.JobInstance; import org.springframework.batch.core.JobInterruptedException; import org.springframework.batch.core.StepContribution; @@ -230,7 +230,7 @@ public class ItemOrientedStep extends AbstractStep { * @throws RuntimeException if there is an exception during a chunk execution * @see StepExecutor#execute(StepExecution) */ - public void execute(final StepExecution stepExecution) throws InfrastructureException, JobInterruptedException { + public void execute(final StepExecution stepExecution) throws UnexpectedJobExecutionException, JobInterruptedException { JobInstance jobInstance = stepExecution.getJobExecution().getJobInstance(); StepExecution lastStepExecution = jobRepository.getLastStepExecution(jobInstance, this); @@ -398,7 +398,7 @@ public class ItemOrientedStep extends AbstractStep { if (!fatalException.hasException()) { fatalException.setException(e); } - throw new InfrastructureException(msg, fatalException.getException()); + throw new UnexpectedJobExecutionException(msg, fatalException.getException()); } try { @@ -410,11 +410,11 @@ public class ItemOrientedStep extends AbstractStep { if (!fatalException.hasException()) { fatalException.setException(e); } - throw new InfrastructureException(msg, fatalException.getException()); + throw new UnexpectedJobExecutionException(msg, fatalException.getException()); } if (fatalException.hasException()) { - throw new InfrastructureException("Encountered an error saving batch meta data.", fatalException + throw new UnexpectedJobExecutionException("Encountered an error saving batch meta data.", fatalException .getException()); } diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/TaskletStep.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/TaskletStep.java index 842e92b9f..ccd8ed7e1 100644 --- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/TaskletStep.java +++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/TaskletStep.java @@ -20,7 +20,7 @@ import java.util.Date; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.batch.core.BatchStatus; -import org.springframework.batch.core.InfrastructureException; +import org.springframework.batch.core.UnexpectedJobExecutionException; import org.springframework.batch.core.JobInterruptedException; import org.springframework.batch.core.Step; import org.springframework.batch.core.StepExecution; @@ -127,7 +127,7 @@ public class TaskletStep extends AbstractStep implements Step, InitializingBean, this.jobRepository = jobRepository; } - public void execute(StepExecution stepExecution) throws JobInterruptedException, InfrastructureException { + public void execute(StepExecution stepExecution) throws JobInterruptedException, UnexpectedJobExecutionException { stepExecution.setStartTime(new Date()); updateStatus(stepExecution, BatchStatus.STARTED); @@ -166,7 +166,7 @@ public class TaskletStep extends AbstractStep implements Step, InitializingBean, if (e instanceof RuntimeException) { throw (RuntimeException) e; } - throw new InfrastructureException(e); + throw new UnexpectedJobExecutionException(e); } finally { stepExecution.setExitStatus(exitStatus); @@ -180,7 +180,7 @@ public class TaskletStep extends AbstractStep implements Step, InitializingBean, if (fatalException != null) { logger.error("Encountered an error saving batch meta data." + "This job is now in an unknown state and should not be restarted.", fatalException); - throw new InfrastructureException("Encountered an error saving batch meta data.", fatalException); + throw new UnexpectedJobExecutionException("Encountered an error saving batch meta data.", fatalException); } } diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/support/SkipLimitExceededException.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/support/SkipLimitExceededException.java index b10b6609b..786cec394 100644 --- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/support/SkipLimitExceededException.java +++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/support/SkipLimitExceededException.java @@ -15,7 +15,7 @@ */ package org.springframework.batch.execution.step.support; -import org.springframework.batch.core.InfrastructureException; +import org.springframework.batch.core.UnexpectedJobExecutionException; /** * Exception indicating that the skip limit for a particular {@Step} has @@ -24,7 +24,7 @@ import org.springframework.batch.core.InfrastructureException; * @author Ben Hale * @author Lucas Ward */ -public class SkipLimitExceededException extends InfrastructureException { +public class SkipLimitExceededException extends UnexpectedJobExecutionException { private final int skipLimit; diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/job/JobSupport.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/job/JobSupport.java index f48b890dc..1a6e9bd97 100644 --- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/job/JobSupport.java +++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/job/JobSupport.java @@ -19,7 +19,7 @@ package org.springframework.batch.execution.job; import java.util.ArrayList; import java.util.List; -import org.springframework.batch.core.InfrastructureException; +import org.springframework.batch.core.UnexpectedJobExecutionException; import org.springframework.batch.core.Job; import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.Step; @@ -136,7 +136,7 @@ public class JobSupport implements BeanNameAware, Job { /* (non-Javadoc) * @see org.springframework.batch.core.domain.Job#run(org.springframework.batch.core.domain.JobExecution) */ - public void execute(JobExecution execution) throws InfrastructureException { + public void execute(JobExecution execution) throws UnexpectedJobExecutionException { throw new UnsupportedOperationException("JobSupport does not provide an implementation of run(). Use a smarter subclass."); } diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/job/SimpleJobTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/job/SimpleJobTests.java index 3754f47ae..9552a2a72 100644 --- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/job/SimpleJobTests.java +++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/job/SimpleJobTests.java @@ -22,7 +22,7 @@ import java.util.List; import junit.framework.TestCase; import org.springframework.batch.core.BatchStatus; -import org.springframework.batch.core.InfrastructureException; +import org.springframework.batch.core.UnexpectedJobExecutionException; import org.springframework.batch.core.ItemSkipPolicy; import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.JobExecutionException; @@ -230,7 +230,7 @@ public class SimpleJobTests extends TestCase { stepConfiguration1.setProcessException(exception); try { job.execute(jobExecution); - } catch (InfrastructureException e) { + } catch (UnexpectedJobExecutionException e) { assertEquals(exception, e.getCause()); } assertEquals(0, list.size()); @@ -258,7 +258,7 @@ public class SimpleJobTests extends TestCase { try { job.execute(jobExecution); fail("Expected BatchCriticalException"); - } catch (InfrastructureException ex) { + } catch (UnexpectedJobExecutionException ex) { // expected assertTrue("Wrong message in exception: " + ex.getMessage(), ex.getMessage() .indexOf("start limit exceeded") >= 0); @@ -289,7 +289,7 @@ public class SimpleJobTests extends TestCase { jobExecution.stop(); try { job.execute(jobExecution); - } catch (InfrastructureException e) { + } catch (UnexpectedJobExecutionException e) { assertTrue(e.getCause() instanceof JobInterruptedException); } assertEquals(0, list.size()); @@ -349,7 +349,7 @@ public class SimpleJobTests extends TestCase { this.runnable = runnable; } - public void execute(StepExecution stepExecution) throws JobInterruptedException, InfrastructureException { + public void execute(StepExecution stepExecution) throws JobInterruptedException, UnexpectedJobExecutionException { if (exception instanceof RuntimeException) { stepExecution.setExitStatus(ExitStatus.FAILED); throw (RuntimeException) exception; diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/ItemOrientedStepTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/ItemOrientedStepTests.java index be45f14c7..b2cfbf444 100644 --- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/ItemOrientedStepTests.java +++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/ItemOrientedStepTests.java @@ -23,7 +23,7 @@ import java.util.List; import junit.framework.TestCase; import org.springframework.batch.core.BatchStatus; -import org.springframework.batch.core.InfrastructureException; +import org.springframework.batch.core.UnexpectedJobExecutionException; import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.JobInstance; import org.springframework.batch.core.JobInterruptedException; @@ -252,7 +252,7 @@ public class ItemOrientedStepTests extends TestCase { itemOrientedStep.execute(stepExecution); fail("Expected BatchCriticalException"); } - catch (InfrastructureException e) { + catch (UnexpectedJobExecutionException e) { assertEquals("foo", e.getCause().getMessage()); } assertEquals(BatchStatus.UNKNOWN, stepExecution.getStatus()); @@ -561,7 +561,7 @@ public class ItemOrientedStepTests extends TestCase { itemOrientedStep.execute(stepExecution); fail("Expected BatchCriticalException"); } - catch (InfrastructureException ex) { + catch (UnexpectedJobExecutionException ex) { assertEquals(BatchStatus.UNKNOWN, stepExecution.getStatus()); String msg = stepExecution.getExitStatus().getExitDescription(); assertTrue("Message does not contain ResetFailedException: " + msg, msg.contains("ResetFailedException")); @@ -589,7 +589,7 @@ public class ItemOrientedStepTests extends TestCase { itemOrientedStep.execute(stepExecution); fail("Expected BatchCriticalException"); } - catch (InfrastructureException ex) { + catch (UnexpectedJobExecutionException ex) { assertEquals(BatchStatus.UNKNOWN, stepExecution.getStatus()); String msg = stepExecution.getExitStatus().getExitDescription(); assertEquals("", msg); @@ -652,7 +652,7 @@ public class ItemOrientedStepTests extends TestCase { itemOrientedStep.execute(stepExecution); fail("Expected InfrastructureException"); } - catch (InfrastructureException ex) { + catch (UnexpectedJobExecutionException ex) { // The job actually completeed, but the streams couldn't be closed. assertEquals(BatchStatus.COMPLETED, stepExecution.getStatus()); String msg = stepExecution.getExitStatus().getExitDescription(); diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/StepSupport.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/StepSupport.java index c6046dd69..9db907b9f 100644 --- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/StepSupport.java +++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/StepSupport.java @@ -15,7 +15,7 @@ */ package org.springframework.batch.execution.step; -import org.springframework.batch.core.InfrastructureException; +import org.springframework.batch.core.UnexpectedJobExecutionException; import org.springframework.batch.core.JobInterruptedException; import org.springframework.batch.core.Step; import org.springframework.batch.core.StepExecution; @@ -110,7 +110,7 @@ public class StepSupport implements Step, BeanNameAware { * * @see org.springframework.batch.core.Step#execute(org.springframework.batch.core.StepExecution) */ - public void execute(StepExecution stepExecution) throws JobInterruptedException, InfrastructureException { + public void execute(StepExecution stepExecution) throws JobInterruptedException, UnexpectedJobExecutionException { throw new UnsupportedOperationException( "Cannot process a StepExecution. Use a smarter subclass of StepSupport."); } diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/TaskletStepTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/TaskletStepTests.java index 8bbc18bd6..6d43453e6 100644 --- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/TaskletStepTests.java +++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/TaskletStepTests.java @@ -6,7 +6,7 @@ import java.util.List; import junit.framework.TestCase; import org.springframework.batch.core.BatchStatus; -import org.springframework.batch.core.InfrastructureException; +import org.springframework.batch.core.UnexpectedJobExecutionException; import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.JobInstance; import org.springframework.batch.core.JobInterruptedException; @@ -91,7 +91,7 @@ public class TaskletStepTests extends TestCase { step.execute(stepExecution); fail("Expected BatchCriticalException"); } - catch (InfrastructureException e) { + catch (UnexpectedJobExecutionException e) { assertEquals("foo", e.getCause().getMessage()); } assertEquals(BatchStatus.UNKNOWN, stepExecution.getStatus()); @@ -121,7 +121,7 @@ public class TaskletStepTests extends TestCase { assertEquals(2, list.size()); } - public void testExceptionExecution() throws JobInterruptedException, InfrastructureException { + public void testExceptionExecution() throws JobInterruptedException, UnexpectedJobExecutionException { TaskletStep step = new TaskletStep(new StubTasklet(false, true), new JobRepositorySupport()); try { step.execute(stepExecution); diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/item/writer/OrderWriter.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/item/writer/OrderWriter.java index e8f1fc6e7..eda5e1aeb 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/item/writer/OrderWriter.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/item/writer/OrderWriter.java @@ -16,7 +16,7 @@ package org.springframework.batch.sample.item.writer; -import org.springframework.batch.core.InfrastructureException; +import org.springframework.batch.core.UnexpectedJobExecutionException; import org.springframework.batch.item.writer.DelegatingItemWriter; import org.springframework.batch.sample.domain.Order; @@ -25,7 +25,7 @@ import org.springframework.batch.sample.domain.Order; public class OrderWriter extends DelegatingItemWriter { public Object doProcess(Object data) { if (!(data instanceof Order)) { - throw new InfrastructureException("OrderProcessor can process only Order objects"); + throw new UnexpectedJobExecutionException("OrderProcessor can process only Order objects"); } return data; } diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/tasklet/ExceptionThrowingItemReaderProxy.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/tasklet/ExceptionThrowingItemReaderProxy.java index 08b1fc526..73984904e 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/tasklet/ExceptionThrowingItemReaderProxy.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/tasklet/ExceptionThrowingItemReaderProxy.java @@ -17,7 +17,7 @@ package org.springframework.batch.sample.tasklet; -import org.springframework.batch.core.InfrastructureException; +import org.springframework.batch.core.UnexpectedJobExecutionException; import org.springframework.batch.item.ItemReader; import org.springframework.batch.item.reader.DelegatingItemReader; @@ -49,7 +49,7 @@ public class ExceptionThrowingItemReaderProxy extends DelegatingItemReader { counter++; if (counter == throwExceptionOnRecordNumber) { - throw new InfrastructureException("Planned failure on count="+counter); + throw new UnexpectedJobExecutionException("Planned failure on count="+counter); } return super.read(); diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/RestartFunctionalTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/RestartFunctionalTests.java index 376c21c48..728f48c57 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/RestartFunctionalTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/RestartFunctionalTests.java @@ -16,7 +16,7 @@ package org.springframework.batch.sample; -import org.springframework.batch.core.InfrastructureException; +import org.springframework.batch.core.UnexpectedJobExecutionException; import org.springframework.batch.core.JobParameters; import org.springframework.jdbc.core.JdbcOperations; @@ -63,7 +63,7 @@ public class RestartFunctionalTests extends AbstractBatchLauncherTests { runJob(); fail("First run of the job is expected to fail."); } - catch (InfrastructureException expected) { + catch (UnexpectedJobExecutionException expected) { //expected assertTrue("Not planned exception: "+expected.getMessage(), expected.getMessage().toLowerCase().indexOf("planned")>=0); } diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/item/writer/OrderWriterTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/item/writer/OrderWriterTests.java index 3d7b3ad12..4617175b5 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/item/writer/OrderWriterTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/item/writer/OrderWriterTests.java @@ -3,7 +3,7 @@ package org.springframework.batch.sample.item.writer; import junit.framework.TestCase; import org.easymock.MockControl; -import org.springframework.batch.core.InfrastructureException; +import org.springframework.batch.core.UnexpectedJobExecutionException; import org.springframework.batch.item.ItemWriter; import org.springframework.batch.sample.domain.Order; import org.springframework.batch.sample.item.writer.OrderWriter; @@ -46,7 +46,7 @@ public class OrderWriterTests extends TestCase { try { processor.write(this); fail("Batch critical exception was expected"); - } catch (InfrastructureException bce) { + } catch (UnexpectedJobExecutionException bce) { assertTrue(true); } writerControl.verify(); diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/tasklet/ExceptionThrowingItemReaderProxyTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/tasklet/ExceptionThrowingItemReaderProxyTests.java index 1459361e9..37de2165b 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/tasklet/ExceptionThrowingItemReaderProxyTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/tasklet/ExceptionThrowingItemReaderProxyTests.java @@ -4,7 +4,7 @@ import java.util.ArrayList; import junit.framework.TestCase; -import org.springframework.batch.core.InfrastructureException; +import org.springframework.batch.core.UnexpectedJobExecutionException; import org.springframework.batch.item.reader.ListItemReader; import org.springframework.batch.repeat.context.RepeatContextSupport; import org.springframework.batch.repeat.synch.RepeatSynchronizationManager; @@ -40,7 +40,7 @@ public class ExceptionThrowingItemReaderProxyTests extends TestCase { try { itemReader.read(); assertTrue(i < ITER_COUNT); - } catch (InfrastructureException bce) { + } catch (UnexpectedJobExecutionException bce) { assertEquals(ITER_COUNT,i); } } diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/tasklet/JobSupport.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/tasklet/JobSupport.java index 854b8aeee..0fa0960ba 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/tasklet/JobSupport.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/tasklet/JobSupport.java @@ -19,7 +19,7 @@ package org.springframework.batch.sample.tasklet; import java.util.ArrayList; import java.util.List; -import org.springframework.batch.core.InfrastructureException; +import org.springframework.batch.core.UnexpectedJobExecutionException; import org.springframework.batch.core.Job; import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.Step; @@ -136,7 +136,7 @@ public class JobSupport implements BeanNameAware, Job { /* (non-Javadoc) * @see org.springframework.batch.core.domain.Job#run(org.springframework.batch.core.domain.JobExecution) */ - public void execute(JobExecution execution) throws InfrastructureException { + public void execute(JobExecution execution) throws UnexpectedJobExecutionException { throw new UnsupportedOperationException("JobSupport does not provide an implementation of run(). Use a smarter subclass."); } diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/tasklet/StepSupport.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/tasklet/StepSupport.java index dbc33e534..a7b403efc 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/tasklet/StepSupport.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/tasklet/StepSupport.java @@ -15,7 +15,7 @@ */ package org.springframework.batch.sample.tasklet; -import org.springframework.batch.core.InfrastructureException; +import org.springframework.batch.core.UnexpectedJobExecutionException; import org.springframework.batch.core.JobInterruptedException; import org.springframework.batch.core.Step; import org.springframework.batch.core.StepExecution; @@ -110,7 +110,7 @@ public class StepSupport implements Step, BeanNameAware { * * @see org.springframework.batch.core.Step#execute(org.springframework.batch.core.StepExecution) */ - public void execute(StepExecution stepExecution) throws JobInterruptedException, InfrastructureException { + public void execute(StepExecution stepExecution) throws JobInterruptedException, UnexpectedJobExecutionException { throw new UnsupportedOperationException( "Cannot process a StepExecution. Use a smarter subclass of StepSupport."); }