Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: loasExcel过程中遇到数据加载错误时,增加必要的日志信息,打印出是哪行哪列的数据加载出错 #2168

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions core/src/main/java/datart/core/common/POIUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,20 @@ public static List<List<Object>> loadExcel(String path) throws IOException {
Exceptions.msg("empty excel :" + path);
}
int columns = row0.getPhysicalNumberOfCells();
int rowId = 0;
while (rowIterator.hasNext()) {
Row row = rowIterator.next();
rowId += 1;
LinkedList<Object> cellValues = new LinkedList<>();
for (int i = 0; i < columns; i++)
cellValues.add(readCellValue(row.getCell(i)));
for (int i = 0; i < columns; i++) {
try {
cellValues.add(readCellValue(row.getCell(i)));
} catch (Exception e) {
Exceptions.msg("read cell value error, row: " + String.valueOf(rowId)
+ ", column: " + String.valueOf(i) + ". errmsg: " + e.toString()
);
}
}
rows.add(cellValues);
}
}
Expand Down