Repository navigation
Fix listTemplates NPE for External templates - #14340
DaanHoogland wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 4.22 #14340 +/- ##
============================================
+ Coverage 18.34% 18.37% +0.02%
- Complexity 16679 16699 +20
============================================
Files 5940 5940
Lines 537840 537848 +8
Branches 65940 65940
============================================
+ Hits 98668 98811 +143
+ Misses 427946 427790 -156
- Partials 11226 11247 +21
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
3 open findings
The Javadoc is internally inconsistent: it says the method leaves out store-less entries, but also… · New Consider making the DAO call behavior explicit when no storeIds are provided (e.g., branch on… · New The new behavior is exercised via direct tests of the helper, but the regression risk is in the… · New
What changed in this PR
Fixes a NullPointerException encountered when listing template store entries for External/Baremetal templates that may have store_id = NULL.
Changes:
- Add filtering for store-less
TemplateDataStoreVOentries when listing template/ISO store mappings. - Introduce
TemplateDataStoreVO.hasDataStore()to safely detect whethergetDataStoreId()can be called. - Add unit tests validating store-less entries are skipped.
| File | Description |
|---|---|
| server/src/main/java/com/cloud/api/query/dao/TemplateJoinDaoImpl.java | Centralizes datastore listing and filters out store_id NULL rows to avoid NPEs downstream. |
| engine/schema/src/main/java/org/apache/cloudstack/storage/datastore/db/TemplateDataStoreVO.java | Adds hasDataStore() helper to safely detect store-less entries. |
| server/src/test/java/com/cloud/api/query/dao/TemplateJoinDaoImplTest.java | Adds tests ensuring store-less entries are excluded from results. |
🧠 Review effort: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch. |
ed9571d to
1dc34ca
Compare
|
@blueorangutan package |
|
@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 20281 |
|




Description
This PR...
fixes a NPE condition found during creating a new external hypervisor plugin.
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?