diff --git a/spring-batch-excel/pom.xml b/spring-batch-excel/pom.xml index 1afdce3..1f3cc0f 100644 --- a/spring-batch-excel/pom.xml +++ b/spring-batch-excel/pom.xml @@ -49,7 +49,7 @@ 3.18.1 - 5.7.2 + 5.8.2 2.13.3 3.11.0 @@ -183,6 +183,14 @@ + + maven-surefire-plugin + 2.22.2 + + + maven-failsafe-plugin + 2.22.2 + diff --git a/spring-batch-excel/src/main/java/org/springframework/batch/extensions/excel/Sheet.java b/spring-batch-excel/src/main/java/org/springframework/batch/extensions/excel/Sheet.java index 5e7c9ee..7576017 100644 --- a/spring-batch-excel/src/main/java/org/springframework/batch/extensions/excel/Sheet.java +++ b/spring-batch-excel/src/main/java/org/springframework/batch/extensions/excel/Sheet.java @@ -39,9 +39,8 @@ public interface Sheet extends Iterable, AutoCloseable { String getName(); /** - * Get the row as a {@code String[]}. Returns {@code null} if the row doesn't exist. Can throw an {@code UnsupportedOperationException} - * when the underlying implementation doesn't support indexed access to rows. - * + * Get the row as a {@code String[]}. Returns {@code null} if the row doesn't exist. Can throw an + * {@code UnsupportedOperationException} when the underlying implementation doesn't support indexed access to rows. * @param rowNumber the row number to read. * @return a {@code String[]} or {@code null} */ diff --git a/spring-batch-excel/src/main/java/org/springframework/batch/extensions/excel/streaming/StreamingSheet.java b/spring-batch-excel/src/main/java/org/springframework/batch/extensions/excel/streaming/StreamingSheet.java index 24e355c..a4d87b5 100644 --- a/spring-batch-excel/src/main/java/org/springframework/batch/extensions/excel/streaming/StreamingSheet.java +++ b/spring-batch-excel/src/main/java/org/springframework/batch/extensions/excel/streaming/StreamingSheet.java @@ -16,8 +16,6 @@ package org.springframework.batch.extensions.excel.streaming; -import java.io.Closeable; -import java.io.IOException; import java.io.InputStream; import java.util.Arrays; import java.util.HashMap; diff --git a/spring-batch-excel/src/test/java/org/springframework/batch/extensions/excel/poi/PoiItemReaderXlsxWithBlankLinesTests.java b/spring-batch-excel/src/test/java/org/springframework/batch/extensions/excel/poi/PoiItemReaderXlsxWithBlankLinesTests.java new file mode 100644 index 0000000..0127537 --- /dev/null +++ b/spring-batch-excel/src/test/java/org/springframework/batch/extensions/excel/poi/PoiItemReaderXlsxWithBlankLinesTests.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 PoiItemReaderXlsxWithBlankLinesTests extends AbstractExcelItemReaderTests { + + @Override + protected void configureItemReader(AbstractExcelItemReader itemReader) { + itemReader.setResource(new ClassPathResource("player_with_blank_lines.xlsx")); + } + + @Override + protected AbstractExcelItemReader createExcelItemReader() { + return new PoiItemReader<>(); + } + +} diff --git a/spring-batch-excel/src/test/java/org/springframework/batch/extensions/excel/streaming/StreamingXlsxItemReaderWithBlankLinesTest.java b/spring-batch-excel/src/test/java/org/springframework/batch/extensions/excel/streaming/StreamingXlsxItemReaderWithBlankLinesTest.java new file mode 100644 index 0000000..650779e --- /dev/null +++ b/spring-batch-excel/src/test/java/org/springframework/batch/extensions/excel/streaming/StreamingXlsxItemReaderWithBlankLinesTest.java @@ -0,0 +1,39 @@ +/* + * Copyright 2006-2021 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.streaming; + +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 + */ +class StreamingXlsxItemReaderWithBlankLinesTest extends AbstractExcelItemReaderTests { + + @Override + protected void configureItemReader(AbstractExcelItemReader itemReader) { + itemReader.setResource(new ClassPathResource("player_with_blank_lines.xlsx")); + } + + @Override + protected AbstractExcelItemReader createExcelItemReader() { + return new StreamingXlsxItemReader<>(); + } + +} 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 index 7c34ece..fa622c5 100644 Binary files a/spring-batch-excel/src/test/resources/player_with_blank_lines.xls and b/spring-batch-excel/src/test/resources/player_with_blank_lines.xls differ diff --git a/spring-batch-excel/src/test/resources/player_with_blank_lines.xlsx b/spring-batch-excel/src/test/resources/player_with_blank_lines.xlsx new file mode 100644 index 0000000..f86ce65 Binary files /dev/null and b/spring-batch-excel/src/test/resources/player_with_blank_lines.xlsx differ