Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0034131Openbravo ERPY. DBSourceManagerpublic2016-09-29 16:092016-09-30 19:07
alostale 
alostale 
urgentmajorhave not tried
closedfixed 
5
 
3.0PR16Q4 
caristu
Core
No
0034131: can't export database in verbose mode if there's a config script changing a column to nullable
If there is a config script that changes a column from not null to null (or in the other way around), when trying to export DB a NPE is thrown and the process stops in case bbdd.verbosity is set to debug.
1. Install attached template
2. Set bbdd.verbosity=DEBUG in Openbravo.properties
3. run ant export.database
  -> NPE is thrown:
/opt/OpenbravoERP/build.xml:787: The following error occurred while executing this line:
/opt/OpenbravoERP/src-db/database/build.xml:159: java.lang.NullPointerException
    at org.apache.ddlutils.alteration.ColumnRequiredChange.toString(ColumnRequiredChange.java:122)
    at java.lang.String.valueOf(String.java:2849)
    at java.lang.StringBuilder.append(StringBuilder.java:128)
    at org.openbravo.utils.OBLogAppender.append(OBLogAppender.java:95)
    at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251)
    at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:66)
    at org.apache.log4j.Category.callAppenders(Category.java:206)
    at org.apache.log4j.Category.forcedLog(Category.java:391)
    at org.apache.log4j.Category.debug(Category.java:260)
    at org.openbravo.ddlutils.util.DBSMOBUtil.applyConfigScripts(DBSMOBUtil.java:997)
    at org.openbravo.ddlutils.util.DBSMOBUtil.loadDataStructures(DBSMOBUtil.java:928)
    at org.openbravo.ddlutils.util.DBSMOBUtil.loadDataStructures(DBSMOBUtil.java:896)
    at org.openbravo.ddlutils.util.DBSMOBUtil.loadDataStructures(DBSMOBUtil.java:890)
No tags attached.
related to design defect 0034102 closed platform Update.database and Install.Source tasks should use the same flow to create the database and the db model 
related to feature request 0034138 closed caristu Create a Test Suite for Configuration Scripts 
related to defect 0034144 closed caristu Prevent NPE on RemoveTriggerChange toString() method 
? org.openbravo.test.template-0.0.0.obx (2,169) 2016-09-30 09:12
https://issues.openbravo.com/file_download.php?file_id=9874&type=bug
Issue History
2016-09-29 16:09alostaleNew Issue
2016-09-29 16:09alostaleAssigned To => platform
2016-09-29 16:09alostaleModules => Core
2016-09-29 16:09alostaleTriggers an Emergency Pack => No
2016-09-29 16:13alostaleDescription Updatedbug_revision_view_page.php?rev_id=13282#r13282
2016-09-29 16:13alostaleSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=13284#r13284
2016-09-30 09:12alostaleAssigned Toplatform => alostale
2016-09-30 09:12alostaleFile Added: org.openbravo.test.template-0.0.0.obx
2016-09-30 09:14alostaleSummarycan't export database if there's a config script changing a column to nullable => can't export database in verbose mode if there's a config script changing a column to nullable
2016-09-30 09:14alostaleDescription Updatedbug_revision_view_page.php?rev_id=13291#r13291
2016-09-30 09:14alostaleSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=13292#r13292
2016-09-30 09:26hgbotCheckin
2016-09-30 09:26hgbotNote Added: 0090400
2016-09-30 09:26hgbotStatusnew => resolved
2016-09-30 09:26hgbotResolutionopen => fixed
2016-09-30 09:26hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/dbsm-main/rev/9ea2ed34264c8659fccac2445b8692a375cd44ea [^]
2016-09-30 09:27hgbotCheckin
2016-09-30 09:27hgbotNote Added: 0090401
2016-09-30 09:27hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/devel/dbsm-main/rev/9ea2ed34264c8659fccac2445b8692a375cd44ea [^] => http://code.openbravo.com/erp/devel/pi/rev/c2059804fd2c23c306a39dbb7c9281a09dfc8568 [^]
2016-09-30 09:27alostaleReview Assigned To => caristu
2016-09-30 09:28alostaleRelationship addedrelated to 0034102
2016-09-30 09:58caristuRelationship addedrelated to 0034138
2016-09-30 09:59caristuNote Added: 0090407
2016-09-30 09:59caristuStatusresolved => closed
2016-09-30 09:59caristuFixed in Version => 3.0PR16Q4
2016-09-30 10:02caristuRelationship addedrelated to 0034144
2016-09-30 19:07hudsonbotCheckin
2016-09-30 19:07hudsonbotNote Added: 0090441

Notes
(0090400)
hgbot   
2016-09-30 09:26   
Repository: erp/devel/dbsm-main
Changeset: 9ea2ed34264c8659fccac2445b8692a375cd44ea
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Fri Sep 30 09:20:16 2016 +0200
URL: http://code.openbravo.com/erp/devel/dbsm-main/rev/9ea2ed34264c8659fccac2445b8692a375cd44ea [^]

fixed bug 34131: NPE exporting DB with template change for column required

  A NPE was thrown and export.database process stopped in case there was a config
  script with a change for column required and the log level was set to debug.

  The problem was in ColumnRequiredChange.toString which assumed _column to be
  not null, which is not true in all cases.

  Fixed by being deffensive on this case. Also improved information in toString
  by adding table name and new required value.

---
M src/org/apache/ddlutils/alteration/ColumnRequiredChange.java
---
(0090401)
hgbot   
2016-09-30 09:27   
Repository: erp/devel/pi
Changeset: c2059804fd2c23c306a39dbb7c9281a09dfc8568
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Fri Sep 30 09:26:25 2016 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/c2059804fd2c23c306a39dbb7c9281a09dfc8568 [^]

fixed bug 34131: NPE exporting DB with template change for column required

  A NPE was thrown and export.database process stopped in case there was a config
  script with a change for column required and the log level was set to debug.

  The problem was in ColumnRequiredChange.toString which assumed _column to be
  not null, which is not true in all cases.

  Fixed by being deffensive on this case. Also improved information in toString
  by adding table name and new required value.

---
M src-db/database/lib/dbsourcemanager.jar
---
(0090407)
caristu   
2016-09-30 09:59   
Code review + testing OK
(0090441)
hudsonbot   
2016-09-30 19:07   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/538700cbd709 [^]
Maturity status: Test