• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Spring DST change isDate Date value passed to date function createDateTime is unspecified or invalid

New Here ,
Mar 13, 2022 Mar 13, 2022

Copy link to clipboard

Copied

A funny thing happend last night. A loop over the hours hit 2:00 and failed a createDateTime. So I added guard programming to test validity using isDate(), to skip the items in spring forward DST are not there (2:00 hour). It still failed. Apparently isDate is build on top of createdateTime, but instead of capturing it internally and returning false as it should, it throws an exception. This does not seem like the correct behavior for isDate().

Sample code:

 

 

<cfset response = isDate("3/13/2022 02:00:00")>

 

 

Date value passed to date function createDateTime is unspecified or invalid.

coldfusion.util.DateUtils$InvalidDateException: Date value passed to date function createDateTime is unspecified or invalid.
at coldfusion.util.DateUtils.createDateTime(DateUtils.java:1503)
at coldfusion.runtime.CFDateTimeParser.toDateTime(CFDateTimeParser.java:592)
at coldfusion.runtime.CFDateTimeParser.parseTime(CFDateTimeParser.java:356)
at coldfusion.runtime.CFDateTimeParser.parseTime(CFDateTimeParser.java:316)
at coldfusion.runtime.CFDateTimeParser._parseDateTime(CFDateTimeParser.java:160)
at coldfusion.runtime.CFDateTimeParser.parseDateTime(CFDateTimeParser.java:88)
at coldfusion.util.DateUtils._parseDateTime(DateUtils.java:1050)
at coldfusion.util.DateUtils.isDate(DateUtils.java:1032)
at coldfusion.runtime.CFPage.IsDate(CFPage.java:3676)
at cfgctest2ecfm1330162049.runPage(C:\ColdFusion2021\cfusion\wwwroot\testDate.cfm:1)
at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:257)
at coldfusion.tagext.lang.IncludeTag.handlePageInvoke(IncludeTag.java:749)
at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:578)
at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)
at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:605)
at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:43)
at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)
at coldfusion.filter.PathFilter.invoke(PathFilter.java:162)
at coldfusion.filter.IpFilter.invoke(IpFilter.java:45)
at coldfusion.filter.LicenseFilter.invoke(LicenseFilter.java:30)
at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:97)
at coldfusion.filter.BrowserDebugFilter.invoke(BrowserDebugFilter.java:81)
at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:60)
at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
at coldfusion.filter.CachingFilter.invoke(CachingFilter.java:62)
at coldfusion.CfmServlet.service(CfmServlet.java:232)
at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:311)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:46)
at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:47)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at coldfusion.inspect.weinre.MobileDeviceDomInspectionFilter.doFilter(MobileDeviceDomInspectionFilter.java:57)
at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:47)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:359)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:373)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1589)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:834)

 

 

Views

567

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 13, 2022 Mar 13, 2022

Copy link to clipboard

Copied

Greg, it seems this is more a statement/observation by you rather than a question, and fair enough. Perhaps someone, including Adobe, may chime in with thoughts or some workaround.

 

But I'd think it would be good if you filed this as a bug report, at tracker.adobe.com. If you do, please do share the ID number or link here, and you may want to link that to this forum post.

 

Also, it could help if you'd indicate also (here and there) what cf version and update level (as well as Java level) you're running, all reported on the cf admin settings summary page. If you're not on the latest update of your cf version or jvm, this could be a bug in one of those, since fixed. 

 

Hope that helps. 


/Charlie (troubleshooter, carehart.org)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 13, 2022 Mar 13, 2022

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 13, 2022 Mar 13, 2022

Copy link to clipboard

Copied

Joseph, since you're not Greg (but opened the ticket today and reported it here), can you clarify: do you work with him? Or are you getting the same error?

 

And you did not indicate there what Java version you're using. Again, that may be important. I see you reported being on 2021 update 3.

 

Again, Greg, hope you will clarify your cf and Java versions. 


/Charlie (troubleshooter, carehart.org)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 13, 2022 Mar 13, 2022

Copy link to clipboard

Copied

Hi Charlie,

I am getting the same error and ain't working with Greg. I just added additional comment explaining my Java version. Thanks.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 14, 2022 Mar 14, 2022

Copy link to clipboard

Copied

@joseph.yan , three comments:

  • Your code sample in the bug report contains an error. 03 occus as an argument of the function createdatetime(2022,03,13,2,0,0). That should be 3 instead.
  • Like you, I am on CF 2021.0.03.329779. But when I run the code sample, I get "Yes" for
    <cfscript> 
    writeoutput(isDate(createdatetime(2022,03,13,2,0,0))); 
    </cfscript> ​

    Also, I get "{ts '2022-03-13 02:00:00'}" for
    <cfscript> 
    writeoutput(createdatetime(2022,03,13,2,0,0)); 
    </cfscript>.
     That is, it works without any error.
  • Nevertheless, I reported a related bug 5 days ago: https://tracker.adobe.com/#/view/CF-4212860 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 14, 2022 Mar 14, 2022

Copy link to clipboard

Copied

Thank you all for your reponse.

 

Bug report has been submitted: https://tracker.adobe.com/#/view/CF-4212878

 

My development environment is:

Window 10 64-bit system

ColdFusion 2021 2021,0,0,323925  Adobe Driver 5.1.4 (Build 0001)

Java is 11.0.1

 

Also I forgot to mention that I am in the US, and so experienced Daylight Saving time change on 3/13/2022. My european colleagues will obviously not go through time change for their systems for another couple of weeks. Daylight Saving Time rules vary throughout the world.

 

Note: My issue is NOT with createDateTime, which is perfectly correct to throw an exception for invalid input in my timezone. My issue is with isDate, which should return a simple true or false.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 14, 2022 Mar 14, 2022

Copy link to clipboard

Copied

LATEST

 

Note: My issue is NOT with createDateTime, which is perfectly correct to throw an exception for invalid input in my timezone. My issue is with isDate, which should return a simple true or false.


By @Greg Campbell

 

That is the point exactly! 🙂

Your template calls the function isDate().

Whereas ColdFusion throws an exception about its own internal function, createDateTime().

That is in itself buggy behaviour.

 

In fact, I have added the following comment to a similar bug ticket I opened some days ago (https://tracker.adobe.com/#/view/CF-4212860):

 

The following amounts to a bug anyway:
1) You use the function isDate() in your CFM template.
2) ColdFusion gives you the following error message:
" Detail: Specify a valid date in createDateTime function.
Message: Date value passed to date function createDateTime is unspecified or invalid. StackTrace: coldfusion.util.DateUtils$InvalidDateException: Date value passed to date function createDateTime is unspecified or invalid. at coldfusion.util.DateUtils.createDateTime(DateUtils.java:1504) at coldfusion.runtime.CFDateTimeParser.toDateTime(CFDateTimeParser.java:592) at coldfusion.runtime.CFDateTimeParser.parseTime(CFDateTimeParser.java:392) at coldfusion.runtime.CFDateTimeParser._parseDateTime(CFDateTimeParser.java:165)
etc."
This bug goes as far back as 2009.
See https://community.adobe.com/t5/coldfusion-discussions/error-in-createdatetime/td-p/828339

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 14, 2022 Mar 14, 2022

Copy link to clipboard

Copied

 

<cfset response = isDate("3/13/2022 02:00:00")>

 

Date value passed to date function createDateTime is unspecified or invalid.

coldfusion.util.DateUtils$InvalidDateException: Date value passed to date function createDateTime is unspecified or invalid.
at coldfusion.util.DateUtils.createDateTime(DateUtils.java:1503)
at coldfusion.runtime.CFDateTimeParser.toDateTime(CFDateTimeParser.java:592)
at coldfusion.runtime.CFDateTimeParser.parseTime(CFDateTimeParser.java:356)
at coldfusion.runtime.CFDateTimeParser.parseTime(CFDateTimeParser.java:316)
at coldfusion.runtime.CFDateTimeParser._parseDateTime(CFDateTimeParser.java:160)
at coldfusion.runtime.CFDateTimeParser.parseDateTime(CFDateTimeParser.java:88)
at coldfusion.util.DateUtils._parseDateTime(DateUtils.java:1050)
at coldfusion.util.DateUtils.isDate(DateUtils.java:1032)
at coldfusion.runtime.CFPage.IsDate(CFPage.java:3676)
at cfgctest2ecfm1330162049.runPage(C:\ColdFusion2021\cfusion\wwwroot\testDate.cfm:1)

...


By @Greg Campbell

 

This is in any case a bug. The reason being that ColdFusion's underpants are showing. ColdFusion is reporting an exception (coldfusion.util.DateUtils$InvalidDateException) that is being thrown at one of its own internal functions (createDateTime).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 14, 2022 Mar 14, 2022

Copy link to clipboard

Copied

@Greg Campbell and @joseph.yan ,

Does the following help as a workaround?

  • add the timezone flag to java.args in the jvm.config file. For example, I have added:
    -Duser.timezone=Europe/London

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation