Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0038829Openbravo ERPA. Platformpublic2018-06-25 14:002018-08-03 13:07
shuehner 
caristu 
normalminorhave not tried
closedfixed 
5
pi 
3.0PR18Q2.23.0PR18Q2.2 
AugustoMauch
Core
No
0038829: Some trigger error messages are not shown nicely when using PostgreSQL version 10 (shows part of technical error)
When a database transaction throws an exception the ErrorTextParser class tries to parse it and translates it into a usable end-user message and shows that instead.

That parsing fails with pg10 and parts of the technical exception is shown mixed with the translated message.

When fixing the issue the existing unit tests (in ErrorTextParserTest class) for the parser should get a new test-case to cover the fix.
Start with instance having 18Q3 (or at least pi containing those)
Important: Have project to 'reject setting a module in development' when instance purpose is 'Production'.

Change Role to System Administrator
Set instance purpose to 'Production'
Go to module window
Edit entry to 'core' module and mark 'In Development' as active.
Save the edited record.

Expected error message:
Saving failed. Cannot have modules in "In Development" status in a Production instance

Actual error message when using postgresql version10.
Saving failed. Cannot have modules in "In Development" status in a Production instance Where: PL/pgSQL function ad_module_trg() line 33 at RAISE

Here part of the 'Stacktrace' of the error message comes up in the translated text.
No tags attached.
blocks defect 0038827 closed caristu Some trigger error messages are not shown nicely when using PostgreSQL version 10 (shows part of technical error) 
Issue History
2018-06-25 15:18caristuTypedefect => backport
2018-06-25 15:18caristuTarget Version => 3.0PR18Q2.2
2018-06-26 18:02caristuAssigned Toplatform => caristu
2018-07-31 19:18caristuReview Assigned To => AugustoMauch
2018-07-31 19:19hgbotCheckin
2018-07-31 19:19hgbotNote Added: 0106062
2018-07-31 19:19hgbotStatusscheduled => resolved
2018-07-31 19:19hgbotResolutionopen => fixed
2018-07-31 19:19hgbotFixed in SCM revision => http://code.openbravo.com/erp/backports/3.0PR18Q2.2/rev/733a90ef96e2a09a4e41fbc343a7ec15f502f8a6 [^]
2018-08-02 13:33hgbotCheckin
2018-08-02 13:33hgbotNote Added: 0106120
2018-08-03 13:07AugustoMauchStatusresolved => closed
2018-08-03 13:07AugustoMauchFixed in Version => 3.0PR18Q2.2

Notes
(0106062)
hgbot   
2018-07-31 19:19   
Repository: erp/backports/3.0PR18Q2.2
Changeset: 733a90ef96e2a09a4e41fbc343a7ec15f502f8a6
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Tue Jul 31 19:16:40 2018 +0200
URL: http://code.openbravo.com/erp/backports/3.0PR18Q2.2/rev/733a90ef96e2a09a4e41fbc343a7ec15f502f8a6 [^]

fixes issue 38829: Some trigger error messages not shown nicely in PG10

  Using capturing groups to retrieve just the DB message (it is surrounded by @) with the regular expression matcher.

---
M src/org/openbravo/erpCommon/utility/ErrorTextParserPOSTGRE.java
---
(0106120)
hgbot   
2018-08-02 13:33   
Repository: erp/backports/3.0PR18Q2.2
Changeset: b268ab48035d919981f21eee0f3661b6661be04d
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Thu Aug 02 13:03:20 2018 +0200
URL: http://code.openbravo.com/erp/backports/3.0PR18Q2.2/rev/b268ab48035d919981f21eee0f3661b6661be04d [^]

related to bug 38829: Some trigger error messages not shown nicely in PG10

  The fix[1] was not taking into accout the possibility of having multiple translatable elements (text surrounded by @) in the same error message.

  Therefore, it has been restored the previous regular expression, and we are now directly stripping the part that contains the technical information of a trigger failure from the DB message returned by PostgreSQL.

[1] https://code.openbravo.com/erp/backports/3.0PR18Q2.2/rev/733a90ef96e2a09a4e41fbc343a7ec15f502f8a6 [^]

---
M src/org/openbravo/erpCommon/utility/ErrorTextParserPOSTGRE.java
---