Rationalise writer exception hierarchy
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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<T> 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<T> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<T> 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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user