BATCH-1418: Reverted FlatFileItemReader changes due to merge conflicts

This commit is contained in:
lucasward
2009-11-18 06:04:57 +00:00
parent 7de0f773e8
commit d67b9d7101

View File

@@ -221,13 +221,13 @@ public class FlatFileItemReader<T> extends AbstractItemCountingItemStreamItemRea
}
String line = null;
try {
line = this.reader.readLine();
if (line == null) {
return null;
}
lineCount++;
while (isComment(line)) {
line = reader.readLine();
if (line == null) {
@@ -235,30 +235,12 @@ public class FlatFileItemReader<T> extends AbstractItemCountingItemStreamItemRea
}
lineCount++;
}
line = applyRecordSeparatorPolicy(line);
}
catch (IOException e) {
throw new FlatFileParseException("Unable to read from resource: [" + resource + "]", e, line, lineCount);
}
return line;
}
private String applyRecordSeparatorPolicy(String line) throws IOException{
String record = line;
while (line != null && !recordSeparatorPolicy.isEndOfRecord(record)) {
line = this.reader.readLine();
if (line==null) {
throw new FlatFileParseException("Unexpected end of file before record complete", record, lineCount);
}
record = recordSeparatorPolicy.preProcess(record) + line;
lineCount++;
}
return recordSeparatorPolicy.postProcess(record);
}
private boolean isComment(String line) {
for (String prefix : comments) {
@@ -300,13 +282,6 @@ public class FlatFileItemReader<T> extends AbstractItemCountingItemStreamItemRea
}
}
}
@Override
protected void jumpToItem(int itemIndex) throws Exception {
for (int i = 0; i < itemIndex; i++) {
readLine();
}
}
public void afterPropertiesSet() throws Exception {
Assert.notNull(lineMapper, "LineMapper is required");