Bug Report
The public mentors page throws HTTP 500 if any mentor row lacks a mentee_section; the keyword filter has the same unguarded dereference.
domain/platform/mentorship/Mentor.java:166 — mentor.getMenteeSection().toDto() with no null check.
utils/FiltersUtil.java:79 — mentor.getMenteeSection().additional() unguarded (while matchesTypes at line 91 explicitly guards null).
repository/postgres/component/MentorMapper.java:55-56 only sets menteeSection when a row exists, so null is a reachable state (legacy/partial data).
Reproduction
One mentor exists without a mentee_section row → GET /api/cms/v1/mentorship/mentors throws NPE in Mentor.toDto() → unhandled 500 for the entire public mentors page.
Severity
Medium
Potential Risk
- A single malformed mentor record takes down the whole public mentors listing.
Suggested Fix
- Null-guard
getMenteeSection() in Mentor.toDto() and in FiltersUtil (mirror the guard already present in matchesTypes).
- Optionally enforce presence of
mentee_section at write time so the null state can't arise.
- Add a test rendering a mentor with a null mentee section (expect the list to render, not 500).
Bug Report
The public mentors page throws HTTP 500 if any mentor row lacks a
mentee_section; the keyword filter has the same unguarded dereference.domain/platform/mentorship/Mentor.java:166—mentor.getMenteeSection().toDto()with no null check.utils/FiltersUtil.java:79—mentor.getMenteeSection().additional()unguarded (whilematchesTypesat line 91 explicitly guards null).repository/postgres/component/MentorMapper.java:55-56only setsmenteeSectionwhen a row exists, so null is a reachable state (legacy/partial data).Reproduction
One mentor exists without a
mentee_sectionrow →GET /api/cms/v1/mentorship/mentorsthrows NPE inMentor.toDto()→ unhandled 500 for the entire public mentors page.Severity
Medium
Potential Risk
Suggested Fix
getMenteeSection()inMentor.toDto()and inFiltersUtil(mirror the guard already present inmatchesTypes).mentee_sectionat write time so the null state can't arise.