BATCH-263:XML and FlatFile item readers will no longer throw IllegalStateException on afterPropertiesSet if resource.exists() == false. Instead, they will check that a resource exists when initialized by the first call to read().
This commit is contained in:
@@ -123,8 +123,6 @@ public class SimpleFlatFileItemReader extends AbstractItemReader implements Item
|
||||
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(resource);
|
||||
Assert.state(resource.exists(), "Resource must exist: [" + resource
|
||||
+ "]");
|
||||
Assert.notNull(fieldSetMapper, "FieldSetMapper must not be null.");
|
||||
}
|
||||
|
||||
@@ -133,6 +131,10 @@ public class SimpleFlatFileItemReader extends AbstractItemReader implements Item
|
||||
* @throws IllegalStateException if the resource cannot be opened
|
||||
*/
|
||||
public void open() throws IllegalStateException {
|
||||
|
||||
Assert.state(resource.exists(), "Resource must exist: [" + resource
|
||||
+ "]");
|
||||
|
||||
if (this.reader == null) {
|
||||
ResourceLineReader reader = new ResourceLineReader(resource, encoding);
|
||||
if (recordSeparatorPolicy != null) {
|
||||
|
||||
@@ -118,6 +118,8 @@ public class StaxEventItemReader extends AbstractItemReader implements ItemReade
|
||||
}
|
||||
|
||||
public void open() {
|
||||
Assert.state(resource.exists(), "Input resource does not exist: [" + resource + "]");
|
||||
|
||||
registerSynchronization();
|
||||
try {
|
||||
inputStream = resource.getInputStream();
|
||||
@@ -184,7 +186,6 @@ public class StaxEventItemReader extends AbstractItemReader implements ItemReade
|
||||
*/
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(resource, "The Resource must not be null.");
|
||||
Assert.state(resource.exists(), "Input resource does not exist: [" + resource + "]");
|
||||
Assert.notNull(eventReaderDeserializer, "The FragmentDeserializer must not be null.");
|
||||
Assert.hasLength(fragmentRootElementName, "The FragmentRootElementName must not be null");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user