Skip to content
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 getConfig throw ClassCastException when use JDK proxy #5239

Merged
merged 35 commits into from
Jan 29, 2023

Conversation

wangliang181230
Copy link
Contributor

@wangliang181230 wangliang181230 commented Jan 9, 2023

  • I have registered the PR changes.

Ⅰ. Describe what this PR did

bugfix: fix getConfig throw ClassCastException when use JDK proxy, and optimize some log.
BUG修复:修复当使用JDK代理时,getConfig 方法获取部分配置时抛出 ClassCastException 异常的问题,另外顺便优化了几处日志。

注:在 PR #5234 中,有两处代理将使用JDK代理,因为 native-image 对其他代理的支持比较差。

Ⅱ. Does this pull request fix one issue?

Ⅲ. Why don't you add test cases (unit test/integration test)?

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

主要review一下 SpringBootConfigurationProvider 的代码变更,其他类的变更都很小。

@wangliang181230 wangliang181230 requested review from slievrly and funky-eyes and removed request for slievrly January 9, 2023 02:38
@wangliang181230 wangliang181230 changed the title bugfix: fix getConfig throw CastException bugfix: fix getConfig throw ClassCastException Jan 9, 2023
@codecov-commenter
Copy link

codecov-commenter commented Jan 9, 2023

Codecov Report

Merging #5239 (a4661a9) into develop (63f685e) will decrease coverage by 0.15%.
The diff coverage is 34.64%.

❗ Current head a4661a9 differs from pull request most recent head 58c0d28. Consider uploading reports for the commit 58c0d28 to get more accurate results

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Impacted file tree graph

@@              Coverage Diff              @@
##             develop    #5239      +/-   ##
=============================================
- Coverage      48.85%   48.70%   -0.15%     
+ Complexity      4165     4156       -9     
=============================================
  Files            743      743              
  Lines          26536    26588      +52     
  Branches        3301     3320      +19     
=============================================
- Hits           12964    12951      -13     
- Misses         12164    12239      +75     
+ Partials        1408     1398      -10     
Impacted Files Coverage Δ
...n/src/main/java/io/seata/common/DefaultValues.java 0.00% <ø> (ø)
...main/java/io/seata/common/util/ReflectionUtil.java 58.24% <0.00%> (-7.20%) ⬇️
...a/io/seata/sqlparser/druid/DefaultDruidLoader.java 50.00% <ø> (ø)
...gure/provider/SpringBootConfigurationProvider.java 20.00% <18.36%> (-30.00%) ⬇️
...ain/java/io/seata/config/ConfigurationFactory.java 56.71% <25.00%> (-1.75%) ⬇️
.../io/seata/common/loader/EnhancedServiceLoader.java 57.32% <36.84%> (-0.86%) ⬇️
...in/java/io/seata/rm/datasource/util/JdbcUtils.java 9.15% <50.00%> (+0.03%) ⬆️
...ta/spring/annotation/GlobalTransactionScanner.java 30.65% <50.00%> (ø)
...ource/sql/struct/cache/AbstractTableMetaCache.java 85.29% <57.14%> (-7.81%) ⬇️
.../main/java/io/seata/config/ConfigurationCache.java 74.07% <75.00%> (ø)
... and 13 more

Copy link
Member

@slievrly slievrly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wangliang181230 wangliang181230 added type: bug Category issues or prs related to bug. module/config config module labels Jan 28, 2023
@wangliang181230 wangliang181230 changed the title bugfix: fix getConfig throw ClassCastException bugfix: fix getConfig throw ClassCastException, and optimize some log Jan 29, 2023
@wangliang181230 wangliang181230 changed the title bugfix: fix getConfig throw ClassCastException, and optimize some log bugfix: fix getConfig throw ClassCastException on native-image, and optimize some log Jan 29, 2023
@wangliang181230 wangliang181230 changed the title bugfix: fix getConfig throw ClassCastException on native-image, and optimize some log bugfix: fix getConfig throw ClassCastException when use jdk proxy, and optimize some log Jan 29, 2023
Copy link
Member

@xingfudeshi xingfudeshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wangliang181230 wangliang181230 changed the title bugfix: fix getConfig throw ClassCastException when use jdk proxy, and optimize some log bugfix: fix getConfig throw ClassCastException when use JDK proxy, and optimize some log Jan 29, 2023
@slievrly slievrly self-requested a review January 29, 2023 09:49
@slievrly slievrly changed the title bugfix: fix getConfig throw ClassCastException when use JDK proxy, and optimize some log bugfix: fix getConfig throw ClassCastException when use JDK proxy Jan 29, 2023
try {
result = getDefaultValueFromPropertyObject(dataId);
} catch (Throwable t) {
LOGGER.error("Get config '{}' default value from the property object failed:", dataId, t);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the previous configuration priority, the priority of the value object is greater than the default value priority of the parameter

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The object is no longer a spring bean, so I think the priority is no longer higher than the arguments.

Copy link
Member

@slievrly slievrly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@slievrly slievrly merged commit 72347f2 into apache:develop Jan 29, 2023
@wangliang181230 wangliang181230 deleted the optimize-getConfig branch January 29, 2023 12:22
@wangliang181230 wangliang181230 added this to the 1.7.0 milestone Feb 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module/config config module type: bug Category issues or prs related to bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants