Modernize java.time API usages

See gh-35861
Signed-off-by: Vincent Potucek <vpotucek@me.com>
This commit is contained in:
Vincent Potucek
2025-11-25 14:42:05 +01:00
committed by Sébastien Deleuze
parent 3686b89ab5
commit 83bbf16e6c
14 changed files with 31 additions and 32 deletions
@@ -81,8 +81,7 @@ final class DateTimeConverters {
return gc.toZonedDateTime();
}
else {
return ZonedDateTime.ofInstant(Instant.ofEpochMilli(source.getTimeInMillis()),
source.getTimeZone().toZoneId());
return Instant.ofEpochMilli(source.getTimeInMillis()).atZone(source.getTimeZone().toZoneId());
}
}
@@ -115,7 +115,7 @@ public class CronTrigger implements Trigger {
public @Nullable Instant nextExecution(TriggerContext triggerContext) {
Instant timestamp = determineLatestTimestamp(triggerContext);
ZoneId zone = (this.zoneId != null ? this.zoneId : triggerContext.getClock().getZone());
ZonedDateTime zonedTimestamp = ZonedDateTime.ofInstant(timestamp, zone);
ZonedDateTime zonedTimestamp = timestamp.atZone(zone);
ZonedDateTime nextTimestamp = this.expression.next(zonedTimestamp);
return (nextTimestamp != null ? nextTimestamp.toInstant() : null);
}