BATCH-1462: ignore directories if reader has strict=false

This commit is contained in:
dsyer
2009-12-30 17:29:18 +00:00
parent 187246d4f0
commit 56a3e54954
5 changed files with 68 additions and 0 deletions

View File

@@ -260,6 +260,15 @@ public class FlatFileItemReader<T> extends AbstractItemCountingItemStreamItemRea
return;
}
if (!resource.isReadable()) {
if (strict) {
throw new IllegalStateException("Input resource must be readable (reader is in 'strict' mode): " + resource);
}
noInput = true;
logger.warn("Input resource is not readable " + resource.getDescription());
return;
}
reader = bufferedReaderFactory.create(resource, encoding);
for (int i = 0; i < linesToSkip; i++) {
String line = readLine();

View File

@@ -182,6 +182,14 @@ public class StaxEventItemReader<T> extends AbstractItemCountingItemStreamItemRe
logger.warn("Input resource does not exist " + resource.getDescription());
return;
}
if (!resource.isReadable()) {
if (strict) {
throw new IllegalStateException("Input resource must be readable (reader is in 'strict' mode)");
}
noInput = true;
logger.warn("Input resource is not readable " + resource.getDescription());
return;
}
inputStream = resource.getInputStream();
eventReader = XMLInputFactory.newInstance().createXMLEventReader(inputStream);