Java error when calling .updateTable() to delete a row

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Ian, Dave, jcoulson, Jon, Wai

ericb
Ebase User
Posts: 62
Joined: Fri Jan 15, 2016 2:34 pm

Java error when calling .updateTable() to delete a row

#1

Postby ericb » Tue Jul 10, 2018 8:37 pm

I'm getting a Java error when calling .updateTable() when saving a form. The error only occurs if a row needs to be deleted; inserting and updating work fine, and don't cause any issues on their own.

I'm not seeing many options for debugging since the error presumably originates in the updateTable() call itself, which I don't have source access to obviously. The Delete SQL statement itself is simple, as you'll see below, and I can run it without issue directly on the database.

The log below shows the debug for the table's backing resource, where you can see the error being triggered immediately after running the Delete SQL. I don't know where the "0_0" string comes from; there's no such value in any of the table's columns.

Code: Select all

Tue Jul 10 14:08:25: DEBUG Start execution of command - updatetable: 14:08:25.616
Tue Jul 10 14:08:25: DEBUG Debug for database resource CCORE_PT_CICU_STAY_COMP - SQL statement:
Tue Jul 10 14:08:25: DEBUG   delete from PT_CICU_COMPLICATIONS  where CICU_COMPLICATION_ID = 18
Tue Jul 10 14:08:25: ERROR Wrapped java.lang.NumberFormatException: For input string: "0_0" (CCORE_PT_CICU_STAY_SAVE#52)
com.ebasetech.ufs.runtime.events.rhinojavascript.RhinoScriptException: Wrapped java.lang.NumberFormatException: For input string: "0_0" (CCORE_PT_CICU_STAY_SAVE#52)
	at com.ebasetech.ufs.runtime.events.rhinojavascript.JavascriptExecutionHandler.handleExecutionErrors(JavascriptExecutionHandler.java:355)
	at com.ebasetech.ufs.runtime.events.rhinojavascript.JavascriptExecutionHandler.execute(JavascriptExecutionHandler.java:280)
	at com.ebasetech.ufs.runtime.events.JVMScriptNode.execute_(JVMScriptNode.java:133)
	at com.ebasetech.ufs.runtime.events.JVMScriptNode.execute(JVMScriptNode.java:99)
	at com.ebasetech.ufs.runtime.events.RunnableContext.execute(RunnableContext.java:69)
	at com.ebasetech.ufs.runtime.events.SuspendableExecutable.execute(SuspendableExecutable.java:47)
	at com.ebasetech.ufs.runtime.events.SuspendableContainerExecutable.execute(SuspendableContainerExecutable.java:26)
	at com.ebasetech.ufs.runtime.events.BaseEventNode.execute(BaseEventNode.java:32)
	at com.ebasetech.ufs.runtime.events.RunnableContext.execute(RunnableContext.java:69)
	at com.ebasetech.ufs.runtime.events.SuspendableExecutable.execute(SuspendableExecutable.java:47)
	at com.ebasetech.ufs.runtime.events.SuspendableContainerExecutable.execute(SuspendableContainerExecutable.java:26)
	at com.ebasetech.ufs.runtime.events.RunnableContext.execute(RunnableContext.java:69)
	at com.ebasetech.ufs.runtime.events.SuspendableExecutable.execute(SuspendableExecutable.java:47)
	at com.ebasetech.ufs.runtime.events.SuspendableContainerExecutable.execute(SuspendableContainerExecutable.java:26)
	at com.ebasetech.ufs.runtime.events.RunnableContext.execute(RunnableContext.java:69)
	at com.ebasetech.ufs.runtime.Request.execute(Request.java:448)
	at com.ebasetech.ufs.runtime.Request.execute(Request.java:417)
	at com.ebasetech.ufs.runtime.Request._execute(Request.java:352)
	at com.ebasetech.ufs.runtime.Request.execute(Request.java:317)
	at formservlets.FormProcessingUtil.executeRequest(FormProcessingUtil.java:503)
	at formservlets.EbaseAjaxServlet.process(EbaseAjaxServlet.java:73)
	at formservlets.EbaseAjaxServlet.doPost(EbaseAjaxServlet.java:40)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at formservlets.EbaseFilter.processRequest(EbaseFilter.java:253)
	at formservlets.EbaseFilter.performFilter(EbaseFilter.java:180)
	at formservlets.EbaseFilter.doFilter(EbaseFilter.java:100)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:198)
	at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:176)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:203)
	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:142)
	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:518)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1526)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1482)
	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)
Caused by: java.lang.NumberFormatException: For input string: "0_0"
	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
	at java.lang.Integer.parseInt(Integer.java:580)
	at java.lang.Integer.valueOf(Integer.java:766)
	at com.ebasetech.ufs.runtime.ControlUserState.resetStateForRepeaterRow(ControlUserState.java:81)
	at com.ebasetech.ufs.runtime.ControlUserState.updateStateForRow(ControlUserState.java:59)
	at com.ebasetech.ufs.runtime.runtimeControls.repeating.RepeatingTableRuntimeControl.rowRemoved(RepeatingTableRuntimeControl.java:257)
	at com.ebasetech.ufs.runtime.RuntimeTableField.notifyRowRemoved(RuntimeTableField.java:1333)
	at com.ebasetech.ufs.runtime.RuntimeTableField.notifyRowsRemoved(RuntimeTableField.java:1414)
	at com.ebasetech.ufs.runtime.RuntimeTableField.updateTable(RuntimeTableField.java:280)
	at com.ebasetech.ufs.runtime.external.api.impl.ApiTableBase.updateTable(ApiTableBase.java:140)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:126)
	at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:225)
	at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1479)
	at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:815)
	at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:109)
	at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
	at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3280)
	at org.mozilla.javascript.Context.callFunctionWithContinuations(Context.java:1284)
	at org.mozilla.javascript.Context.executeScriptWithContinuations(Context.java:1251)
	at com.ebasetech.ufs.runtime.events.rhinojavascript.JavascriptExecutionHandler.execute(JavascriptExecutionHandler.java:270)
	... 51 more
Tue Jul 10 14:08:25: INFO Transaction rolled back
Tue Jul 10 14:08:25: ERROR com.ebasetech.xi.exceptions.FormRuntimeException: com.ebasetech.ufs.runtime.events.rhinojavascript.RhinoScriptException: Wrapped java.lang.NumberFormatException: For input string: "0_0" (CCORE_PT_CICU_STAY_SAVE#52)
Tue Jul 10 14:08:25:  Unexpected error occurred - see server log
Tue Jul 10 14:08:25: ERROR Unexpected error occurred
com.ebasetech.xi.exceptions.FormRuntimeException: com.ebasetech.ufs.runtime.events.rhinojavascript.RhinoScriptException: Wrapped java.lang.NumberFormatException: For input string: "0_0" (CCORE_PT_CICU_STAY_SAVE#52)
	at com.ebasetech.ufs.runtime.events.JVMScriptNode.handleExecutionErrors(JVMScriptNode.java:213)
	at com.ebasetech.ufs.runtime.events.JVMScriptNode.execute(JVMScriptNode.java:114)
	at com.ebasetech.ufs.runtime.events.RunnableContext.execute(RunnableContext.java:69)
	at com.ebasetech.ufs.runtime.events.SuspendableExecutable.execute(SuspendableExecutable.java:47)
	at com.ebasetech.ufs.runtime.events.SuspendableContainerExecutable.execute(SuspendableContainerExecutable.java:26)
	at com.ebasetech.ufs.runtime.events.BaseEventNode.execute(BaseEventNode.java:32)
	at com.ebasetech.ufs.runtime.events.RunnableContext.execute(RunnableContext.java:69)
	at com.ebasetech.ufs.runtime.events.SuspendableExecutable.execute(SuspendableExecutable.java:47)
	at com.ebasetech.ufs.runtime.events.SuspendableContainerExecutable.execute(SuspendableContainerExecutable.java:26)
	at com.ebasetech.ufs.runtime.events.RunnableContext.execute(RunnableContext.java:69)
	at com.ebasetech.ufs.runtime.events.SuspendableExecutable.execute(SuspendableExecutable.java:47)
	at com.ebasetech.ufs.runtime.events.SuspendableContainerExecutable.execute(SuspendableContainerExecutable.java:26)
	at com.ebasetech.ufs.runtime.events.RunnableContext.execute(RunnableContext.java:69)
	at com.ebasetech.ufs.runtime.Request.execute(Request.java:448)
	at com.ebasetech.ufs.runtime.Request.execute(Request.java:417)
	at com.ebasetech.ufs.runtime.Request._execute(Request.java:352)
	at com.ebasetech.ufs.runtime.Request.execute(Request.java:317)
	at formservlets.FormProcessingUtil.executeRequest(FormProcessingUtil.java:503)
	at formservlets.EbaseAjaxServlet.process(EbaseAjaxServlet.java:73)
	at formservlets.EbaseAjaxServlet.doPost(EbaseAjaxServlet.java:40)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at formservlets.EbaseFilter.processRequest(EbaseFilter.java:253)
	at formservlets.EbaseFilter.performFilter(EbaseFilter.java:180)
	at formservlets.EbaseFilter.doFilter(EbaseFilter.java:100)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:198)
	at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:176)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:203)
	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:142)
	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:518)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1526)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1482)
	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)
Caused by: com.ebasetech.ufs.runtime.events.rhinojavascript.RhinoScriptException: Wrapped java.lang.NumberFormatException: For input string: "0_0" (CCORE_PT_CICU_STAY_SAVE#52)
	at com.ebasetech.ufs.runtime.events.rhinojavascript.JavascriptExecutionHandler.handleExecutionErrors(JavascriptExecutionHandler.java:355)
	at com.ebasetech.ufs.runtime.events.rhinojavascript.JavascriptExecutionHandler.execute(JavascriptExecutionHandler.java:280)
	at com.ebasetech.ufs.runtime.events.JVMScriptNode.execute_(JVMScriptNode.java:133)
	at com.ebasetech.ufs.runtime.events.JVMScriptNode.execute(JVMScriptNode.java:99)
	... 49 more
Caused by: java.lang.NumberFormatException: For input string: "0_0"
	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
	at java.lang.Integer.parseInt(Integer.java:580)
	at java.lang.Integer.valueOf(Integer.java:766)
	at com.ebasetech.ufs.runtime.ControlUserState.resetStateForRepeaterRow(ControlUserState.java:81)
	at com.ebasetech.ufs.runtime.ControlUserState.updateStateForRow(ControlUserState.java:59)
	at com.ebasetech.ufs.runtime.runtimeControls.repeating.RepeatingTableRuntimeControl.rowRemoved(RepeatingTableRuntimeControl.java:257)
	at com.ebasetech.ufs.runtime.RuntimeTableField.notifyRowRemoved(RuntimeTableField.java:1333)
	at com.ebasetech.ufs.runtime.RuntimeTableField.notifyRowsRemoved(RuntimeTableField.java:1414)
	at com.ebasetech.ufs.runtime.RuntimeTableField.updateTable(RuntimeTableField.java:280)
	at com.ebasetech.ufs.runtime.external.api.impl.ApiTableBase.updateTable(ApiTableBase.java:140)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:126)
	at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:225)
	at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1479)
	at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:815)
	at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:109)
	at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
	at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3280)
	at org.mozilla.javascript.Context.callFunctionWithContinuations(Context.java:1284)
	at org.mozilla.javascript.Context.executeScriptWithContinuations(Context.java:1251)
	at com.ebasetech.ufs.runtime.events.rhinojavascript.JavascriptExecutionHandler.execute(JavascriptExecutionHandler.java:270)
	... 51 more
Line 52 of the CCORE_PT_CICU_STAY_SAVE script is uninteresting, it's just the updateTable() call:

Code: Select all

tables.CCORE_PT_CICU_STAY_COMP.updateTable();
This is happening on Ebase 5.2.0. I'm pretty much at a loss here as to what is causing this error.
0 x

Segi
Ebase User
Posts: 527
Joined: Mon Dec 09, 2013 6:37 pm

Re: Java error when calling .updateTable() to delete a row

#2

Postby Segi » Tue Jul 10, 2018 10:16 pm

Can you post a screenshot of the DB resource
0 x

ericb
Ebase User
Posts: 62
Joined: Fri Jan 15, 2016 2:34 pm

Re: Java error when calling .updateTable() to delete a row

#3

Postby ericb » Wed Jul 11, 2018 1:08 pm

Here you go:

Image
0 x

Segi
Ebase User
Posts: 527
Joined: Mon Dec 09, 2013 6:37 pm

Re: Java error when calling .updateTable() to delete a row

#4

Postby Segi » Wed Jul 11, 2018 3:11 pm

I dunno why this is happening. The only other thing that I can suggest that you check is the database connection parameters. Otherwise I don't know. Everything looks fine from that screenshot.
0 x

Jon
Moderator
Moderator
Posts: 1192
Joined: Wed Sep 12, 2007 12:49 pm

Re: Java error when calling .updateTable() to delete a row

#5

Postby Jon » Thu Jul 12, 2018 9:01 am

Eric,

This is a bug in Ebase. Do you think you could export the form and send it to support@ebasetech.com. Also include which page where the problem occurs.

Regards
Jon
0 x

ericb
Ebase User
Posts: 62
Joined: Fri Jan 15, 2016 2:34 pm

Re: Java error when calling .updateTable() to delete a row

#6

Postby ericb » Thu Jul 12, 2018 1:14 pm

Will do Jon, thanks. Do you need any resources, components, client css/js etc that the form uses so that you can run it on your end, or do you just want the form files?

Would there be any workaround possible without needing an Ebase version update?
0 x

Jon
Moderator
Moderator
Posts: 1192
Joined: Wed Sep 12, 2007 12:49 pm

Re: Java error when calling .updateTable() to delete a row

#7

Postby Jon » Thu Jul 12, 2018 1:29 pm

Might as well include all the form associations as well. Though I'm assuming we won't be able to run it because of database dependencies. I'm not sure at this point if there is a way around it - there may be.

An alternative is to write your own table database fetch/update logic using DatabaseServices.xxx methods. But this can be very painful as you need to distinguish between rows that need to be updated/inserted/deleted and this isn't particularly easy.
0 x

ericb
Ebase User
Posts: 62
Joined: Fri Jan 15, 2016 2:34 pm

Re: Java error when calling .updateTable() to delete a row

#8

Postby ericb » Thu Jul 12, 2018 2:55 pm

I already use DatabaseServices on a not-irregular basis for when I need to do certain things that can't be done through resources etc, and this table/resource had fairly simple insert/update/delete queries, so using that instead of the resource ended up being pretty simple and deleting rows now works. Thanks.
0 x

Jon
Moderator
Moderator
Posts: 1192
Joined: Wed Sep 12, 2007 12:49 pm

Re: Java error when calling .updateTable() to delete a row

#9

Postby Jon » Thu Jul 12, 2018 4:19 pm

Well that's good news. For what it's worth I think this problem - NumberFormatException - can occur in the following circumstances:

o Nested Repeaters, or Table Control nested inside a Repeater
o Some sort of change has been made to a one or more controls inside the lower level Repeater/Table Control via scripts e.g. hide/show, change colours etc
o One or more rows are then deleted
o Updatetable is issued
0 x

ericb
Ebase User
Posts: 62
Joined: Fri Jan 15, 2016 2:34 pm

Re: Java error when calling .updateTable() to delete a row

#10

Postby ericb » Thu Jul 12, 2018 4:48 pm

That makes sense since all those conditions were the case here.

For anyone who might need to use DatabaseServices for manually updating a table, I would recommend starting from the code snippet found in the "Working With Databases" documentation page (https://vault.verj.io/ebase/doc/Working ... abases.htm). From that, loop through all rows in the table and use the .isRowInserted(), .isRowModified(), and .isRowDeletedByUser() methods of the table to check which operation needs to be done for each row.

Instead of deleting the row from the table and letting .updateTable() figure out the delete on its own, you'll need to instead call .setRowDeletedByUser(true) on the row. If you want to remove it from the interface as well, I simply added a MARK_DELETION column that I also set to true at the same time, and then used a filter expression on the repeater/table:

Code: Select all

{table}-MARK_DELETION != 'Y'
0 x

Jon
Moderator
Moderator
Posts: 1192
Joined: Wed Sep 12, 2007 12:49 pm

Re: Java error when calling .updateTable() to delete a row

#11

Postby Jon » Fri Jul 13, 2018 1:36 pm

The bug with updateTable is fixed in V5.4.0
0 x


Who is online

Users browsing this forum: No registered users and 1 guest