Coldfusion or Java Leap Year Error?

View: New views
2 Messages — Rating Filter:   Alert me  

Coldfusion or Java Leap Year Error?

by Les Schmidt :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have a CF application that collects data every 5 minutes from a weather station and many other devices at my home.  At about 4pm PST today (2/29), or midnight GMT on 3/1 , and for all of the 5 minute intervals thereafter, the web page that displays  data for today vs. the same time yesterday stopped working.  The error was:

Query Of Queries runtime error. Comparison exception while executing =.
Query Of Queries runtime error.
Type cast exception: Failed to cast object of type java.lang.String to java.util.Date.

The specific query is looking for a recorddate (formatted as 'm/d H:m') is:
<cfquery dbtype="query" name="yesterdayData">
        SELECT RecordDate,RecordTime,Rain24HR
  FROM masterData
  WHERE '#yRecordDate#'= recordDate
</cfquery>

If somehow GMT is at play (and I don't understand how or why, because now() correctly reports local time), then the WHERE clause would have been looking for a recordDate of '2/29 16:00' when it stopped working.

I've searched all over and found a reference to a CF error.
http://www.flatpackedworld.co.uk/blog/index.cfm/2008/2/28/Coldfusion-possible-Leap-Year-bug

Because the query has worked continuously every 5 minutes for > 3 years, I'm suspecting that leap year is having a hand in causing this error.  Any suggestions?  possible solutions?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: http://www.houseoffusion.com/groups/java/message.cfm/messageid:5622
Subscription: http://www.houseoffusion.com/groups/java/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.40

RE: Coldfusion or Java Leap Year Error?

by Charlie Arehart-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Les, I'm curious if you've just outputted the value of the variable to see
what's being used for the comparison. It seems from what you're writing that
you're guessing at it, so simply outputting it to know for sure may give you
your answer.

Also, though it may not be related, I'll say it seems odd to see you doing
your comparison with the column on the right. That's not typical, though
it's reasonable to assume that a SQL engine wouldn't care. Still, while we
could/should hope that the CF query of query engine has been designed to
handle it, perhaps it has an issue in some situations. That's a total wild
stab in the dark and perhaps not an issue at all (I realize you're saying
it's worked fine for 3 years.) Again, that's why it would be all the more
helpful to see the data being compared.

Finally, if these don't help or you get no other answers, I'll suggest that
you may want to raise your question on cf-talk or some other general
interest CF list. What you've raised here isn't really a java problem. The
reference to Java in your message is just because CF runs atop Java, and
under the cover all datatypes are in fact java data types.

Hope something there's helpful.

/charlie


-----Original Message-----
From: Les Schmidt [mailto:les242non@...]
Sent: Sunday, December 28, 2008 5:23 PM
To: java
Subject: Coldfusion or Java Leap Year Error?

I have a CF application that collects data every 5 minutes from a weather
station and many other devices at my home.  At about 4pm PST today (2/29),
or midnight GMT on 3/1 , and for all of the 5 minute intervals thereafter,
the web page that displays  data for today vs. the same time yesterday
stopped working.  The error was:

Query Of Queries runtime error. Comparison exception while executing =.
Query Of Queries runtime error.
Type cast exception: Failed to cast object of type java.lang.String to
java.util.Date.

The specific query is looking for a recorddate (formatted as 'm/d H:m') is:
<cfquery dbtype="query" name="yesterdayData">
        SELECT RecordDate,RecordTime,Rain24HR
  FROM masterData
  WHERE '#yRecordDate#'= recordDate
</cfquery>

If somehow GMT is at play (and I don't understand how or why, because now()
correctly reports local time), then the WHERE clause would have been looking
for a recordDate of '2/29 16:00' when it stopped working.

I've searched all over and found a reference to a CF error.
http://www.flatpackedworld.co.uk/blog/index.cfm/2008/2/28/Coldfusion-possibl
e-Leap-Year-bug

Because the query has worked continuously every 5 minutes for > 3 years, I'm
suspecting that leap year is having a hand in causing this error.  Any
suggestions?  possible solutions?



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: http://www.houseoffusion.com/groups/java/message.cfm/messageid:5624
Subscription: http://www.houseoffusion.com/groups/java/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.40