cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eric Meyer (JIRA)" <j...@apache.org>
Subject [jira] Created: (COCOON-1778) NPE: QuartzJobScheduler.fireJob - needs
Date Wed, 15 Feb 2006 21:17:10 GMT
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


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


Mime
View raw message