So I’ve run into a strange issue. In my database I have a record with a timestamp “2018-03-11 02:21:00”. And when I use cfquery to to retrieve a dataset containing this record, I get the following error:
lucee.runtime.exp.NativeException: HOUR_OF_DAY: 2 -> 3
at java.util.GregorianCalendar.computeTime(GregorianCalendar.java:2829)
at java.util.Calendar.updateTime(Calendar.java:3393)
at java.util.Calendar.getTimeInMillis(Calendar.java:1782)
at com.mysql.cj.jdbc.io.JdbcTimestampValueFactory.createFromTimestamp(JdbcTimestampValueFactory.java:92)
at com.mysql.cj.jdbc.io.JdbcTimestampValueFactory.createFromTimestamp(JdbcTimestampValueFactory.java:39)
at com.mysql.cj.core.io.BaseDecoratingValueFactory.createFromTimestamp(BaseDecoratingValueFactory.java:54)
at com.mysql.cj.core.io.BaseDecoratingValueFactory.createFromTimestamp(BaseDecoratingValueFactory.java:54)
at com.mysql.cj.core.io.MysqlTextValueDecoder.decodeTimestamp(MysqlTextValueDecoder.java:177)
at com.mysql.cj.mysqla.result.AbstractResultsetRow.decodeAndCreateReturnValue(AbstractResultsetRow.java:67)
at com.mysql.cj.mysqla.result.AbstractResultsetRow.getValueFromBytes(AbstractResultsetRow.java:225)
at com.mysql.cj.mysqla.result.ByteArrayRow.getValue(ByteArrayRow.java:78)
at com.mysql.cj.jdbc.result.ResultSetImpl.getNonStringValueFromRow(ResultSetImpl.java:658)
at com.mysql.cj.jdbc.result.ResultSetImpl.getDateOrTimestampValueFromRow(ResultSetImpl.java:671)
at com.mysql.cj.jdbc.result.ResultSetImpl.getTimestamp(ResultSetImpl.java:981)
at lucee.runtime.query.caster.TimestampCast.toCFType(TimestampCast.java:34)
at lucee.runtime.type.QueryImpl.fillResult(QueryImpl.java:473)
at lucee.runtime.type.QueryImpl.execute(QueryImpl.java:288)
at lucee.runtime.type.QueryImpl.<init>(QueryImpl.java:224)
at lucee.runtime.tag.Query.executeDatasoure(Query.java:951)
at lucee.runtime.tag.Query.doEndTag(Query.java:700)
at ...
After some research, I came across this StackOverflow post (java - Weird IllegalArgumentException in Calendar.getTime() - Stack Overflow) that leads me to believe that it is exactly because of Daylight Savings Time that I’m getting this, as that record exists during a time that was technically skipped over on Sunday, March 11 2018 due to Daylight Savings Time.
Is there any way to avoid throwing this error? The S.O post mentions to use Calendar.setLenient(true), but I don’t seem to have that low level of control over Lucee’s date parsing.
Thanks in advance.
EDIT #1: Including relevant sys info
Lucee 5.2.6.59
MySql Extension 8.0.9
Windows 10 Pro Version 1709, build 16299.309
Java 1.8.0_161