fix NPE bug

This commit is contained in:
Looly 2022-04-02 00:42:27 +08:00
parent aaa88dad81
commit 8196941b6e
3 changed files with 16 additions and 16 deletions

View File

@ -25,6 +25,7 @@
* 【core 】 修复urlWithParamIfGet函数逻辑问题issue#I50IUD@Gitee
* 【core 】 修复IoUtil.readBytes限制长度读取问题issue#2230@Github
* 【http 】 修复HttpRequest中编码对URL无效的问题issue#I50NHQ@Gitee
* 【poi 】 修复读取excel抛NPE错误pr#2234@Github
-------------------------------------------------------------------------------------------------------------

View File

@ -260,7 +260,6 @@ public class HandleHelper {
* 获取字段值<br>
* 针对日期时间等做单独处理判断
*
* @param <T> 返回类型
* @param rs {@link ResultSet}
* @param columnIndex 字段索引
* @param type 字段类型默认Object
@ -268,7 +267,7 @@ public class HandleHelper {
* @return 字段值
* @throws SQLException SQL异常
*/
private static <T> Object getColumnValue(ResultSet rs, int columnIndex, int type, Type targetColumnType) throws SQLException {
private static Object getColumnValue(ResultSet rs, int columnIndex, int type, Type targetColumnType) throws SQLException {
Object rawValue = null;
switch (type) {
case Types.TIMESTAMP:

View File

@ -245,9 +245,9 @@ public class ExcelReadTest {
Assert.assertEquals("", objects.get(2));
}
@Test(expected = NullPointerException.class)
@Ignore
@Test
public void readColumnNPETest() {
// https://github.com/dromara/hutool/pull/2234
ExcelReader reader = ExcelUtil.getReader(ResourceUtil.getStream("read_row_npe.xlsx"));
reader.readColumn(0, 1);
}