Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0045318Openbravo ERPY. DBSourceManagerpublic2020-10-28 15:112022-11-03 12:47
shuehner 
Triage Platform Base 
normalminorhave not tried
newopen 
5
 
 
Core
No
0045318: NullPointerException during create.database with configScript doing model changes of non existing db objects
When a configScript is trying to be applied i.e. during install.source and it contains a removeCheckChange but the named-check being referenced is missing a NullPointerException is triggered.

While the configScript is broken a proper error message should be shown referencing the missing element.

Example error message:
[createdatabase] 89043 [main] INFO org.openbravo.ddlutils.task.CreateDatabase - Loading config script for module from path /srv/ci/workspace/mod-simple-ci34.18102/modules/org.openbravo.module.sii.template/src-db/database/configScript.xml
[createdatabase] 89045 [main] ERROR org.apache.ddlutils.platform.PlatformImplBase - Error applying Configuration Script model changes
[createdatabase] java.lang.NullPointerException: null
[createdatabase] at org.apache.ddlutils.platform.oracle.OracleBuilder.printRemoveCheckChange(OracleBuilder.java:612) ~[dbsourcemanager.jar:?]
[createdatabase] at org.apache.ddlutils.platform.PlatformImplBase.applyConfigScriptModelChanges(PlatformImplBase.java:3108) [dbsourcemanager.jar:?]
[createdatabase] at org.apache.ddlutils.platform.PlatformImplBase.applyConfigScript(PlatformImplBase.java:3090) [dbsourcemanager.jar:?]
[createdatabase] at org.openbravo.ddlutils.task.CreateDatabase.insertSourceData(CreateDatabase.java:260) [dbsourcemanager.jar:?]

Triggered this entry from the above configScript but that specific check not present:
    <removeCheckChange tableName="AD_ORGINFO" checkName="EM_AEAT390_REPR_FIS_CH">
      <check name="EM_AEAT390_REPR_FIS_CH"><![CDATA[((EM_AEAT390_REP_NIF IS NULL) AND (EM_AEAT390_REP_NAME IS NULL)) OR ((EM_AEAT390_REP_NIF IS NOT NULL) AND (EM_AEAT390_REP_NAME IS NOT NULL))]]></check>
    </removeCheckChange>
Add above removeCheckChange to i.e. any configScript should be enough to trigger the error.
That should much easier then to reproduce the exact situation with CodeSnapshot and multiple modules in which is was found.
Safeguard against 'check' being null in dbsm code and log4j.error with the required details + probably skip that specific change.
No tags attached.
related to defect 0044892 closed alostale On install.source config scripts are applied in two steps 
Issue History
2020-10-28 15:11shuehnerNew Issue
2020-10-28 15:11shuehnerAssigned To => platform
2020-10-28 15:11shuehnerModules => Core
2020-10-28 15:11shuehnerTriggers an Emergency Pack => No
2020-10-29 13:48alostaleRelationship addedrelated to 0044892
2020-10-29 13:49alostaleSummaryNullPointerException during create.database with configScript doing removeCheckChange of non existing check => NullPointerException during create.database with configScript doing model changes of non existing db objects
2020-10-29 13:49alostaleAssigned Toplatform => alostale
2020-10-29 13:51hgbotNote Added: 0124007
2022-02-01 07:24alostaleAssigned Toalostale => Triage Platform Base
2022-11-03 12:47caristuNote Added: 0142880

Notes
(0124007)
hgbot   
2020-10-29 13:51   
Merge Request created: https://gitlab.com/openbravo/product/dbsm/-/merge_requests/19 [^]
(0142880)
caristu   
2022-11-03 12:47   
The fix for 0044892 makes the NullPointerException go away, but instead of performing this operation silently it would be nice to show a warning with the changes that are not going to be eventually applied.