-
Notifications
You must be signed in to change notification settings - Fork 26.5k
fix(native): Resolve NullPointerException in ReferenceBeanManager #15721
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
base: 3.3
Are you sure you want to change the base?
Conversation
256d248 to
b887d18
Compare
Codecov Report❌ Patch coverage is
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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
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.
...nfig-spring/src/main/java/org/apache/dubbo/config/spring/reference/ReferenceBeanManager.java
Outdated
Show resolved
Hide resolved
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]>
d00c168 to
8e609cd
Compare
| for (ReferenceBean referenceBean : getReferences()) { | ||
| initReferenceBean(referenceBean); | ||
| } | ||
| // add a null check for moduleModel to be compatible with the native environment |
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.
It is inappropriate to check moduleModel at here, and you should not use force-push before you know what you do.
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.
lazy getting moduleModel at prepareReferenceBeans might be better.
#15663 (comment)
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 usingDubboBeanUtils.getModuleModel()to prevent theNullPointerExceptionand ensure stable initialization in native builds.fixes: #15663
Checklist