mirror of
https://gitee.com/dromara/hutool.git
synced 2025-04-05 17:37:59 +08:00
fix null bug
This commit is contained in:
parent
368a5e4d1c
commit
e8c0a75e7f
@ -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)
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user