Skip to content

#13754 - Fixed NPE when date of diagnosis is not provided#13871

Merged
raulbob merged 2 commits intodevelopmentfrom
bugfix-13754-npe_diagnosis_date
Mar 9, 2026
Merged

#13754 - Fixed NPE when date of diagnosis is not provided#13871
raulbob merged 2 commits intodevelopmentfrom
bugfix-13754-npe_diagnosis_date

Conversation

@raulbob
Copy link
Copy Markdown
Contributor

@raulbob raulbob commented Mar 9, 2026

Fixes a NPE when the date of diagnosis is not filled in the create notification dialog.

Summary by CodeRabbit

  • Bug Fixes
    • Improved date handling for case notifications and diagnoses: when a notification date is missing the report date will default to the current date only if not previously set; diagnostic dates are now cleared when not provided. This prevents incorrect or stale dates from being recorded and reduces processing errors.

@raulbob raulbob requested a review from KarnaiahPesula March 9, 2026 09:39
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 9, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: bc52bb43-634b-4557-b86f-0145118afa79

📥 Commits

Reviewing files that changed from the base of the PR and between ce06844 and 2e3bc53.

📒 Files selected for processing (1)
  • sormas-ui/src/main/java/de/symeda/sormas/ui/caze/notifier/CaseNotifierSideViewController.java

📝 Walkthrough

Walkthrough

Updated null-handling in updateSurveillanceReportFromForm: reportDate is set from notificationDate only when provided; if notificationDate is absent and reportDate was unset, reportDate is initialized to current date. dateOfDiagnosis is set only when diagnosticDate is non-null; otherwise it is cleared to null.

Changes

Cohort / File(s) Summary
Null-safety in CaseNotifierSideViewController
sormas-ui/src/main/java/de/symeda/sormas/ui/caze/notifier/CaseNotifierSideViewController.java
Adjusts updateSurveillanceReportFromForm: use notificationDate to set reportDate only when present; if notificationDate is null and reportDate was unset, initialize reportDate to LocalDate.now(); set dateOfDiagnosis only when diagnosticDate is non-null, otherwise clear it.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • obinna-h-n
  • KarnaiahPesula

Poem

🐇 With twitching nose and careful hop,
I set the date where none would stop.
If none arrives, today will do —
And diagnosis clears when null is true.
Hooray for code that won't go pop!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The description is minimal but directly addresses the issue. However, it lacks the required issue number reference specified in the template (Fixes #). Add the issue reference in the format 'Fixes #13754' at the beginning of the description to match the template requirements.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically identifies the main change: fixing an NPE when the date of diagnosis is not provided, which matches the core issue being addressed in the PR.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bugfix-13754-npe_diagnosis_date

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@sormas-ui/src/main/java/de/symeda/sormas/ui/caze/notifier/CaseNotifierSideViewController.java`:
- Around line 347-348: The code currently replaces surveillanceReport.reportDate
with LocalDate.now() whenever notifierForm.getNotificationDate() is null;
instead, only synthesize a fallback date if the existing
surveillanceReport.getReportDate() is also null. Change the logic around
notifierForm.getNotificationDate() and surveillanceReport.setReportDate(...) so:
if notifierForm.getNotificationDate() != null use that; else if
surveillanceReport.getReportDate() != null preserve it (do not call
setReportDate); otherwise create and set a fallback (e.g., LocalDate.now()
converted to Date). This keeps historical reportDate values unchanged when the
form returns null.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c1af22d2-cfee-4467-b5f7-035bd40e842b

📥 Commits

Reviewing files that changed from the base of the PR and between 2b09617 and ce06844.

📒 Files selected for processing (1)
  • sormas-ui/src/main/java/de/symeda/sormas/ui/caze/notifier/CaseNotifierSideViewController.java

@sormas-vitagroup
Copy link
Copy Markdown
Contributor

@sormas-vitagroup
Copy link
Copy Markdown
Contributor

@raulbob raulbob merged commit e7a0d70 into development Mar 9, 2026
7 of 10 checks passed
@raulbob raulbob deleted the bugfix-13754-npe_diagnosis_date branch March 9, 2026 19:56
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.

3 participants