diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/FlatFileItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/FlatFileItemReader.java index ed8813a86..8a91688a7 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/FlatFileItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/FlatFileItemReader.java @@ -221,13 +221,13 @@ public class FlatFileItemReader 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 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 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");