New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bugfix: fix ReflectionUtil throw unexpected exception #3803
bugfix: fix ReflectionUtil throw unexpected exception #3803
Conversation
… once, when the underlying method throws an exception and the super class has the method too
ReflectionUtil.invokeMethod
, the method will be called multiple times, if the method throws an exception and the superclass also has the methodReflectionUtil.invokeMethod
, the method will be called multiple times and the method exception was lost, if the method throws an exception and the superclass also has the method
Codecov Report
@@ Coverage Diff @@
## develop #3803 +/- ##
=============================================
- Coverage 40.72% 40.65% -0.07%
- Complexity 3005 3032 +27
=============================================
Files 676 677 +1
Lines 22660 22745 +85
Branches 2814 2831 +17
=============================================
+ Hits 9228 9247 +19
- Misses 12581 12633 +52
- Partials 851 865 +14
|
ReflectionUtil.invokeMethod
, the method will be called multiple times and the method exception was lost, if the method throws an exception and the superclass also has the methodReflectionUtil.invokeMethod
, the method will be invoke multiple times and the method exception was lost, if the method throws an exception and the superclass also has the method
// remove un_used fields | ||
fieldList.removeIf(field -> field.getName().contains("$")); | ||
// remove the static or synthetic fields | ||
fieldList.removeIf(f -> Modifier.isStatic(f.getModifiers()) || f.isSynthetic()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
review提示:
当前方法不应该读取静态字段,以及java自己生成的字段。
…ix-ReflectionUtil.invokeMethod # Conflicts: # common/src/main/java/io/seata/common/util/StringUtils.java # common/src/test/java/io/seata/common/util/StringUtilsTest.java
ReflectionUtil.invokeMethod
, the method will be invoke multiple times and the method exception was lost, if the method throws an exception and the superclass also has the methodReflectionUtil.invokeMethod
will be invoke method multiple times, and fix the exception was lost when the method throws an exception
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…Method' into bugfix/fix-ReflectionUtil.invokeMethod
…pports to the `Array object` cause.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
ReflectionUtil.invokeMethod
will be invoke method multiple times, and fix the exception was lost when the method throws an exception
bugfix:
fix
ReflectionUtil.invokeMethod
will be invoke method multiple times, and fix the exception was lost when the method throws an exception错误修复:
修复
ReflectionUtil.invokeMethod
方法的两个异常case:NoSuchMethodException
异常(预期:应该抛出包装了业务异常的
InvocationTargetException
异常)1)业务方法抛出异常
2)业务类的
superClass
也有该方法。其他优化:
ReflectionUtil
工具类的代码。BUG的根本原因:
InvocationTargetException
异常处理不当。bug-1 复现代码:
bug-2 复现代码: