diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/launch/EmptyItemWriter.java b/spring-batch-core/src/test/java/org/springframework/batch/core/launch/EmptyItemWriter.java index ec841d93d..7767681b3 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/launch/EmptyItemWriter.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/launch/EmptyItemWriter.java @@ -20,9 +20,7 @@ import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.springframework.batch.item.ClearFailedException; import org.springframework.batch.item.ItemWriter; -import org.springframework.batch.support.transaction.FlushFailedException; import org.springframework.batch.support.transaction.TransactionAwareProxyFactory; import org.springframework.beans.factory.InitializingBean; @@ -64,12 +62,4 @@ public class EmptyItemWriter implements ItemWriter, InitializingBean { return list; } - public void clear() throws ClearFailedException { - // no-op - } - - public void flush() throws FlushFailedException { - // no-op - } - } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ClearFailedException.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/WriteFailedException.java similarity index 78% rename from spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ClearFailedException.java rename to spring-batch-infrastructure/src/main/java/org/springframework/batch/item/WriteFailedException.java index 0c96016f8..4d46b6aee 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ClearFailedException.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/WriteFailedException.java @@ -22,25 +22,25 @@ package org.springframework.batch.item; * @author Lucas Ward * @author Ben Hale */ -public class ClearFailedException extends ItemWriterException { +public class WriteFailedException extends ItemWriterException { /** - * Create a new {@link ClearFailedException} based on a message and another + * Create a new {@link WriteFailedException} based on a message and another * exception. * * @param message the message for this exception * @param cause the other exception */ - public ClearFailedException(String message, Throwable cause) { + public WriteFailedException(String message, Throwable cause) { super(message, cause); } /** - * Create a new {@link ClearFailedException} based on a message. + * Create a new {@link WriteFailedException} based on a message. * * @param message the message for this exception */ - public ClearFailedException(String message) { + public WriteFailedException(String message) { super(message); } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/WriterNotOpenException.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/WriterNotOpenException.java index 08691f9f7..5bbe60d0b 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/WriterNotOpenException.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/WriterNotOpenException.java @@ -21,7 +21,7 @@ package org.springframework.batch.item; * * @author Lucas Ward */ -public class WriterNotOpenException extends ItemReaderException { +public class WriterNotOpenException extends ItemWriterException { /** * Create a new {@link WriterNotOpenException} based on a message. diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/FlatFileItemWriter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/FlatFileItemWriter.java index 3939d4eb8..30f26f7b3 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/FlatFileItemWriter.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/FlatFileItemWriter.java @@ -28,11 +28,11 @@ import java.util.List; import org.springframework.batch.item.ExecutionContext; import org.springframework.batch.item.ItemStream; import org.springframework.batch.item.ItemStreamException; +import org.springframework.batch.item.WriteFailedException; import org.springframework.batch.item.WriterNotOpenException; import org.springframework.batch.item.file.transform.LineAggregator; import org.springframework.batch.item.util.ExecutionContextUserSupport; import org.springframework.batch.item.util.FileUtils; -import org.springframework.batch.support.transaction.FlushFailedException; import org.springframework.batch.support.transaction.TransactionAwareBufferedWriter; import org.springframework.beans.factory.InitializingBean; import org.springframework.core.io.Resource; @@ -194,7 +194,7 @@ public class FlatFileItemWriter extends ExecutionContextUserSupport implement state.write(lines.toString()); } catch (IOException e) { - throw new FlushFailedException("Could not write data. The file may be corrupt.", e); + throw new WriteFailedException("Could not write data. The file may be corrupt.", e); } state.linesWritten += lineCount; } @@ -253,7 +253,7 @@ public class FlatFileItemWriter extends ExecutionContextUserSupport implement outputState.write("\n"); } catch (IOException e) { - throw new FlushFailedException("Could not write headers. The file may be corrupt.", e); + throw new ItemStreamException("Could not write headers. The file may be corrupt.", e); } } } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/StaxEventItemWriter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/StaxEventItemWriter.java index 8f01dfd0e..dd04e589f 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/StaxEventItemWriter.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/xml/StaxEventItemWriter.java @@ -36,11 +36,11 @@ import org.apache.commons.logging.LogFactory; import org.springframework.batch.item.ExecutionContext; import org.springframework.batch.item.ItemStreamException; import org.springframework.batch.item.ItemWriter; +import org.springframework.batch.item.WriteFailedException; import org.springframework.batch.item.file.ResourceAwareItemWriterItemStream; import org.springframework.batch.item.util.ExecutionContextUserSupport; import org.springframework.batch.item.util.FileUtils; import org.springframework.batch.item.xml.stax.NoStartEndDocumentStreamWriter; -import org.springframework.batch.support.transaction.FlushFailedException; import org.springframework.batch.support.transaction.TransactionAwareBufferedWriter; import org.springframework.beans.factory.InitializingBean; import org.springframework.core.io.Resource; @@ -456,7 +456,7 @@ public class StaxEventItemWriter extends ExecutionContextUserSupport implemen eventWriter.flush(); } catch (XMLStreamException e) { - throw new FlushFailedException("Failed to flush the events", e); + throw new WriteFailedException("Failed to flush the events", e); } } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/transaction/FlushFailedException.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/transaction/FlushFailedException.java index f0a435d0d..5d2c93099 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/transaction/FlushFailedException.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/support/transaction/FlushFailedException.java @@ -15,7 +15,6 @@ */ package org.springframework.batch.support.transaction; -import org.springframework.batch.item.ItemWriterException; /** * Unchecked exception indicating that an error has occurred while trying to flush a buffer. @@ -23,7 +22,7 @@ import org.springframework.batch.item.ItemWriterException; * @author Lucas Ward * @author Ben Hale */ -public class FlushFailedException extends ItemWriterException { +public class FlushFailedException extends RuntimeException { /** * Create a new {@link FlushFailedException} based on a message and another exception. diff --git a/spring-batch-samples/.springBeans b/spring-batch-samples/.springBeans index 64eb692b5..4a9376336 100644 --- a/spring-batch-samples/.springBeans +++ b/spring-batch-samples/.springBeans @@ -68,6 +68,7 @@ src/test/resources/org/springframework/batch/sample/common/StagingItemReaderTests-context.xml src/test/resources/org/springframework/batch/sample/common/StagingItemWriterTests-context.xml src/test/resources/org/springframework/batch/sample/TradeJobFunctionalTests-context.xml + src/test/resources/org/springframework/batch/sample/PartitionJobFunctionalTests-context.xml @@ -415,5 +416,15 @@ src/main/resources/jobs/iosample/ibatis.xml + + + true + false + + src/main/resources/data-source-context.xml + src/main/resources/jobs/partitionJob.xml + src/main/resources/simple-job-launcher-context.xml + + diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/JdbcGameDao.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/JdbcGameDao.java index fd3f09864..bcf67aca4 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/JdbcGameDao.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/football/internal/JdbcGameDao.java @@ -18,10 +18,8 @@ package org.springframework.batch.sample.domain.football.internal; import java.util.List; -import org.springframework.batch.item.ClearFailedException; import org.springframework.batch.item.ItemWriter; import org.springframework.batch.sample.domain.football.Game; -import org.springframework.batch.support.transaction.FlushFailedException; import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; import org.springframework.jdbc.core.namedparam.SqlParameterSource; import org.springframework.jdbc.core.simple.SimpleJdbcDaoSupport; @@ -56,10 +54,4 @@ public class JdbcGameDao extends SimpleJdbcDaoSupport implements ItemWriter { @@ -50,13 +48,4 @@ public class JdbcPlayerSummaryDao extends SimpleJdbcDaoSupport implements ItemWr } - public void close() throws Exception { - } - - public void clear() throws ClearFailedException { - } - - public void flush() throws FlushFailedException { - } - }