cachedwithin="Request" probable issue in 5.2.2.68-RC

Hi,

Running 5.2.2.68-RC, I’ve picked up this error when using “Request” as my cachedwithin value, “Can’t cast String [Request] to a value of type [timespan]”

Is anyone else seeing this? The code I’ve been using has been working with the upper case “Request” value for ages, and reverting back to 5.2.1.9 resolves the issue, so I think there is an issue in the RC, I just want to make sure my upper case string isn’t a deal breaker going forward.

Can you please post the full error information including stack trace?

Also, the snippet of your code that triggers the error.

Thanks

Sure, use gateways that can be called with or without a value for cache minutes. In CF if you remember cacheing with a zero timespan worked okay, and once we migrated to Lucee we needed a way to insert the “Request” value into the queries the make up our gateways. This is done with code that looks like this:

<cfif structKeyExists(arguments, "_cacheMins") and  arguments._cacheMins GT 0 >
	<cfset local.cacheStatement = "#createTimeSpan(0,0,arguments._cacheMins,0)#" />
<cfelse>
	<cfset local.cacheStatement = "Request" />
</cfif>

<cfquery name="qList" datasource="#variables.dsn#" cachedwithin="#local.cacheStatement#">

This has worked fine and continues to work fine in prior Lucee versions but once we’re running on 5.2.2.68-RC we die with this error:

Detail: “Java type of the object is java.lang.String”
Message: “Can’t cast String [Request] to a value of type [timespan]”
StackTrace: “lucee.runtime.exp.CasterException: Can’t cast String [Request] to a value of type [timespan] at lucee.runtime.op.Caster.toTimespan(Caster.java:3167) at lucee.runtime.op.Caster.toTimeSpan(Caster.java:3122) at lucee.runtime.tag.Query.doEndTag(Query.java:623) at entities.projectownergateway_cfc$cf.udfCall(/entities/ProjectOwnerGateway.cfc:154) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:107) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:355) at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:212) at lucee.runtime.type.scope.UndefinedImpl.callWithNamedValues(UndefinedImpl.java:781) at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:835) at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1714) at entities.projectownergateway_cfc$cf.udfCall(/entities/ProjectOwnerGateway.cfc:185) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:107) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:355) at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:212) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:663) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:580) at lucee.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1935) at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:835) at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1714) at entities.project_cfc$cf.udfCall3(/entities/Project.cfc:382) at entities.project_cfc$cf.udfCall(/entities/Project.cfc) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:107) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:355) at lucee.runtime.type.UDFImpl.call(UDFImpl.java:226) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:662) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:580) at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1918) at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:758) at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1693) at controllers.projectformcontroller_cfc$cf.udfCall(/controllers/ProjectFormController.cfc:644) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:107) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:355) at lucee.runtime.type.UDFImpl.call(UDFImpl.java:226) at lucee.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:772) at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:758) at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1693) at controllers.projectformcontroller_cfc$cf.udfCall(/controllers/ProjectFormController.cfc:103) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:107) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:355) at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:212) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:663) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:580) at lucee.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1931) at lucee.runtime.tag.Invoke.doComponent(Invoke.java:221) at lucee.runtime.tag.Invoke.doEndTag(Invoke.java:194) at rave.core.framework_cfc$cf.udfCall(/rave/core/Framework.cfc:158) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:107) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:355) at lucee.runtime.type.UDFImpl.call(UDFImpl.java:226) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:662) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:580) at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1918) at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:758) at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1693) at index_cfm$cf.call(/index.cfm:9) at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:907) at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:838) at lucee.runtime.PageContextImpl.doInclude(PageContextImpl.java:822) at admin.index_cfm$cf.call(/admin/index.cfm:3) at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:907) at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:838) at lucee.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:224) at lucee.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:43) at lucee.runtime.PageContextImpl.execute(PageContextImpl.java:2400) at lucee.runtime.PageContextImpl._execute(PageContextImpl.java:2390) at lucee.runtime.PageContextImpl.executeCFML(PageContextImpl.java:2358) at lucee.runtime.engine.Request.exe(Request.java:46) at lucee.runtime.engine.CFMLEngineImpl._service(CFMLEngineImpl.java:1044) at lucee.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:992) at lucee.loader.engine.CFMLEngineWrapper.serviceCFML(CFMLEngineWrapper.java:102) at lucee.loader.servlet.CFMLServlet.service(CFMLServlet.java:62) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528) at org.apache.coyote.ajp.AbstractAjpProcessor.process(AbstractAjpProcessor.java:873) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:670) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745)”

Thank you for reporting this. The issue has been fixed in 5.2.2.69-SNAPSHOT.

And thank you for all the work you do on Lucee, I can confirm this is no longer an issue running 5.2.2.70.

1 Like

BTW, [LDEV-907] - Lucee has also been resolved now, so you can now pass cachedWithin (0,0,0,0) to refresh the cache for that query.