Return-Path: Delivered-To: apmail-cocoon-dev-archive@www.apache.org Received: (qmail 56575 invoked from network); 16 Feb 2006 20:00:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 16 Feb 2006 20:00:39 -0000 Received: (qmail 61173 invoked by uid 500); 16 Feb 2006 20:00:37 -0000 Delivered-To: apmail-cocoon-dev-archive@cocoon.apache.org Received: (qmail 61067 invoked by uid 500); 16 Feb 2006 20:00:35 -0000 Mailing-List: contact dev-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@cocoon.apache.org List-Id: Delivered-To: mailing list dev@cocoon.apache.org Received: (qmail 61056 invoked by uid 99); 16 Feb 2006 20:00:34 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [192.87.106.226] (HELO ajax.apache.org) (192.87.106.226) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Feb 2006 12:00:31 -0800 Received: from ajax.apache.org (ajax.apache.org [127.0.0.1]) by ajax.apache.org (Postfix) with ESMTP id 4231FDE for ; Thu, 16 Feb 2006 21:00:10 +0100 (CET) Message-ID: <1953242245.1140120010269.JavaMail.jira@ajax.apache.org> Date: Thu, 16 Feb 2006 21:00:10 +0100 (CET) From: "Antonio Gallardo (JIRA)" To: dev@cocoon.apache.org Subject: [jira] Assigned: (COCOON-1778) NPE: QuartzJobScheduler.fireJob - needs In-Reply-To: <419966808.1140038230002.JavaMail.jira@ajax.apache.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/COCOON-1778?page=all ] Antonio Gallardo reassigned COCOON-1778: ---------------------------------------- Assign To: Antonio Gallardo > NPE: QuartzJobScheduler.fireJob - needs > --------------------------------------- > > 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