Lucee 6 and cfupdate doesn't work

Hi,
I’m using cfupdate to update my ms sql Database form form entries.
This works under lucee 5 (all versions), but not under Lucee 6.
My system: Lucee 6 from version 6.585 to Lucee 6.0.1.24-SNAPSHOT
System: Windows 11/Windows Server 2019
SQL: MS SQL Server 15.0.2104
Java: 11.0.19 (Eclipse Adoptium) 64bit

If there is an empty numeric field in the form, the lucee update didn’t work
Message: can’t cast empty string to a number value
Java Stacktrace:
|lucee.runtime.exp.CasterException: can’t cast empty string to a number value|
| |at lucee.runtime.op.Caster.toDoubleValue(Caster.java:508)|
| |at lucee.runtime.op.Caster.toIntValue(Caster.java:823)|
| |at lucee.runtime.op.Caster.toIntValue(Caster.java:774)|
| |at lucee.runtime.op.Caster.toInteger(Caster.java:4719)|
| |at lucee.runtime.db.SQLCaster.setValue(SQLCaster.java:212)|
| |at lucee.runtime.type.QueryImpl.setItems(QueryImpl.java:587)|
| |at lucee.runtime.type.QueryImpl.execute(QueryImpl.java:305)|
| |at lucee.runtime.type.QueryImpl.(QueryImpl.java:243)|
| |at lucee.runtime.type.QueryImpl.(QueryImpl.java:233)|
| |at lucee.runtime.tag.Update.doEndTag(Update.java:197)|
| |at hepatitis_c_register990.hepatitis_c_register990.awbfrag_b_cfm$cf.call_000001(/Hepatitis-c-register/Hepatitis-C-Register/awbfrag_b.cfm:114)|
| |at hepatitis_c_register990.hepatitis_c_register990.awbfrag_b_cfm$cf.call(/Hepatitis-c-register/Hepatitis-C-Register/awbfrag_b.cfm:114)|
| |at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:1027)|
| |at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:950)|
| |at lucee.runtime.PageContextImpl.doInclude(PageContextImpl.java:931)|
| |at hepatitis_c_register990.hepatitis_c_register990.awbfrag_cfm$cf.call(/Hepatitis-c-register/Hepatitis-C-Register/awbfrag.cfm:56)|
| |at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:1027)|
| |at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:950)|
| |at lucee.runtime.listener.ClassicAppListener._onRequest(ClassicAppListener.java:65)|
| |at lucee.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:45)|
| |at lucee.runtime.PageContextImpl.execute(PageContextImpl.java:2494)|
| |at lucee.runtime.PageContextImpl._execute(PageContextImpl.java:2480)|
| |at lucee.runtime.PageContextImpl.executeCFML(PageContextImpl.java:2451)|
| |at lucee.runtime.engine.Request.exe(Request.java:45)|
| |at lucee.runtime.engine.CFMLEngineImpl._service(CFMLEngineImpl.java:1219)|
| |at lucee.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:1165)|
| |at lucee.loader.engine.CFMLEngineWrapper.serviceCFML(CFMLEngineWrapper.java:97)|
| |at lucee.loader.servlet.CFMLServlet.service(CFMLServlet.java:51)|
| |at javax.servlet.http.HttpServlet.service(HttpServlet.java:779)|
| |at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)|
| |at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)|
| |at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)|
| |at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)|
| |at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)|
| |at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:177)|
| |at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)|
| |at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)|
| |at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135)|
| |at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)|
| |at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)|
| |at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:360)|
| |at org.apache.coyote.ajp.AjpProcessor.service(AjpProcessor.java:433)|
| |at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)|
| |at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:891)|
| |at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1784)|
| |at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)|
| |at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)|
| |at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)|
| |at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)|
| |at java.base/java.lang.Thread.run(Thread.java:829)|

Does everybody have the same problem?
Any tipps for me?
May be I should create a new issue …

Thank you for your help

Michael

Can you please provide some code, so we can reproduce your issue and stack trace. To me it looks like you are not submitting the form data correctly to tbe template. Without any code as a poc, we can’t say.

Hi,
I created the following table:

|varname|type|Null-values allowed|
|Test_Number|numeric(18, 0)|Checked|
|Test_String|nvarchar(50)|Checked|
|seqno|numeric(18, 0)|Unchecked|

My cf-statement is:

<cfparam name="form.Test_Number" default="">
<cfparam name="form.Test_String" default="">
<cfparam name="form.seqno" default="3">
<cfupdate datasource="coddata" tablename="test" formfields="seqno,Test_Number,Test_String">
<cfoutput>
	test ist gelaufen: seqno: #form.seqno#<br>
</cfoutput>

the database has 5 records:
|10|test-answer|1|
|2|test2|2|
|10|test-answer|3|
|10|test-answer|4|
|10|test-answer|5|

If i fill the params in 6 and 7 with values (2 and test2) they would be updated.
If I didn’t fill them with values (code see above) I get the error message:
can’t cast empty string to a number value
The error occurred on line 9 in file D:\Inetpub\wwwroot\efactum\MV\test_sql.cfm.

The application log tells me:
Message
can’t cast empty string to a number value;lucee.runtime.exp.CasterException: can’t cast empty string to a number value
Detail
“ERROR”,“ajp-nio-127.0.0.1-8009-exec-8”,“11/07/2023”,“16:06:21”,“controller”,“can’t cast empty string to a number value;lucee.runtime.exp.CasterException: can’t cast empty string to a number value
at lucee.runtime.op.Caster.toDoubleValue(Caster.java:508)
at lucee.runtime.op.Caster.toDoubleValue(Caster.java:451)
at lucee.runtime.db.SQLCaster.setValue(SQLCaster.java:184)
at lucee.runtime.type.QueryImpl.setItems(QueryImpl.java:587)
at lucee.runtime.type.QueryImpl.execute(QueryImpl.java:305)
at lucee.runtime.type.QueryImpl.(QueryImpl.java:243)
at lucee.runtime.type.QueryImpl.(QueryImpl.java:233)
at lucee.runtime.tag.Update.doEndTag(Update.java:197)
at abbvie_portal315.h19_411180.visite2a_save_cfm$cf.call(/AbbVie-Portal/H19-411/visite2a_save. cfm:130)
at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:1027)
at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:950)
at lucee.runtime.listener.ClassicAppListener._onRequest(ClassicAppListener.java:65)
at lucee.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:45)
at lucee.runtime.PageContextImpl.execute(PageContextImpl.java:2494)
at lucee.runtime.PageContextImpl._execute(PageContextImpl.java:2480)
at lucee.runtime.PageContextImpl.executeCFML(PageContextImpl.java:2451)
at lucee.runtime.engine.Request.exe(Request.java:45)
at lucee.runtime.engine.CFMLEngineImpl._service(CFMLEngineImpl.java:1219)
at lucee.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:1165)
at lucee.loader.engine.CFMLEngineWrapper.serviceCFML(CFMLEngineWrapper.java:97)
at lucee.loader.servlet.CFMLServlet.service(CFMLServlet.java:51)
…”

I checked this ticket and the error ‘Cannot cast [NULL] string to numeric value’ also occurred in Lucee 5, can you please mention which version you checked in Lucee 5?

Hi,
you can close the question.
It also appears under lucee 5.
I had to set “<cfif len(form.Test_Number) eq 0><cfset form.Test_Number=#NullValue()#></cfif>” before the update statement. Then it works.
Thank you every one who looks at my problem.

Michael