mirror of
https://gitee.com/dromara/hutool.git
synced 2025-05-06 21:58:03 +08:00
add method
This commit is contained in:
parent
db2b350684
commit
a329a1c44c
@ -3,7 +3,7 @@
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
# 5.5.2 (2020-11-25)
|
||||
# 5.5.2 (2020-11-26)
|
||||
|
||||
### 新特性
|
||||
* 【crypto 】 KeyUtil增加重载,AES构造增加重载(issue#I25NNZ@Gitee)
|
||||
@ -16,6 +16,7 @@
|
||||
* 【core 】 ZipUtil增加get方法
|
||||
* 【cache 】 对CacheObj等变量使用volatile关键字
|
||||
* 【core 】 Base64增加encodeWithoutPadding方法(issue#I26J16@Gitee)
|
||||
* 【core 】 ExceptionUtil增加message消息包装为运行时异常的方法(issue#1253@Gitee)
|
||||
|
||||
### Bug修复
|
||||
* 【cron 】 修复CronTimer可能死循环的问题(issue#1224@Github)
|
||||
|
@ -18,7 +18,6 @@ import java.util.Map;
|
||||
* 异常工具类
|
||||
*
|
||||
* @author Looly
|
||||
*
|
||||
*/
|
||||
public class ExceptionUtil {
|
||||
|
||||
@ -47,7 +46,7 @@ public class ExceptionUtil {
|
||||
|
||||
/**
|
||||
* 使用运行时异常包装编译异常<br>
|
||||
*
|
||||
* <p>
|
||||
* 如果传入参数已经是运行时异常,则直接返回,不再额外包装
|
||||
*
|
||||
* @param throwable 异常
|
||||
@ -62,19 +61,20 @@ public class ExceptionUtil {
|
||||
|
||||
/**
|
||||
* 将指定的消息包装为运行时异常
|
||||
*
|
||||
* @param message 异常消息
|
||||
* @return 运行时异常
|
||||
* @since 5.5.2
|
||||
*/
|
||||
public static RuntimeException wrapRuntime(String message){
|
||||
public static RuntimeException wrapRuntime(String message) {
|
||||
return new RuntimeException(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* 包装一个异常
|
||||
*
|
||||
* @param <T> 被包装的异常类型
|
||||
* @param throwable 异常
|
||||
* @param <T> 被包装的异常类型
|
||||
* @param throwable 异常
|
||||
* @param wrapThrowable 包装后的异常类
|
||||
* @return 包装后的异常
|
||||
* @since 3.3.0
|
||||
@ -105,10 +105,11 @@ public class ExceptionUtil {
|
||||
|
||||
/**
|
||||
* 将消息包装为运行时异常并抛出
|
||||
*
|
||||
* @param message 异常消息
|
||||
* @since 5.5.2
|
||||
*/
|
||||
public static void wrapRuntimeAndThrow(String message){
|
||||
public static void wrapRuntimeAndThrow(String message) {
|
||||
throw new RuntimeException(message);
|
||||
}
|
||||
|
||||
@ -177,7 +178,7 @@ public class ExceptionUtil {
|
||||
* 堆栈转为单行完整字符串
|
||||
*
|
||||
* @param throwable 异常对象
|
||||
* @param limit 限制最大长度
|
||||
* @param limit 限制最大长度
|
||||
* @return 堆栈转为的字符串
|
||||
*/
|
||||
public static String stacktraceToOneLineString(Throwable throwable, int limit) {
|
||||
@ -203,7 +204,7 @@ public class ExceptionUtil {
|
||||
* 堆栈转为完整字符串
|
||||
*
|
||||
* @param throwable 异常对象
|
||||
* @param limit 限制最大长度
|
||||
* @param limit 限制最大长度
|
||||
* @return 堆栈转为的字符串
|
||||
*/
|
||||
public static String stacktraceToString(Throwable throwable, int limit) {
|
||||
@ -213,8 +214,8 @@ public class ExceptionUtil {
|
||||
/**
|
||||
* 堆栈转为完整字符串
|
||||
*
|
||||
* @param throwable 异常对象
|
||||
* @param limit 限制最大长度
|
||||
* @param throwable 异常对象
|
||||
* @param limit 限制最大长度
|
||||
* @param replaceCharToStrMap 替换字符为指定字符串
|
||||
* @return 堆栈转为的字符串
|
||||
*/
|
||||
@ -249,7 +250,7 @@ public class ExceptionUtil {
|
||||
/**
|
||||
* 判断是否由指定异常类引起
|
||||
*
|
||||
* @param throwable 异常
|
||||
* @param throwable 异常
|
||||
* @param causeClasses 定义的引起异常的类
|
||||
* @return 是否由指定异常类引起
|
||||
* @since 4.1.13
|
||||
@ -262,7 +263,7 @@ public class ExceptionUtil {
|
||||
/**
|
||||
* 获取由指定异常类引起的异常
|
||||
*
|
||||
* @param throwable 异常
|
||||
* @param throwable 异常
|
||||
* @param causeClasses 定义的引起异常的类
|
||||
* @return 是否由指定异常类引起
|
||||
* @since 4.1.13
|
||||
@ -284,7 +285,7 @@ public class ExceptionUtil {
|
||||
/**
|
||||
* 判断指定异常是否来自或者包含指定异常
|
||||
*
|
||||
* @param throwable 异常
|
||||
* @param throwable 异常
|
||||
* @param exceptionClass 定义的引起异常的类
|
||||
* @return true 来自或者包含
|
||||
* @since 4.3.2
|
||||
@ -296,9 +297,9 @@ public class ExceptionUtil {
|
||||
/**
|
||||
* 判断指定异常是否来自或者包含指定异常
|
||||
*
|
||||
* @param throwable 异常
|
||||
* @param throwable 异常
|
||||
* @param exceptionClass 定义的引起异常的类
|
||||
* @param checkCause 判断cause
|
||||
* @param checkCause 判断cause
|
||||
* @return true 来自或者包含
|
||||
* @since 4.4.1
|
||||
*/
|
||||
@ -309,8 +310,8 @@ public class ExceptionUtil {
|
||||
/**
|
||||
* 转化指定异常为来自或者包含指定异常
|
||||
*
|
||||
* @param <T> 异常类型
|
||||
* @param throwable 异常
|
||||
* @param <T> 异常类型
|
||||
* @param throwable 异常
|
||||
* @param exceptionClass 定义的引起异常的类
|
||||
* @return 结果为null 不是来自或者包含
|
||||
* @since 4.3.2
|
||||
@ -322,10 +323,10 @@ public class ExceptionUtil {
|
||||
/**
|
||||
* 转化指定异常为来自或者包含指定异常
|
||||
*
|
||||
* @param <T> 异常类型
|
||||
* @param throwable 异常
|
||||
* @param <T> 异常类型
|
||||
* @param throwable 异常
|
||||
* @param exceptionClass 定义的引起异常的类
|
||||
* @param checkCause 判断cause
|
||||
* @param checkCause 判断cause
|
||||
* @return 结果为null 不是来自或者包含
|
||||
* @since 4.4.1
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user