Bug 996274

Summary: Cron scheduling expressions give red bar
Product: [Other] RHQ Project Reporter: Heiko W. Rupp <hrupp>
Component: OperationsAssignee: Nobody <nobody>
Status: NEW --- QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 4.8CC: hrupp
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Heiko W. Rupp 2013-08-12 20:07:31 UTC
Schedule an operation via cron expression.

- use an invalid expression
- use the example of " 0/5 14,18,3-39,52 * ? JAN,MAR,SEP MON-FRI 2002-2010 "

both will end up in a red bar

Server log shows

- invalid expression
- based on that data the job will never schedule ( " Caused by: org.quartz.SchedulerException: Based on configured schedule, the given trigger will never fire. " )

We need to make sure the user gets the real cause in the bar as a yellow warning

Comment 1 Heiko W. Rupp 2013-08-15 07:50:56 UTC
The Exception is thrown here:

org.rhq.enterprise.server.operation.OperationManagerBean#convertToTrigger

private Trigger convertToTrigger(JobTrigger jobTrigger) throws ParseException {
  Trigger trigger;
  if (jobTrigger.getRecurrenceType() == JobTrigger.RecurrenceType.CRON_EXPRESSION) {
    CronTrigger cronTrigger = new CronTrigger();
    try {
        cronTrigger.setCronExpression(jobTrigger.getCronExpression());  <<<- 1
    } catch (ParseException e) {
        throw new RuntimeException(e);  <<<-- 2
    } 
    trigger = cronTrigger;

And then rethrown as RuntimeException which then gets delivered to the red bar as

org.rhq.enterprise.gui.coregui.server.gwt.OperationGWTServiceImpl#getResourceOperationSchedule

via org.rhq.enterprise.gui.coregui.server.gwt.AbstractGWTServiceImpl#getExceptionToThrowToClient

I think we should somehow either pass the ParseException around, which has the disadvantage that it needs to be handled in a few more places, that even don't use cron-expressions at all.
Or in org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.schedule.ResourceOperationScheduleDataSource#executeAdd try to find that parse Exception in #onFailure() and display it accordingly.

Comment 2 Heiko W. Rupp 2013-08-15 09:29:58 UTC
Note, that you can already get the parse-exception by right-clicking on the red bar and then on "caused by"