Getting error "HOUR_OF_DAY: 2 -> 3" when running a MySQL query


#1

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 (https://stackoverflow.com/questions/22351680/weird-illegalargumentexception-in-calendar-gettime) 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


#2

please always include version number for lucee, extensions, os and db when asking questions


#3

I apologize,

Lucee 5.2.6.59
MySql Extension 8.0.9
Windows 10 Pro Version 1709, build 16299.309
Java 1.8.0_161


#4

could you try the latest 5.2.7.4x snapshot?


#5

Just tried the 5.2.7.44-SNAPSHOT and I’m still getting the error.


#6

Are the Lucee Admin timezone and Windows 10 timezone the same?


#7

I have also seen this error, in 5.3.2.47-SNAPSHOT

It seemed to start after I set Legacy Datetime Code to false on one particular datasource, trying to debug a date issue in Hibernate. The site in question is now broken on pages that include a date query even after putting that back. Trying to debug that now.

Changing that value seems to have inserted ‘&serverTimezone=America/New_York’ into the connection string, which could not be removed by changing the timezone. This was apparently breaking the database connection. I had to edit the datasource in lucee-server.xml to get rid of it.