diff --git a/spring-batch-excel/src/main/java/org/springframework/batch/extensions/excel/AbstractExcelItemReader.java b/spring-batch-excel/src/main/java/org/springframework/batch/extensions/excel/AbstractExcelItemReader.java index f165d63..c39411f 100644 --- a/spring-batch-excel/src/main/java/org/springframework/batch/extensions/excel/AbstractExcelItemReader.java +++ b/spring-batch-excel/src/main/java/org/springframework/batch/extensions/excel/AbstractExcelItemReader.java @@ -107,7 +107,7 @@ public abstract class AbstractExcelItemReader extends AbstractItemCountingIte this.rs.next(); } try { - return (this.rs.getCurrentRow() != null) ? this.rowMapper.mapRow(this.rs) : null; + return (this.rs.getCurrentRow() != null) ? this.rowMapper.mapRow(this.rs) : doRead(); } catch (Exception ex) { throw new ExcelFileParseException("Exception parsing Excel file.", ex, this.resource.getDescription(), diff --git a/spring-batch-excel/src/test/java/org/springframework/batch/extensions/excel/poi/PoiItemReaderXlsWithBlankLinesTests.java b/spring-batch-excel/src/test/java/org/springframework/batch/extensions/excel/poi/PoiItemReaderXlsWithBlankLinesTests.java new file mode 100644 index 0000000..eeba57b --- /dev/null +++ b/spring-batch-excel/src/test/java/org/springframework/batch/extensions/excel/poi/PoiItemReaderXlsWithBlankLinesTests.java @@ -0,0 +1,39 @@ +/* + * Copyright 2002-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.batch.extensions.excel.poi; + +import org.springframework.batch.extensions.excel.AbstractExcelItemReader; +import org.springframework.batch.extensions.excel.AbstractExcelItemReaderTests; +import org.springframework.core.io.ClassPathResource; + +/** + * @author Marten Deinum + * @since 0.1.0 + */ +public class PoiItemReaderXlsWithBlankLinesTests extends AbstractExcelItemReaderTests { + + @Override + protected void configureItemReader(AbstractExcelItemReader itemReader) { + itemReader.setResource(new ClassPathResource("player_with_blank_lines.xls")); + } + + @Override + protected AbstractExcelItemReader createExcelItemReader() { + return new PoiItemReader<>(); + } + +} diff --git a/spring-batch-excel/src/test/resources/player_with_blank_lines.xls b/spring-batch-excel/src/test/resources/player_with_blank_lines.xls new file mode 100644 index 0000000..7c34ece Binary files /dev/null and b/spring-batch-excel/src/test/resources/player_with_blank_lines.xls differ