mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
修复aop的afterException无法生效问题
This commit is contained in:
parent
5d8a411453
commit
7d3527bc3f
@ -2,7 +2,7 @@
|
|||||||
# 🚀Changelog
|
# 🚀Changelog
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
# 5.8.23(2023-10-08)
|
# 5.8.23(2023-10-12)
|
||||||
|
|
||||||
### 🐣新特性
|
### 🐣新特性
|
||||||
* 【json 】 改进TemporalAccessorSerializer支持dayOfMonth和month枚举名(issue#I82AM8@Gitee)
|
* 【json 】 改进TemporalAccessorSerializer支持dayOfMonth和month枚举名(issue#I82AM8@Gitee)
|
||||||
@ -14,6 +14,7 @@
|
|||||||
* 【cron 】 修复Cron表达式range解析错误问题(issue#I82CSH@Gitee)
|
* 【cron 】 修复Cron表达式range解析错误问题(issue#I82CSH@Gitee)
|
||||||
* 【core 】 修复VersionComparator在极端数据排序时候违反了自反性问题(issue#I81N3H@Gitee)
|
* 【core 】 修复VersionComparator在极端数据排序时候违反了自反性问题(issue#I81N3H@Gitee)
|
||||||
* 【json 】 修复JSONStrFormatter:format函数对于转义符号处理逻辑错误问题(issue#I84V6I@Gitee)
|
* 【json 】 修复JSONStrFormatter:format函数对于转义符号处理逻辑错误问题(issue#I84V6I@Gitee)
|
||||||
|
* 【core 】 修复aop的afterException无法生效问题(issue#3329@Github)
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
# 5.8.22(2023-09-13)
|
# 5.8.22(2023-09-13)
|
||||||
|
@ -43,10 +43,14 @@ public class CglibInterceptor implements MethodInterceptor, Serializable {
|
|||||||
try {
|
try {
|
||||||
// result = proxy.invokeSuper(obj, args);
|
// result = proxy.invokeSuper(obj, args);
|
||||||
result = proxy.invoke(target, args);
|
result = proxy.invoke(target, args);
|
||||||
} catch (InvocationTargetException e) {
|
} catch (final Throwable e) {
|
||||||
|
Throwable throwable = e;
|
||||||
|
if(throwable instanceof InvocationTargetException){
|
||||||
|
throwable = ((InvocationTargetException) throwable).getTargetException();
|
||||||
|
}
|
||||||
// 异常回调(只捕获业务代码导致的异常,而非反射导致的异常)
|
// 异常回调(只捕获业务代码导致的异常,而非反射导致的异常)
|
||||||
if (aspect.afterException(target, method, args, e.getTargetException())) {
|
if (aspect.afterException(target, method, args, throwable)) {
|
||||||
throw e;
|
throw throwable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,9 +48,14 @@ public class SpringCglibInterceptor implements MethodInterceptor, Serializable {
|
|||||||
try {
|
try {
|
||||||
// result = proxy.invokeSuper(obj, args);
|
// result = proxy.invokeSuper(obj, args);
|
||||||
result = proxy.invoke(target, args);
|
result = proxy.invoke(target, args);
|
||||||
} catch (InvocationTargetException e) {
|
} catch (Throwable e) {
|
||||||
|
Throwable throwable = e;
|
||||||
|
if(throwable instanceof InvocationTargetException){
|
||||||
|
throwable = ((InvocationTargetException) throwable).getTargetException();
|
||||||
|
}
|
||||||
|
|
||||||
// 异常回调(只捕获业务代码导致的异常,而非反射导致的异常)
|
// 异常回调(只捕获业务代码导致的异常,而非反射导致的异常)
|
||||||
if (aspect.afterException(target, method, args, e.getTargetException())) {
|
if (aspect.afterException(target, method, args, throwable)) {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user