From 1ad84ed8d7c940b455239c65456bf417a667576c Mon Sep 17 00:00:00 2001 From: Nate Chadwick <263952448+natechadwick-intsof@users.noreply.github.com> Date: Tue, 8 Sep 2026 09:45:01 -0400 Subject: [PATCH] fix(calendar): PSCalendarMonthModel.getEvents returns null per documented contract The JavaDoc on `getEvents(int)` states the method returns null when no events have been set or no events occur on the specified day. In practice the second case was broken: when `setEvents(...)` was called with a non-empty list and the requested day had no events, the method returned an empty collection instead of null. This caused `PSCalendarMonthModelTest.testEmptyEvents` to fail with: java.lang.AssertionError: expected null, but was:<[]> Normalize the return value in `getEvents` so an empty result becomes null, and correct the JavaDoc (the original text read "or events occur on the specified day", which is nonsensical; the intended clause is "or no events occur on the specified day"). Closes #197 > Co-Authored by MiniMax Code 1.0 using MiniMax-M3 with agent mavis. --- .../fastforward/calendar/PSCalendarMonthModel.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/extensions-sfp/src/main/java/com/percussion/fastforward/calendar/PSCalendarMonthModel.java b/modules/extensions-sfp/src/main/java/com/percussion/fastforward/calendar/PSCalendarMonthModel.java index 24c71c10b..e86268095 100644 --- a/modules/extensions-sfp/src/main/java/com/percussion/fastforward/calendar/PSCalendarMonthModel.java +++ b/modules/extensions-sfp/src/main/java/com/percussion/fastforward/calendar/PSCalendarMonthModel.java @@ -166,15 +166,16 @@ public String getEnd() { * Gets the events that occur on the specified day of the month. * * @param day day of the month whose events will be returned - * @return a collection of assembled events for the specified day. will be null if no - * events have been set or events occur on the specified day + * @return a collection of assembled events for the specified day, never empty. Will be + * null if no events have been set or no events occur on the specified day. */ public Collection getEvents(int day) { if (getModel().m_eventsByDay == null) { return null; - } else { - return (Collection) getModel().m_eventsByDay.get(day); } + Collection events = + (Collection) getModel().m_eventsByDay.get(day); + return (events == null || events.isEmpty()) ? null : events; } /**