You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by "Antonio Gallardo (JIRA)" <ji...@apache.org> on 2006/02/16 22:06:11 UTC
[jira] Commented: (COCOON-1778) NPE calling
QuartzJobScheduler.fireJob if the job is a CronJob
[ http://issues.apache.org/jira/browse/COCOON-1778?page=comments#action_12366682 ]
Antonio Gallardo commented on COCOON-1778:
------------------------------------------
Thanks for the patch. It was applied in 2.1.x branch and merged into 2.2 trunk.
Please cross check and close the bug.
> NPE calling QuartzJobScheduler.fireJob if the job is a CronJob
> --------------------------------------------------------------
>
> Key: COCOON-1778
> URL: http://issues.apache.org/jira/browse/COCOON-1778
> Project: Cocoon
> Type: Bug
> Components: Blocks: Cron
> Versions: 2.1.8
> Reporter: Eric Meyer
> Assignee: Antonio Gallardo
> Attachments: quartz-job-scheduler-npe-job.patch.txt, quartz-job-scheduler-npe.patch.txt
>
> calling scheduler.fireJob (for example from flow) results in an NPE if the job is a CronJob. This is because the JobExecutionContext is created without a Trigger in the TriggerFiredBundle. The constructor for JobExecutionContext requires that there be a trigger in the firebundle when it calls:
> this.jobDataMap.putAll(trigger.getJobDataMap());
> on line 139.
> Here is some sample flowscript that fires a CronJob.
> var scheduler = cocoon.getComponent(Packages.org.apache.cocoon.components.cron.JobScheduler.ROLE);
> try {
> scheduler.fireJob("someJob");
> } finally {
> cocoon.releaseComponent(scheduler);
> }
> Here is a patch (license granted to ASF):
> Index: C:/opt/eclipse-rc/eclipse/workspace/cocoon-svn/src/blocks/cron/java/org/apache/cocoon/components/cron/QuartzJobScheduler.java
> ===================================================================
> --- C:/opt/eclipse-rc/eclipse/workspace/cocoon-svn/src/blocks/cron/java/org/apache/cocoon/components/cron/QuartzJobScheduler.java (revision 376375)
> +++ C:/opt/eclipse-rc/eclipse/workspace/cocoon-svn/src/blocks/cron/java/org/apache/cocoon/components/cron/QuartzJobScheduler.java (working copy)
> @@ -704,10 +704,12 @@
>
> final JobDetail detail = createJobDetail(name, jobDataMap);
>
> - TriggerFiredBundle trigger = new TriggerFiredBundle(detail, null, null, false, null, null, null, null);
> + final Trigger trigger = new SimpleTrigger(name, DEFAULT_QUARTZ_JOB_GROUP);
>
> + TriggerFiredBundle fireBundle = new TriggerFiredBundle(detail, trigger, null, false, null, null, null, null);
> +
> final Job executor = createJobExecutor();
> - final JobExecutionContext context = new JobExecutionContext(this.scheduler, trigger, executor);
> + final JobExecutionContext context = new JobExecutionContext(this.scheduler, fireBundle, executor);
>
> this.executor.execute(new Runnable() {
> public void run() {
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira