Commit 40997de8 authored by Matija Obreza's avatar Matija Obreza

Fix: Better update of sheet.rowCount for Excel

parent 40b944b5
......@@ -192,6 +192,7 @@ public class MetadataServiceImpl implements MetadataService {
PreviewSheet sheetInfo = new PreviewSheet(sheetIndex, sheet.getSheetName());
previewService.updateState(preview.getId(), Preview.State.READING, "Parsing " + sheet.getSheetName());
AtomicInteger rowNum = new AtomicInteger(0);
for (Row currentRow : sheet) {
final List<Object> values = cellsValues(currentRow);
trimTrailingNull(values);
......@@ -201,6 +202,7 @@ public class MetadataServiceImpl implements MetadataService {
}
previewService.addRow(referenceUuid, sheetIndex, currentRow.getRowNum(), values);
rowNum.set(currentRow.getRowNum());
if (maxRows != null && currentRow.getRowNum() >= maxRows) {
// We reached the rows limit
......@@ -217,7 +219,7 @@ public class MetadataServiceImpl implements MetadataService {
// }
}
sheetInfo.rowCount = sheet.getLastRowNum() + 1;
sheetInfo.rowCount = rowNum.get() + 1;
previewService.registerSheet(preview.getId(), sheetInfo);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment