mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
修改异常包装策略:运行时异常不包装,只包装非运行时异常
This commit is contained in:
@@ -2,6 +2,7 @@ package cn.hutool.cache.impl;
|
||||
|
||||
import cn.hutool.cache.Cache;
|
||||
import cn.hutool.cache.CacheListener;
|
||||
import cn.hutool.core.exceptions.ExceptionUtil;
|
||||
import cn.hutool.core.lang.func.Func0;
|
||||
import cn.hutool.core.lang.mutable.Mutable;
|
||||
import cn.hutool.core.lang.mutable.MutableObj;
|
||||
@@ -120,7 +121,9 @@ public abstract class AbstractCache<K, V> implements Cache<K, V> {
|
||||
try {
|
||||
v = supplier.call();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
// issue#I7RJZT 运行时异常不做包装
|
||||
throw ExceptionUtil.wrapRuntime(e);
|
||||
//throw new RuntimeException(e);
|
||||
}
|
||||
put(key, v, this.timeout);
|
||||
} else {
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package cn.hutool.cache.impl;
|
||||
|
||||
import cn.hutool.cache.Cache;
|
||||
import cn.hutool.core.exceptions.ExceptionUtil;
|
||||
import cn.hutool.core.lang.func.Func0;
|
||||
|
||||
import java.util.Iterator;
|
||||
@@ -60,7 +61,7 @@ public class NoCache<K, V> implements Cache<K, V> {
|
||||
try {
|
||||
return (null == supplier) ? null : supplier.call();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
throw ExceptionUtil.wrapRuntime(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user