[BATCH-430] Renamed InfrastructureException to UnexpectedJobExecutionException

This commit is contained in:
nebhale
2008-03-07 14:29:51 +00:00
parent 609ce9d347
commit cce1b29f6d
22 changed files with 57 additions and 57 deletions

View File

@@ -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);
}
}

View File

@@ -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 + "]");
}
}

View File

@@ -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;
}

View File

@@ -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());
}

View File

@@ -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);
}
}

View File

@@ -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;

View File

@@ -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.");
}

View File

@@ -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;

View File

@@ -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();

View File

@@ -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.");
}

View File

@@ -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);