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

@@ -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());
}
}
}
}