* 리팩터링

This commit is contained in:
kimjihun
2024-08-02 20:18:13 +09:00
parent b597977108
commit 8939611e36

View File

@@ -28,7 +28,8 @@ public class ExcelRowReader implements ItemReader<Row> {
Workbook workbook = WorkbookFactory.create(fileInputStream); Workbook workbook = WorkbookFactory.create(fileInputStream);
Sheet sheet = workbook.getSheetAt(0); Sheet sheet = workbook.getSheetAt(0);
this.rowCursor = sheet.iterator(); this.rowCursor = sheet.iterator();
// Skip header row if necessary
if (rowCursor.hasNext()) { if (rowCursor.hasNext()) {
rowCursor.next(); rowCursor.next();
} }
@@ -36,10 +37,11 @@ public class ExcelRowReader implements ItemReader<Row> {
@Override @Override
public Row read() { public Row read() {
if (rowCursor != null && rowCursor.hasNext()) { if (rowCursor != null && rowCursor.hasNext()) {
return rowCursor.next(); return rowCursor.next();
} else { } else {
return null; // No more rows to read return null;
} }
} }
} }