Skip to content

Conversation

@kyounghunJang
Copy link

What is the purpose of the change?

This commit adds a defensive null-check for moduleModel. If it is null, it retrieves the model explicitly using DubboBeanUtils.getModuleModel() to prevent the NullPointerException and ensure stable initialization in native builds.

fixes: #15663

Checklist

  • Make sure there is a GitHub_issue field for the change.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit-test to verify your logic correction. If the new feature or significant change is committed, please remember to add sample in dubbo samples project.
  • Make sure gitHub actions can pass. Why the workflow is failing and how to fix it?

@codecov-commenter
Copy link

codecov-commenter commented Oct 15, 2025

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 61.07%. Comparing base (dea0206) to head (3a5d795).

Files with missing lines Patch % Lines
.../config/spring/reference/ReferenceBeanManager.java 0.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##                3.3   #15721   +/-   ##
=========================================
  Coverage     61.06%   61.07%           
- Complexity    11700    11709    +9     
=========================================
  Files          1924     1924           
  Lines         87086    87088    +2     
  Branches      13115    13116    +1     
=========================================
+ Hits          53182    53186    +4     
  Misses        28460    28460           
+ Partials       5444     5442    -2     
Flag Coverage Δ
integration-tests-java21 32.83% <0.00%> (-0.02%) ⬇️
integration-tests-java8 33.09% <0.00%> (+0.14%) ⬆️
samples-tests-java21 32.66% <0.00%> (+0.08%) ⬆️
samples-tests-java8 30.35% <0.00%> (+0.01%) ⬆️
unit-tests-java11 59.03% <0.00%> (+<0.01%) ⬆️
unit-tests-java17 58.76% <0.00%> (-0.01%) ⬇️
unit-tests-java21 58.79% <0.00%> (-0.01%) ⬇️
unit-tests-java8 59.03% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@FoghostCn FoghostCn requested a review from Copilot October 16, 2025 02:20
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds a defensive null-check and fallback retrieval of moduleModel in ReferenceBeanManager.initReferenceBean to prevent NullPointerException during native builds.

  • Adds a null-check for moduleModel and falls back to DubboBeanUtils.getModuleModel(applicationContext)
  • Continues with reference registration using the resolved moduleModel

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

This commit adds a defensive null-check for `moduleModel`. If it is null, it retrieves the model explicitly using `DubboBeanUtils.getModuleModel()` to prevent the `NullPointerException` and ensure stable initialization in native builds.

fixes: apache#15663
Signed-off-by: Kyounghoon Jang <[email protected]>
for (ReferenceBean referenceBean : getReferences()) {
initReferenceBean(referenceBean);
}
// add a null check for moduleModel to be compatible with the native environment
Copy link
Contributor

@zrlw zrlw Oct 19, 2025

Choose a reason for hiding this comment

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

It is inappropriate to check moduleModel at here, and you should not use force-push before you know what you do.

Copy link
Contributor

Choose a reason for hiding this comment

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

lazy getting moduleModel at prepareReferenceBeans might be better.
#15663 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] moduleModel is null after native building

3 participants