mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
修改异常包装策略:运行时异常不包装,只包装非运行时异常
This commit is contained in:
parent
e66681936f
commit
170c083907
@ -2,11 +2,12 @@
|
|||||||
# 🚀Changelog
|
# 🚀Changelog
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
# 5.8.22(2023-08-07)
|
# 5.8.22(2023-08-08)
|
||||||
|
|
||||||
### 🐣新特性
|
### 🐣新特性
|
||||||
* 【core 】 NumberUtil.nullToZero增加重载(issue#I7PPD2@Gitee)
|
* 【core 】 NumberUtil.nullToZero增加重载(issue#I7PPD2@Gitee)
|
||||||
* 【core 】 DesensitizedUtil增加清空策略(issue#I7PUJ2@Gitee)
|
* 【core 】 DesensitizedUtil增加清空策略(issue#I7PUJ2@Gitee)
|
||||||
|
* 【all 】 修改异常包装策略:运行时异常不包装,只包装非运行时异常(issue#I7RJZT@Gitee)
|
||||||
|
|
||||||
### 🐞Bug修复
|
### 🐞Bug修复
|
||||||
* 【core 】 修复NumberUtil.toBigDecimal转换科学计数法问题(issue#3241@Github)
|
* 【core 】 修复NumberUtil.toBigDecimal转换科学计数法问题(issue#3241@Github)
|
||||||
|
@ -2,6 +2,7 @@ package cn.hutool.cache.impl;
|
|||||||
|
|
||||||
import cn.hutool.cache.Cache;
|
import cn.hutool.cache.Cache;
|
||||||
import cn.hutool.cache.CacheListener;
|
import cn.hutool.cache.CacheListener;
|
||||||
|
import cn.hutool.core.exceptions.ExceptionUtil;
|
||||||
import cn.hutool.core.lang.func.Func0;
|
import cn.hutool.core.lang.func.Func0;
|
||||||
import cn.hutool.core.lang.mutable.Mutable;
|
import cn.hutool.core.lang.mutable.Mutable;
|
||||||
import cn.hutool.core.lang.mutable.MutableObj;
|
import cn.hutool.core.lang.mutable.MutableObj;
|
||||||
@ -120,7 +121,9 @@ public abstract class AbstractCache<K, V> implements Cache<K, V> {
|
|||||||
try {
|
try {
|
||||||
v = supplier.call();
|
v = supplier.call();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
// issue#I7RJZT 运行时异常不做包装
|
||||||
|
throw ExceptionUtil.wrapRuntime(e);
|
||||||
|
//throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
put(key, v, this.timeout);
|
put(key, v, this.timeout);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package cn.hutool.cache.impl;
|
package cn.hutool.cache.impl;
|
||||||
|
|
||||||
import cn.hutool.cache.Cache;
|
import cn.hutool.cache.Cache;
|
||||||
|
import cn.hutool.core.exceptions.ExceptionUtil;
|
||||||
import cn.hutool.core.lang.func.Func0;
|
import cn.hutool.core.lang.func.Func0;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
@ -60,7 +61,7 @@ public class NoCache<K, V> implements Cache<K, V> {
|
|||||||
try {
|
try {
|
||||||
return (null == supplier) ? null : supplier.call();
|
return (null == supplier) ? null : supplier.call();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw ExceptionUtil.wrapRuntime(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -531,7 +531,7 @@ public class IoUtil extends NioUtil {
|
|||||||
int i = in.available();
|
int i = in.available();
|
||||||
return readHex(in, Math.min(8192, in.available()), false);
|
return readHex(in, Math.min(8192, in.available()), false);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new IORuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package cn.hutool.core.lang;
|
|||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.collection.EnumerationIter;
|
import cn.hutool.core.collection.EnumerationIter;
|
||||||
|
import cn.hutool.core.exceptions.ExceptionUtil;
|
||||||
import cn.hutool.core.io.FileUtil;
|
import cn.hutool.core.io.FileUtil;
|
||||||
import cn.hutool.core.io.IORuntimeException;
|
import cn.hutool.core.io.IORuntimeException;
|
||||||
import cn.hutool.core.io.resource.ResourceUtil;
|
import cn.hutool.core.io.resource.ResourceUtil;
|
||||||
@ -398,7 +399,7 @@ public class ClassScanner implements Serializable {
|
|||||||
classesOfLoadError.add(className);
|
classesOfLoadError.add(className);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
if (false == this.ignoreLoadError) {
|
if (false == this.ignoreLoadError) {
|
||||||
throw new RuntimeException(e);
|
throw ExceptionUtil.wrapRuntime(e);
|
||||||
} else {
|
} else {
|
||||||
classesOfLoadError.add(className);
|
classesOfLoadError.add(className);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package cn.hutool.core.lang;
|
package cn.hutool.core.lang;
|
||||||
|
|
||||||
import cn.hutool.core.collection.TransIter;
|
import cn.hutool.core.collection.TransIter;
|
||||||
|
import cn.hutool.core.exceptions.ExceptionUtil;
|
||||||
import cn.hutool.core.lang.func.Func0;
|
import cn.hutool.core.lang.func.Func0;
|
||||||
import cn.hutool.core.lang.mutable.Mutable;
|
import cn.hutool.core.lang.mutable.Mutable;
|
||||||
import cn.hutool.core.lang.mutable.MutableObj;
|
import cn.hutool.core.lang.mutable.MutableObj;
|
||||||
@ -110,7 +111,7 @@ public class SimpleCache<K, V> implements Iterable<Map.Entry<K, V>>, Serializabl
|
|||||||
try {
|
try {
|
||||||
v = supplier.call();
|
v = supplier.call();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw ExceptionUtil.wrapRuntime(e);
|
||||||
}
|
}
|
||||||
put(key, v);
|
put(key, v);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package cn.hutool.core.lang.func;
|
package cn.hutool.core.lang.func;
|
||||||
|
|
||||||
|
import cn.hutool.core.exceptions.ExceptionUtil;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -37,7 +39,7 @@ public interface Func<P, R> extends Serializable {
|
|||||||
try {
|
try {
|
||||||
return call(parameters);
|
return call(parameters);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw ExceptionUtil.wrapRuntime(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package cn.hutool.core.lang.func;
|
package cn.hutool.core.lang.func;
|
||||||
|
|
||||||
|
import cn.hutool.core.exceptions.ExceptionUtil;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -33,7 +35,7 @@ public interface Func0<R> extends Serializable {
|
|||||||
try {
|
try {
|
||||||
return call();
|
return call();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw ExceptionUtil.wrapRuntime(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package cn.hutool.core.lang.func;
|
package cn.hutool.core.lang.func;
|
||||||
|
|
||||||
|
import cn.hutool.core.exceptions.ExceptionUtil;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -37,7 +39,7 @@ public interface Func1<P, R> extends Serializable {
|
|||||||
try {
|
try {
|
||||||
return call(parameter);
|
return call(parameter);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw ExceptionUtil.wrapRuntime(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package cn.hutool.core.lang.func;
|
package cn.hutool.core.lang.func;
|
||||||
|
|
||||||
|
import cn.hutool.core.exceptions.ExceptionUtil;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -35,7 +37,7 @@ public interface VoidFunc<P> extends Serializable {
|
|||||||
try {
|
try {
|
||||||
call(parameters);
|
call(parameters);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw ExceptionUtil.wrapRuntime(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package cn.hutool.core.lang.func;
|
package cn.hutool.core.lang.func;
|
||||||
|
|
||||||
|
import cn.hutool.core.exceptions.ExceptionUtil;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -31,7 +33,7 @@ public interface VoidFunc0 extends Serializable {
|
|||||||
try {
|
try {
|
||||||
call();
|
call();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw ExceptionUtil.wrapRuntime(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package cn.hutool.core.lang.func;
|
package cn.hutool.core.lang.func;
|
||||||
|
|
||||||
|
import cn.hutool.core.exceptions.ExceptionUtil;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -33,7 +35,7 @@ public interface VoidFunc1<P> extends Serializable {
|
|||||||
try {
|
try {
|
||||||
call(parameter);
|
call(parameter);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw ExceptionUtil.wrapRuntime(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package cn.hutool.db.sql;
|
package cn.hutool.db.sql;
|
||||||
|
|
||||||
import cn.hutool.core.collection.ArrayIter;
|
import cn.hutool.core.collection.ArrayIter;
|
||||||
|
import cn.hutool.core.exceptions.ExceptionUtil;
|
||||||
import cn.hutool.core.lang.func.Func1;
|
import cn.hutool.core.lang.func.Func1;
|
||||||
import cn.hutool.db.DbUtil;
|
import cn.hutool.db.DbUtil;
|
||||||
import cn.hutool.db.StatementUtil;
|
import cn.hutool.db.StatementUtil;
|
||||||
@ -299,7 +300,7 @@ public class SqlExecutor {
|
|||||||
if(e instanceof SQLException){
|
if(e instanceof SQLException){
|
||||||
throw (SQLException) e;
|
throw (SQLException) e;
|
||||||
}
|
}
|
||||||
throw new RuntimeException(e);
|
throw ExceptionUtil.wrapRuntime(e);
|
||||||
} finally {
|
} finally {
|
||||||
DbUtil.close(ps);
|
DbUtil.close(ps);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package cn.hutool.extra.ftp;
|
package cn.hutool.extra.ftp;
|
||||||
|
|
||||||
import cn.hutool.core.io.FileUtil;
|
import cn.hutool.core.io.FileUtil;
|
||||||
|
import cn.hutool.core.io.IORuntimeException;
|
||||||
import cn.hutool.core.io.IoUtil;
|
import cn.hutool.core.io.IoUtil;
|
||||||
import cn.hutool.core.lang.Console;
|
import cn.hutool.core.lang.Console;
|
||||||
import cn.hutool.extra.ssh.Sftp;
|
import cn.hutool.extra.ssh.Sftp;
|
||||||
@ -108,7 +109,7 @@ public class FtpTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new IORuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package cn.hutool.poi.excel;
|
package cn.hutool.poi.excel;
|
||||||
|
|
||||||
|
import cn.hutool.core.io.IORuntimeException;
|
||||||
import cn.hutool.poi.excel.cell.CellUtil;
|
import cn.hutool.poi.excel.cell.CellUtil;
|
||||||
import org.apache.poi.ss.usermodel.Cell;
|
import org.apache.poi.ss.usermodel.Cell;
|
||||||
import org.apache.poi.ss.usermodel.Row;
|
import org.apache.poi.ss.usermodel.Row;
|
||||||
@ -42,7 +43,7 @@ public class IssueI6MBS5Test {
|
|||||||
CellUtil.setComment(cell, "commonText", "ascend", null);
|
CellUtil.setComment(cell, "commonText", "ascend", null);
|
||||||
workbook.write(Files.newOutputStream(file.toPath()));
|
workbook.write(Files.newOutputStream(file.toPath()));
|
||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new IORuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user