mirror of
https://gitee.com/dromara/hutool.git
synced 2025-05-02 20:02:49 +08:00
fix null bug
This commit is contained in:
parent
3ed26fe761
commit
644d1c22c7
@ -3,7 +3,7 @@
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
# 5.7.15 (2021-10-15)
|
||||
# 5.7.15 (2021-10-16)
|
||||
|
||||
### 🐣新特性
|
||||
* 【db 】 Db.quietSetAutoCommit增加判空(issue#I4D75B@Gitee)
|
||||
@ -16,6 +16,7 @@
|
||||
* 【core 】 修复CollUtil.isEqualList两个null返回错误问题(issue#1885@Github)
|
||||
* 【poi 】 修复ExcelWriter多余调试信息导致的问题(issue#1884@Github)
|
||||
* 【poi 】 修复TemporalAccessorUtil.toInstant使用DateTimeFormatter导致问题(issue#1891@Github)
|
||||
* 【poi 】 修复sheet.getRow(y)为null导致的问题(issue#1893@Github)
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
@ -281,11 +281,13 @@ public class ExcelReader extends ExcelBase<ExcelReader> {
|
||||
short columnSize;
|
||||
for (int y = startRowIndex; y <= endRowIndex; y++) {
|
||||
row = this.sheet.getRow(y);
|
||||
columnSize = row.getLastCellNum();
|
||||
Cell cell;
|
||||
for (short x = 0; x < columnSize; x++) {
|
||||
cell = row.getCell(x);
|
||||
cellHandler.handle(cell, CellUtil.getCellValue(cell));
|
||||
if(null != row){
|
||||
columnSize = row.getLastCellNum();
|
||||
Cell cell;
|
||||
for (short x = 0; x < columnSize; x++) {
|
||||
cell = row.getCell(x);
|
||||
cellHandler.handle(cell, CellUtil.getCellValue(cell));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import cn.hutool.core.io.resource.ResourceUtil;
|
||||
import cn.hutool.core.lang.Console;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.poi.excel.cell.CellHandler;
|
||||
import lombok.Data;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
@ -225,4 +226,11 @@ public class ExcelReadTest {
|
||||
final List<Map<String, Object>> maps = reader.readAll();
|
||||
Console.log(maps);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void readNullRowTest(){
|
||||
final ExcelReader reader = ExcelUtil.getReader("d:/test/1.-.xls");
|
||||
reader.read((CellHandler) Console::log);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user