mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-12-06 17:18:54 +08:00
IoUtil.writeObjects判空避免空指针(issue#4049@Github)
This commit is contained in:
parent
a5820325ad
commit
f2686560fb
@ -2,7 +2,7 @@
|
|||||||
# 🚀Changelog
|
# 🚀Changelog
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
# 5.8.41(2025-08-29)
|
# 5.8.41(2025-08-30)
|
||||||
|
|
||||||
### 🐣新特性
|
### 🐣新特性
|
||||||
* 【core 】 增加`WeakKeyValueConcurrentMap`及其关联类,同时废弃`WeakConcurrentMap`并替换(issue#4039@Github)
|
* 【core 】 增加`WeakKeyValueConcurrentMap`及其关联类,同时废弃`WeakConcurrentMap`并替换(issue#4039@Github)
|
||||||
@ -10,6 +10,7 @@
|
|||||||
* 【core 】 `ObjectUtil`增加`apply`方法
|
* 【core 】 `ObjectUtil`增加`apply`方法
|
||||||
* 【core 】 `ReferenceUtil`增加`get`方法
|
* 【core 】 `ReferenceUtil`增加`get`方法
|
||||||
* 【db 】 `Condition`增加构造方法支持BETWEEN(issue#4041@Github)
|
* 【db 】 `Condition`增加构造方法支持BETWEEN(issue#4041@Github)
|
||||||
|
* 【core 】 `IoUtil.writeObjects`判空避免空指针(issue#4049@Github)
|
||||||
|
|
||||||
### 🐞Bug修复
|
### 🐞Bug修复
|
||||||
* 【core 】 修复`ReflectUtil`中因class和Method关联导致的缓存无法回收问题(issue#4039@Github)
|
* 【core 】 修复`ReflectUtil`中因class和Method关联导致的缓存无法回收问题(issue#4039@Github)
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import cn.hutool.core.exceptions.UtilException;
|
|||||||
import cn.hutool.core.io.copy.ReaderWriterCopier;
|
import cn.hutool.core.io.copy.ReaderWriterCopier;
|
||||||
import cn.hutool.core.io.copy.StreamCopier;
|
import cn.hutool.core.io.copy.StreamCopier;
|
||||||
import cn.hutool.core.lang.Assert;
|
import cn.hutool.core.lang.Assert;
|
||||||
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
import cn.hutool.core.util.CharsetUtil;
|
import cn.hutool.core.util.CharsetUtil;
|
||||||
import cn.hutool.core.util.HexUtil;
|
import cn.hutool.core.util.HexUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
@ -1071,6 +1072,10 @@ public class IoUtil extends NioUtil {
|
|||||||
public static void writeObjects(OutputStream out, boolean isCloseOut, Serializable... contents) throws IORuntimeException {
|
public static void writeObjects(OutputStream out, boolean isCloseOut, Serializable... contents) throws IORuntimeException {
|
||||||
ObjectOutputStream osw = null;
|
ObjectOutputStream osw = null;
|
||||||
try {
|
try {
|
||||||
|
if(ArrayUtil.isEmpty( contents)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
osw = out instanceof ObjectOutputStream ? (ObjectOutputStream) out : new ObjectOutputStream(out);
|
osw = out instanceof ObjectOutputStream ? (ObjectOutputStream) out : new ObjectOutputStream(out);
|
||||||
for (Object content : contents) {
|
for (Object content : contents) {
|
||||||
if (content != null) {
|
if (content != null) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user