Tidy up some exception class names

This commit is contained in:
dsyer
2008-03-01 11:59:33 +00:00
parent 90cb1e8ea3
commit b47a6e6405
51 changed files with 167 additions and 259 deletions

View File

@@ -25,6 +25,7 @@ import org.springframework.batch.core.domain.Job;
import org.springframework.batch.core.domain.JobExecution;
import org.springframework.batch.core.domain.JobParameters;
import org.springframework.batch.core.domain.StepExecution;
import org.springframework.batch.core.repository.JobRestartException;
import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException;
import org.springframework.batch.core.repository.NoSuchJobException;
import org.springframework.batch.core.runtime.JobParametersFactory;
@@ -161,6 +162,9 @@ public class SimpleExportedJobLauncher implements ExportedJobLauncher, Initializ
catch (JobExecutionAlreadyRunningException e) {
return e.getClass().getName() + ": " + e.getMessage();
}
catch (JobRestartException e) {
return e.getClass().getName() + ": " + e.getMessage();
}
registry.put(name + params, execution);

View File

@@ -32,7 +32,7 @@ import org.springframework.batch.core.repository.JobRepository;
import org.springframework.batch.core.runtime.ExitStatusExceptionClassifier;
import org.springframework.batch.execution.listener.CompositeJobListener;
import org.springframework.batch.execution.step.support.SimpleExitStatusExceptionClassifier;
import org.springframework.batch.io.exception.BatchCriticalException;
import org.springframework.batch.io.exception.InfrastructureException;
import org.springframework.batch.repeat.ExitStatus;
/**
@@ -63,7 +63,7 @@ public class SimpleJob extends AbstractJob {
*
* @see org.springframework.batch.core.domain.Job#execute(org.springframework.batch.core.domain.JobExecution)
*/
public void execute(JobExecution execution) throws BatchCriticalException {
public void execute(JobExecution execution) throws InfrastructureException {
JobInstance jobInstance = execution.getJobInstance();
jobInstance.setLastExecution(execution);
@@ -158,7 +158,7 @@ public class SimpleJob extends AbstractJob {
}
if (stepStatus == BatchStatus.UNKNOWN) {
throw new BatchCriticalException("Cannot restart step from UNKNOWN status. "
throw new InfrastructureException("Cannot restart step from UNKNOWN status. "
+ "The last execution ended with a failure that could not be rolled back, "
+ "so it may be dangerous to proceed. " + "Manual intervention is probably necessary.");
}
@@ -175,7 +175,7 @@ public class SimpleJob extends AbstractJob {
}
else {
// start max has been exceeded, throw an exception.
throw new BatchCriticalException("Maximum start limit exceeded for step: " + step.getName() + "StartMax: "
throw new InfrastructureException("Maximum start limit exceeded for step: " + step.getName() + "StartMax: "
+ step.getStartLimit());
}
}
@@ -188,7 +188,7 @@ public class SimpleJob extends AbstractJob {
throw (RuntimeException) t;
}
else {
throw new BatchCriticalException(t);
throw new InfrastructureException(t);
}
}

View File

@@ -18,15 +18,16 @@ package org.springframework.batch.execution.launch;
import org.springframework.batch.core.domain.Job;
import org.springframework.batch.core.domain.JobExecution;
import org.springframework.batch.core.domain.JobParameters;
import org.springframework.batch.core.repository.JobRestartException;
import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException;
/**
* Simple interface for controlling jobs, including possible ad-hoc executions,
* based on different runtime identifiers. It is extremely important to note
* that this interface makes absolutely no guarantees about whether or not
* calls to it are executed synchronously or asynchronously. The javadocs
* for specific implementations should be checked to ensure callers fully
* understand how the job will be run.
* based on different runtime identifiers. It is extremely important to note
* that this interface makes absolutely no guarantees about whether or not calls
* to it are executed synchronously or asynchronously. The javadocs for specific
* implementations should be checked to ensure callers fully understand how the
* job will be run.
*
* @author Lucas Ward
* @author Dave Syer
@@ -38,13 +39,16 @@ public interface JobLauncher {
* Start a job execution for the given {@link Job} and {@link JobParameters}.
*
* @return the exit code from the job if it returns synchronously. If the
* implementation is asynchronous, the status might well be unknown.
* implementation is asynchronous, the status might well be unknown.
*
* @throws JobExecutionAlreadyRunningException if the JobInstance identified
* by the properties already has an execution running. Throws
* IllegalArgumentException if the job or jobInstanceProperties are null.
* by the properties already has an execution running.
* @throws IllegalArgumentException if the job or jobInstanceProperties are
* null.
* @throws JobRestartException if the job has been run before and
* circumstances that preclude a re-start.
*/
public JobExecution run(Job job, JobParameters jobParameters)
throws JobExecutionAlreadyRunningException;
public JobExecution run(Job job, JobParameters jobParameters) throws JobExecutionAlreadyRunningException,
JobRestartException;
}

View File

@@ -21,6 +21,7 @@ import org.springframework.batch.core.domain.Job;
import org.springframework.batch.core.domain.JobExecution;
import org.springframework.batch.core.domain.JobInstance;
import org.springframework.batch.core.domain.JobParameters;
import org.springframework.batch.core.repository.JobRestartException;
import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException;
import org.springframework.batch.core.repository.JobRepository;
import org.springframework.beans.factory.InitializingBean;
@@ -30,8 +31,8 @@ import org.springframework.util.Assert;
/**
* Simple implementation of the {@link JobLauncher} interface. The Spring Core
* {@link TaskExecutor} interface is used to launch a {@link Job}. This
* means that the type of executor set is very important. If a
* {@link TaskExecutor} interface is used to launch a {@link Job}. This means
* that the type of executor set is very important. If a
* {@link SyncTaskExecutor} is used, then the job will be processed
* <strong>within the same thread that called the launcher.</strong> Care
* should be taken to ensure any users of this class understand fully whether or
@@ -40,9 +41,9 @@ import org.springframework.util.Assert;
*
* There is only one required dependency of this Launcher, a
* {@link JobRepository}. The JobRepository is used to obtain a valid
* JobExecution. The Repository must be used because the provided
* {@link Job} could be a restart of an existing {@link JobInstance},
* and only the Repository can reliably recreate it.
* JobExecution. The Repository must be used because the provided {@link Job}
* could be a restart of an existing {@link JobInstance}, and only the
* Repository can reliably recreate it.
*
* @author Lucas Ward
* @since 1.0
@@ -67,9 +68,11 @@ public class SimpleJobLauncher implements JobLauncher, InitializingBean {
* execution.
* @return JobExecutionAlreadyRunningException if the JobInstance already
* exists and has an execution already running.
* @throws JobRestartException if the execution would be a re-start, but a
* re-start is either not allowed or not needed.
*/
public JobExecution run(final Job job, final JobParameters jobParameters)
throws JobExecutionAlreadyRunningException {
throws JobExecutionAlreadyRunningException, JobRestartException {
Assert.notNull(job, "The Job must not be null.");
Assert.notNull(jobParameters, "The JobParameters must not be null.");

View File

@@ -26,7 +26,7 @@ import org.springframework.batch.core.domain.JobInstance;
import org.springframework.batch.core.domain.JobParameters;
import org.springframework.batch.core.domain.Step;
import org.springframework.batch.core.domain.StepExecution;
import org.springframework.batch.core.repository.BatchRestartException;
import org.springframework.batch.core.repository.JobRestartException;
import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException;
import org.springframework.batch.core.repository.JobRepository;
import org.springframework.batch.execution.repository.dao.JobExecutionDao;
@@ -132,15 +132,9 @@ public class SimpleJobRepository implements JobRepository {
*
* @see JobRepository#createJobExecution(Job, JobParameters)
*
* @throws BatchRestartException if more than one JobInstance if found or if
* JobInstance.getJobExecutionCount() is greater than Job.getStartLimit()
* @throws JobExecutionAlreadyRunningException if a job execution is found
* for the given {@link JobIdentifier} that is already running
* @throws CannotRestartJobInstanceException
*
*/
public JobExecution createJobExecution(Job job, JobParameters jobParameters)
throws JobExecutionAlreadyRunningException {
throws JobExecutionAlreadyRunningException, JobRestartException {
Assert.notNull(job, "Job must not be null.");
Assert.notNull(jobParameters, "JobParameters must not be null.");
@@ -161,12 +155,12 @@ public class SimpleJobRepository implements JobRepository {
// existing job instance found
if (jobInstance != null) {
if (!job.isRestartable()) {
throw new BatchRestartException("JobInstance already exists and is not restartable");
throw new JobRestartException("JobInstance already exists and is not restartable");
}
jobInstance.setJobExecutionCount(jobExecutionDao.getJobExecutionCount(jobInstance));
if (jobInstance.getJobExecutionCount() > job.getStartLimit()) {
throw new BatchRestartException("Restart Max exceeded for Job: " + jobInstance.toString());
throw new JobRestartException("Restart Max exceeded for Job: " + jobInstance.toString());
}
List executions = jobExecutionDao.findJobExecutions(jobInstance);
JobExecution lastExecution = null;

View File

@@ -10,7 +10,6 @@ import org.apache.commons.logging.LogFactory;
import org.springframework.batch.core.domain.BatchStatus;
import org.springframework.batch.core.domain.JobExecution;
import org.springframework.batch.core.domain.JobInstance;
import org.springframework.batch.core.repository.NoSuchBatchDomainObjectException;
import org.springframework.batch.repeat.ExitStatus;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.jdbc.core.RowMapper;
@@ -147,7 +146,7 @@ public class JdbcJobExecutionDao extends AbstractJdbcBatchMetadataDao implements
// is invalid and
// an exception should be thrown.
if (getJdbcTemplate().queryForInt(getQuery(CHECK_JOB_EXECUTION_EXISTS), new Object[] { jobExecution.getId() }) != 1) {
throw new NoSuchBatchDomainObjectException("Invalid JobExecution, ID " + jobExecution.getId()
throw new NoSuchObjectException("Invalid JobExecution, ID " + jobExecution.getId()
+ " not found.");
}

View File

@@ -16,7 +16,7 @@ import org.springframework.batch.core.domain.BatchStatus;
import org.springframework.batch.core.domain.JobExecution;
import org.springframework.batch.core.domain.Step;
import org.springframework.batch.core.domain.StepExecution;
import org.springframework.batch.io.exception.BatchCriticalException;
import org.springframework.batch.io.exception.InfrastructureException;
import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.repeat.ExitStatus;
import org.springframework.beans.factory.InitializingBean;
@@ -108,7 +108,7 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao implement
executionContext.put(key, rs.getObject("OBJECT_VAL"));
}
else {
throw new BatchCriticalException("Invalid type found: [" + typeCd + "] for execution id: ["
throw new InfrastructureException("Invalid type found: [" + typeCd + "] for execution id: ["
+ executionId + "]");
}
}

View File

@@ -0,0 +1,34 @@
/*
* Copyright 2006-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.execution.repository.dao;
/**
* This exception identifies that a batch domain object is invalid, which
* is generally caused by an invalid ID. (An ID which doesn't exist in the database).
*
* @author Lucas Ward
* @author Dave Syer
*
*/
public class NoSuchObjectException extends RuntimeException {
private static final long serialVersionUID = 4399621765157283111L;
public NoSuchObjectException(String message){
super(message);
}
}

View File

@@ -21,7 +21,7 @@ import org.springframework.batch.core.domain.Step;
import org.springframework.batch.core.domain.StepExecution;
import org.springframework.batch.core.repository.JobRepository;
import org.springframework.batch.execution.step.support.NeverSkipItemSkipPolicy;
import org.springframework.batch.io.exception.BatchCriticalException;
import org.springframework.batch.io.exception.InfrastructureException;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemWriter;
import org.springframework.batch.repeat.exception.handler.ExceptionHandler;
@@ -195,5 +195,5 @@ public abstract class AbstractStep implements Step, InitializingBean, BeanNameAw
}
public abstract void execute(StepExecution stepExecution) throws JobInterruptedException, BatchCriticalException;
public abstract void execute(StepExecution stepExecution) throws JobInterruptedException, InfrastructureException;
}

View File

@@ -33,7 +33,7 @@ import org.springframework.batch.execution.step.support.SimpleExitStatusExceptio
import org.springframework.batch.execution.step.support.StepInterruptionPolicy;
import org.springframework.batch.execution.step.support.ThreadStepInterruptionPolicy;
import org.springframework.batch.io.Skippable;
import org.springframework.batch.io.exception.BatchCriticalException;
import org.springframework.batch.io.exception.InfrastructureException;
import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemRecoverer;
@@ -227,7 +227,7 @@ public class ItemOrientedStep extends AbstractStep implements InitializingBean {
* execution
* @see StepExecutor#execute(StepExecution)
*/
public void execute(final StepExecution stepExecution) throws BatchCriticalException, JobInterruptedException {
public void execute(final StepExecution stepExecution) throws InfrastructureException, JobInterruptedException {
JobInstance jobInstance = stepExecution.getJobExecution().getJobInstance();
StepExecution lastStepExecution = jobRepository.getLastStepExecution(jobInstance, this);
@@ -418,7 +418,7 @@ public class ItemOrientedStep extends AbstractStep implements InitializingBean {
if (!fatalException.hasException()) {
fatalException.setException(e);
}
throw new BatchCriticalException(msg, fatalException.getException());
throw new InfrastructureException(msg, fatalException.getException());
}
try {
@@ -431,11 +431,11 @@ public class ItemOrientedStep extends AbstractStep implements InitializingBean {
if (!fatalException.hasException()) {
fatalException.setException(e);
}
throw new BatchCriticalException(msg, fatalException.getException());
throw new InfrastructureException(msg, fatalException.getException());
}
if (fatalException.hasException()) {
throw new BatchCriticalException("Encountered an error saving batch meta data.", fatalException
throw new InfrastructureException("Encountered an error saving batch meta data.", fatalException
.getException());
}

View File

@@ -27,7 +27,7 @@ import org.springframework.batch.core.domain.StepListener;
import org.springframework.batch.core.repository.JobRepository;
import org.springframework.batch.core.tasklet.Tasklet;
import org.springframework.batch.execution.listener.CompositeStepListener;
import org.springframework.batch.io.exception.BatchCriticalException;
import org.springframework.batch.io.exception.InfrastructureException;
import org.springframework.batch.repeat.ExitStatus;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.factory.InitializingBean;
@@ -191,7 +191,7 @@ public class TaskletStep implements Step, InitializingBean, BeanNameAware {
this.jobRepository = jobRepository;
}
public void execute(StepExecution stepExecution) throws JobInterruptedException, BatchCriticalException {
public void execute(StepExecution stepExecution) throws JobInterruptedException, InfrastructureException {
stepExecution.setStartTime(new Date());
updateStatus(stepExecution, BatchStatus.STARTED);
@@ -230,7 +230,7 @@ public class TaskletStep implements Step, InitializingBean, BeanNameAware {
if (e instanceof RuntimeException) {
throw (RuntimeException) e;
}
throw new BatchCriticalException(e);
throw new InfrastructureException(e);
}
finally {
stepExecution.setExitStatus(exitStatus);
@@ -244,7 +244,7 @@ public class TaskletStep implements Step, InitializingBean, BeanNameAware {
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 BatchCriticalException("Encountered an error saving batch meta data.", fatalException);
throw new InfrastructureException("Encountered an error saving batch meta data.", fatalException);
}
}

View File

@@ -15,7 +15,7 @@
*/
package org.springframework.batch.execution.step.support;
import org.springframework.batch.io.exception.BatchCriticalException;
import org.springframework.batch.io.exception.InfrastructureException;
/**
* Exception indicating that the skip limit for a particular {@Step} has
@@ -24,7 +24,7 @@ import org.springframework.batch.io.exception.BatchCriticalException;
* @author Ben Hale
* @author Lucas Ward
*/
public class SkipLimitExceededException extends BatchCriticalException {
public class SkipLimitExceededException extends InfrastructureException {
private final int skipLimit;

View File

@@ -22,7 +22,7 @@ import java.util.List;
import org.springframework.batch.core.domain.Job;
import org.springframework.batch.core.domain.JobExecution;
import org.springframework.batch.core.domain.Step;
import org.springframework.batch.io.exception.BatchCriticalException;
import org.springframework.batch.io.exception.InfrastructureException;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.util.ClassUtils;
@@ -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 BatchCriticalException {
public void execute(JobExecution execution) throws InfrastructureException {
throw new UnsupportedOperationException("JobSupport does not provide an implementation of run(). Use a smarter subclass.");
}

View File

@@ -39,7 +39,7 @@ import org.springframework.batch.execution.repository.dao.MapJobInstanceDao;
import org.springframework.batch.execution.repository.dao.MapStepExecutionDao;
import org.springframework.batch.execution.repository.dao.StepExecutionDao;
import org.springframework.batch.execution.step.AbstractStep;
import org.springframework.batch.io.exception.BatchCriticalException;
import org.springframework.batch.io.exception.InfrastructureException;
import org.springframework.batch.item.reader.AbstractItemReader;
import org.springframework.batch.repeat.ExitStatus;
@@ -193,7 +193,7 @@ public class SimpleJobTests extends TestCase {
try {
job.execute(jobExecution);
}
catch (BatchCriticalException e) {
catch (InfrastructureException e) {
assertEquals(exception, e.getCause());
}
assertEquals(0, list.size());
@@ -223,7 +223,7 @@ public class SimpleJobTests extends TestCase {
job.execute(jobExecution);
fail("Expected BatchCriticalException");
}
catch (BatchCriticalException ex) {
catch (InfrastructureException ex) {
// expected
assertTrue("Wrong message in exception: " + ex.getMessage(), ex.getMessage()
.indexOf("start limit exceeded") >= 0);
@@ -255,7 +255,7 @@ public class SimpleJobTests extends TestCase {
try {
job.execute(jobExecution);
}
catch (BatchCriticalException e) {
catch (InfrastructureException e) {
assertTrue(e.getCause() instanceof JobInterruptedException);
}
assertEquals(0, list.size());
@@ -310,7 +310,7 @@ public class SimpleJobTests extends TestCase {
this.runnable = runnable;
}
public void execute(StepExecution stepExecution) throws JobInterruptedException, BatchCriticalException {
public void execute(StepExecution stepExecution) throws JobInterruptedException, InfrastructureException {
if (exception instanceof RuntimeException) {
throw (RuntimeException)exception;
}

View File

@@ -6,7 +6,7 @@ import java.util.Map;
import org.springframework.batch.core.domain.JobExecution;
import org.springframework.batch.core.domain.JobParameters;
import org.springframework.batch.core.repository.BatchRestartException;
import org.springframework.batch.core.repository.JobRestartException;
import org.springframework.batch.execution.job.JobSupport;
import org.springframework.test.AbstractTransactionalDataSourceSpringContextTests;
import org.springframework.util.ClassUtils;
@@ -108,7 +108,7 @@ public class SimpleJobRepositoryIntegrationTests extends AbstractTransactionalDa
jobRepository.createJobExecution(job, jobParameters);
fail();
}
catch (BatchRestartException e) {
catch (JobRestartException e) {
// expected
}
}

View File

@@ -28,7 +28,7 @@ import org.springframework.batch.core.domain.JobParameters;
import org.springframework.batch.core.domain.JobParametersBuilder;
import org.springframework.batch.core.domain.Step;
import org.springframework.batch.core.domain.StepExecution;
import org.springframework.batch.core.repository.BatchRestartException;
import org.springframework.batch.core.repository.JobRestartException;
import org.springframework.batch.execution.job.JobSupport;
import org.springframework.batch.execution.repository.dao.JobExecutionDao;
import org.springframework.batch.execution.repository.dao.JobInstanceDao;
@@ -243,7 +243,7 @@ public class SimpleJobRepositoryTests extends TestCase {
jobRepository.createJobExecution(jobConfiguration, jobParameters);
fail();
}
catch (BatchRestartException ex) {
catch (JobRestartException ex) {
// expected
}

View File

@@ -26,7 +26,6 @@ import org.springframework.batch.core.domain.JobExecution;
import org.springframework.batch.core.domain.JobInstance;
import org.springframework.batch.core.domain.JobParameters;
import org.springframework.batch.core.domain.JobParametersBuilder;
import org.springframework.batch.core.repository.NoSuchBatchDomainObjectException;
import org.springframework.batch.execution.job.JobSupport;
import org.springframework.batch.repeat.ExitStatus;
import org.springframework.test.AbstractTransactionalDataSourceSpringContextTests;
@@ -174,7 +173,7 @@ public abstract class AbstractJobDaoTests extends AbstractTransactionalDataSourc
jobExecutionDao.updateJobExecution(execution);
fail("Expected NoSuchBatchDomainObjectException");
}
catch (NoSuchBatchDomainObjectException ex) {
catch (NoSuchObjectException ex) {
// expected
}
}

View File

@@ -0,0 +1,32 @@
/*
* Copyright 2006-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.execution.repository.dao;
import org.springframework.batch.execution.repository.dao.NoSuchObjectException;
import junit.framework.TestCase;
/**
* @author Dave Syer
*
*/
public class NoSuchBatchDomainObjectExceptionTests extends TestCase {
public void testCreateException() throws Exception {
NoSuchObjectException e = new NoSuchObjectException("Foo");
assertEquals("Foo", e.getMessage());
}
}

View File

@@ -39,7 +39,7 @@ import org.springframework.batch.execution.repository.dao.MapJobInstanceDao;
import org.springframework.batch.execution.repository.dao.MapStepExecutionDao;
import org.springframework.batch.execution.step.support.JobRepositorySupport;
import org.springframework.batch.execution.step.support.StepInterruptionPolicy;
import org.springframework.batch.io.exception.BatchCriticalException;
import org.springframework.batch.io.exception.InfrastructureException;
import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemWriter;
@@ -255,7 +255,7 @@ public class ItemOrientedStepTests extends TestCase {
itemOrientedStep.execute(stepExecution);
fail("Expected BatchCriticalException");
}
catch (BatchCriticalException e) {
catch (InfrastructureException e) {
assertEquals("foo", e.getCause().getMessage());
}
assertEquals(BatchStatus.UNKNOWN, stepExecution.getStatus());
@@ -548,7 +548,7 @@ public class ItemOrientedStepTests extends TestCase {
itemOrientedStep.execute(stepExecution);
fail("Expected BatchCriticalException");
}
catch (BatchCriticalException ex) {
catch (InfrastructureException ex) {
assertEquals(BatchStatus.UNKNOWN, stepExecution.getStatus());
String msg = stepExecution.getExitStatus().getExitDescription();
assertTrue("Message does not contain ResetFailedException: " + msg, msg.contains("ResetFailedException"));
@@ -576,7 +576,7 @@ public class ItemOrientedStepTests extends TestCase {
itemOrientedStep.execute(stepExecution);
fail("Expected BatchCriticalException");
}
catch (BatchCriticalException ex) {
catch (InfrastructureException ex) {
assertEquals(BatchStatus.UNKNOWN, stepExecution.getStatus());
String msg = stepExecution.getExitStatus().getExitDescription();
assertEquals("", msg);
@@ -637,7 +637,7 @@ public class ItemOrientedStepTests extends TestCase {
itemOrientedStep.execute(stepExecution);
fail("Expected BatchCriticalException");
}
catch (BatchCriticalException ex) {
catch (InfrastructureException ex) {
// The job actually completeed, but teh streams couldn't be closed.
assertEquals(BatchStatus.COMPLETED, stepExecution.getStatus());
String msg = stepExecution.getExitStatus().getExitDescription();

View File

@@ -18,7 +18,7 @@ package org.springframework.batch.execution.step;
import org.springframework.batch.core.domain.JobInterruptedException;
import org.springframework.batch.core.domain.Step;
import org.springframework.batch.core.domain.StepExecution;
import org.springframework.batch.io.exception.BatchCriticalException;
import org.springframework.batch.io.exception.InfrastructureException;
import org.springframework.beans.factory.BeanNameAware;
/**
@@ -110,7 +110,7 @@ public class StepSupport implements Step, BeanNameAware {
*
* @see org.springframework.batch.core.domain.Step#execute(org.springframework.batch.core.domain.StepExecution)
*/
public void execute(StepExecution stepExecution) throws JobInterruptedException, BatchCriticalException {
public void execute(StepExecution stepExecution) throws JobInterruptedException, InfrastructureException {
throw new UnsupportedOperationException(
"Cannot process a StepExecution. Use a smarter subclass of StepSupport.");
}

View File

@@ -15,7 +15,7 @@ import org.springframework.batch.core.listener.StepListenerSupport;
import org.springframework.batch.core.tasklet.Tasklet;
import org.springframework.batch.execution.job.JobSupport;
import org.springframework.batch.execution.step.support.JobRepositorySupport;
import org.springframework.batch.io.exception.BatchCriticalException;
import org.springframework.batch.io.exception.InfrastructureException;
import org.springframework.batch.repeat.ExitStatus;
public class TaskletStepTests extends TestCase {
@@ -89,7 +89,7 @@ public class TaskletStepTests extends TestCase {
try {
step.execute(stepExecution);
fail("Expected BatchCriticalException");
} catch (BatchCriticalException e){
} catch (InfrastructureException e){
assertEquals("foo", e.getCause().getMessage());
}
assertEquals(BatchStatus.UNKNOWN, stepExecution.getStatus());
@@ -118,7 +118,7 @@ public class TaskletStepTests extends TestCase {
assertEquals(2, list.size());
}
public void testExceptionExecution() throws JobInterruptedException, BatchCriticalException {
public void testExceptionExecution() throws JobInterruptedException, InfrastructureException {
TaskletStep step = new TaskletStep(new StubTasklet(false, true), new JobRepositorySupport());
try {
step.execute(stepExecution);