quartz-scheduler / quartz

Code for Quartz Scheduler
http://www.quartz-scheduler.org
Apache License 2.0
6.17k stars 1.91k forks source link

SimplePropertiesTriggerPersistenceDelegateSupport incorrectly loads properties of type `long` #1140

Open kirmerzlikin opened 3 weeks ago

kirmerzlikin commented 3 weeks ago

When loading extended trigger properties, SimplePropertiesTriggerPersistenceDelegateSupport loads properties of type long as ints:

https://github.com/quartz-scheduler/quartz/blob/a5c4d27e963f51097f9b2777489d310a88897ca4/quartz/src/main/java/org/quartz/impl/jdbcjobstore/SimplePropertiesTriggerPersistenceDelegateSupport.java#L162-L163

This leads to an exception, when values exceed the max value of int:

Couldn't retrieve trigger: Invalid data conversion: requested conversion would result in a loss of precision of 9223372036854775807
org.quartz.JobPersistenceException: Couldn't retrieve trigger: Invalid data conversion: requested conversion would result in a loss of precision of 9223372036854775807 [See nested exception: java.sql.SQLDataException: Invalid data conversion: requested conversion would result in a loss of precision of 9223372036854775807]
    at app//org.quartz.impl.jdbcjobstore.JobStoreSupport.retrieveTrigger(JobStoreSupport.java:1539)
    at app//org.quartz.impl.jdbcjobstore.JobStoreSupport$12.execute(JobStoreSupport.java:1527)
    at app//org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3864)
    at app//org.quartz.impl.jdbcjobstore.JobStoreTX.executeInLock(JobStoreTX.java:95)
    at app//org.quartz.impl.jdbcjobstore.JobStoreSupport.executeWithoutLock(JobStoreSupport.java:3800)
    at app//org.quartz.impl.jdbcjobstore.JobStoreSupport.retrieveTrigger(JobStoreSupport.java:1524)

To fix this, SimplePropertiesTriggerPersistenceDelegateSupport needs to load these values using java.sql.ResultSet#getLong().

PS: I understand that this project seems to be abandoned (#1134), so I'm reporting this for posterity's sake.

lprimak commented 2 weeks ago

This project is abandoned. See https://github.com/quartz-scheduler/quartz/issues/1134

kirmerzlikin commented 2 weeks ago

@lprimak What is the point of stating something that is already mentioned in the issue description?