fix null bug

This commit is contained in:
Looly 2020-04-23 12:07:41 +08:00
parent 368a5e4d1c
commit e8c0a75e7f
2 changed files with 7 additions and 4 deletions

View File

@ -19,6 +19,7 @@
* 【json 】 修复JSONConvert转换日期空指针问题issue#I1F8M2@Gitee
* 【core 】 修复XML中带注释Xpath解析导致空指针问题issue#I1F2WI@Gitee
* 【core 】 修复FileUtil.rename原文件无扩展名多点的问题issue#839@Github
* 【db 】 修复DbUtil.close可能存在的空指针问题issue#847@Github
-------------------------------------------------------------------------------------------------------------
## 5.3.1 (2020-04-17)

View File

@ -152,10 +152,12 @@ public final class DbUtil {
*/
public static void close(Object... objsToClose) {
for (Object obj : objsToClose) {
if (obj instanceof AutoCloseable) {
IoUtil.close((AutoCloseable) obj);
} else {
log.warn("Object {} not a ResultSet or Statement or PreparedStatement or Connection!", obj.getClass().getName());
if(null != obj){
if (obj instanceof AutoCloseable) {
IoUtil.close((AutoCloseable) obj);
} else {
log.warn("Object {} not a ResultSet or Statement or PreparedStatement or Connection!", obj.getClass().getName());
}
}
}
}