Error on packout from the toolbar on certain windows (Table & Column, Window, Tab & Field)

Description

Steps to reproduce:

  1. Login as System

  2. Open the Window, Tab & Field window

  3. Click on Export

  4. Leave all checkboxes checked

  5. Click ok

Or

Steps to reproduce:

  1. Login as System

  2. Open the Table And Column window

  3. Go to the C_Order table

  4. Click on Export

  5. Leave all checkboxes checked

  6. Click ok

Expected result
A 2pack is created with the Window Tab and Field records

Actual Result
An error is thrown.
WindowElementHandler.create: org.postgresql.util.PSQLException: This ResultSet is closed. [203]
org.adempiere.exceptions.AdempiereException: org.postgresql.util.PSQLException: This ResultSet is closed.
at org.adempiere.pipo2.handler.TableElementHandler.create(TableElementHandler.java:210)
at org.adempiere.pipo2.handler.TableElementHandler.packOut(TableElementHandler.java:287)
at org.adempiere.pipo2.handler.WindowElementHandler.create(WindowElementHandler.java:171)
at org.adempiere.pipo2.handler.WindowElementHandler.packOut(WindowElementHandler.java:249)
at org.adempiere.pipo2.ElementHandler.packOut(ElementHandler.java:66)
at org.adempiere.pipo2.PackOut.export(PackOut.java:144)
at org.adempiere.pipo2.GridTab2PackExporter.export(GridTab2PackExporter.java:128)
at org.adempiere.webui.panel.action.ExportAction.exportFile(ExportAction.java:331)
at org.adempiere.webui.panel.action.ExportAction.onEvent(ExportAction.java:234)
at org.zkoss.zk.ui.AbstractComponent.onEvent(AbstractComponent.java:3184)
at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:3154)
at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:3096)
at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:138)
at org.zkoss.zk.ui.impl.UiEngineImpl.processEvent(UiEngineImpl.java:1890)
at org.zkoss.zk.ui.impl.UiEngineImpl.process(UiEngineImpl.java:1662)
at org.zkoss.zk.ui.impl.UiEngineImpl.execUpdate(UiEngineImpl.java:1329)
at org.zkoss.zk.au.http.DHtmlUpdateServlet.process(DHtmlUpdateServlet.java:611)
at org.zkoss.zk.au.http.DHtmlUpdateServlet.doGet(DHtmlUpdateServlet.java:487)
at org.zkoss.zk.au.http.DHtmlUpdateServlet.doPost(DHtmlUpdateServlet.java:495)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
caused by: org.postgresql.util.PSQLException: This ResultSet is closed.; State=55000; ErrorCode=0
at org.postgresql.jdbc.PgResultSet.checkClosed(PgResultSet.java:2741)
at org.postgresql.jdbc.PgResultSet.findColumn(PgResultSet.java:2588)
at org.postgresql.jdbc.PgResultSet.getInt(PgResultSet.java:2485)
at com.mchange.v2.c3p0.impl.NewProxyResultSet.getInt(NewProxyResultSet.java:451)
at org.adempiere.pipo2.handler.TableElementHandler.create(TableElementHandler.java:183)
at org.adempiere.pipo2.handler.TableElementHandler.packOut(TableElementHandler.java:287)
at org.adempiere.pipo2.handler.WindowElementHandler.create(WindowElementHandler.java:171)
at org.adempiere.pipo2.handler.WindowElementHandler.packOut(WindowElementHandler.java:249)
at org.adempiere.pipo2.ElementHandler.packOut(ElementHandler.java:66)
at org.adempiere.pipo2.PackOut.export(PackOut.java:144)
at org.adempiere.pipo2.GridTab2PackExporter.export(GridTab2PackExporter.java:128)
at org.adempiere.webui.panel.action.ExportAction.exportFile(ExportAction.java:331)
at org.adempiere.webui.panel.action.ExportAction.onEvent(ExportAction.java:234)
at org.zkoss.zk.ui.AbstractComponent.onEvent(AbstractComponent.java:3184)
at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:3154)
at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:3096)
at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:138)
at org.zkoss.zk.ui.impl.UiEngineImpl.processEvent(UiEngineImpl.java:1890)
at org.zkoss.zk.ui.impl.UiEngineImpl.process(UiEngineImpl.java:1662)
at org.zkoss.zk.ui.impl.UiEngineImpl.execUpdate(UiEngineImpl.java:1329)
at org.zkoss.zk.au.http.DHtmlUpdateServlet.process(DHtmlUpdateServlet.java:611)

Environment

None

Activity

Show:
Igor Martins
June 25, 2020, 6:16 AM

Triaged as not reproducible by Igor Martins

Diego Ruiz
June 25, 2020, 7:38 AM

I just tested the test scenario 2 on https://triage6.idempiere.org/webui/ and the result is the same exception.

 

Reopening the ticket.

Carlos Ruiz
June 25, 2020, 7:40 PM

Just as a note - I made some tests in old installations:

  • experimental running 6.2 - same issue

  • an old client running 3.1 - same issue

Carlos Ruiz
June 25, 2020, 11:28 PM

https://github.com/idempiere/idempiere/pull/141
I changed the classes
CommonTranslationHandler
ReferenceElementHandler
ReferenceTableElementHandler
TableElementHandler
WorkflowElementHandler

to avoid using direct JDBC and use the DB and Query methods, it seems the issue is gone, so, this reinforces the best practice about not using JDBC.

Carlos Ruiz
June 25, 2020, 11:51 PM

After re-checking the pull request I think the real guilty was
org.adempiere.pipo.handlers/src/org/adempiere/pipo2/handler/WorkflowElementHandler.java

There we can see three nested PreparedStatement and ResultSet - the internal ones were not closed, but new objects were added - in other words, the internal while loops lack of closing the used objects.

Assignee

Carlos Ruiz

Reporter

Diego Ruiz

Labels

None

Tested By

Diego Ruiz

Fix versions

Affects versions

Priority

Major
Configure