When using the TriggerBuilder class to build a CalendarIntervalTrigger with an end time that is in the past, an IllegalArgumentException is thrown indicating that end time cannot be before the start time, even though that is not the case.
TriggerBuilder<CalendarIntervalTrigger> tb =
java.lang.IllegalArgumentException: End time cannot be before start time
Note that the start time here is "2004-11-20" and the end time here is "2005-11-20" and so should not result in this exception.
It appears that the default start time for CalendarIntervalTrigger is "now" or more precisely the instant when getStartTime() is first accessed. Given this behavior, if an end time in the past is set before setting a start time, then this end time is compared with "now" and the above described exception is thrown. So, in order to be able to set a past end time on this trigger, the start time needs to be set first. But the TriggerBuilder.build() method sets the end time before the start time. So the fix is to modify TriggerBuilder.build() to set the start time for a trigger first before setting its end time.