Skip to content

NPE thrown when acquiring next trigger due to null next fire time value #189

@Dwisf

Description

@Dwisf

During a soak testing of our application using Quartz (version 2.2.3), we notice the following exceptions being thrown from time to time:

org.quartz.core.ErrorLogger ERROR --- An error occurred while scanning for the next triggers to fire. 
java.lang.NullPointerException: null
	at org.quartz.impl.jdbcjobstore.JobStoreSupport.acquireNextTrigger(JobStoreSupport.java:2837)
	... 5 common frames omitted
Wrapped by: org.quartz.JobPersistenceException: Couldn't acquire next trigger: null
	at org.quartz.impl.jdbcjobstore.JobStoreSupport.acquireNextTrigger(JobStoreSupport.java:2864)
	at org.quartz.impl.jdbcjobstore.JobStoreSupport$40.execute(JobStoreSupport.java:2759)
	at org.quartz.impl.jdbcjobstore.JobStoreSupport$40.execute(JobStoreSupport.java:2757)
	at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3803)
	at org.quartz.impl.jdbcjobstore.JobStoreSupport.acquireNextTriggers(JobStoreSupport.java:2756)
	at org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:272)

Line 2837 of JobStoreSupport.java corresponds to the following code:

...
if (nextTrigger.getNextFireTime().getTime() > batchEnd) {
...

That is getNextFireTime() is null. The API for this method states ...If the trigger will not fire again, null will be returned. It looks like this code needs to check if getNextFireTime() is null before doing a getTime().

Is this a correct assessment?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions