Copilot commented on code in PR #11314:
URL: https://github.com/apache/cloudstack/pull/11314#discussion_r2329945313


##########
server/src/main/java/org/apache/cloudstack/vm/schedule/VMScheduleManagerImpl.java:
##########
@@ -234,7 +240,13 @@ public VMScheduleResponse 
updateSchedule(UpdateVMScheduleCmd cmd) {
             startDate = Date.from(DateUtil.getZoneDateTime(cmdStartDate, 
timeZone.toZoneId()).toInstant());
         }
 
-        validateStartDateEndDate(Objects.requireNonNullElse(startDate, 
DateUtils.addMinutes(new Date(), 1)), endDate, timeZone);
+        if (ObjectUtils.anyNotNull(cmdStartDate, cmdEndDate, cmdTimeZone) &&

Review Comment:
   The condition logic is flawed. The validation should trigger when ANY 
time-related parameter is provided OR when ANY time value has changed, but 
currently it requires BOTH conditions to be true. This means if only 
`cmdTimeZone` is provided but values haven't changed, validation won't occur. 
Consider using OR (||) instead of AND (&&) between the two main conditions.
   ```suggestion
           if (ObjectUtils.anyNotNull(cmdStartDate, cmdEndDate, cmdTimeZone) ||
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to