Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0045726Openbravo ERPY. DBSourceManagerpublic2021-01-13 16:062022-02-01 07:24
shuehner 
Triage Platform Base 
normalminorhave not tried
newopen 
5
 
 
Core
No
0045726: ant create.database fails with NPE if sourcedata contains table with BLOB columns without a value in the xml file (oracle only)
Part of create.database is loading sourcedata from the xml files into the database.
If a table is loaded and it contains a column of type="BLOB" and the xml file being loaded does not have a value for this field (meaning not having a line in the xml file for this table) then ant create.database fails with a NullPointerException.

That error only happens when using Oracle datbase (tested both ora11 and ora19)
Error happens on both 19Q3 tag and master/head (development for 21Q2)

Caused by: org.apache.ddlutils.io.DataSinkException: java.lang.NullPointerException
        at org.apache.ddlutils.io.DataToDatabaseSink.purgeBatchQueue(DataToDatabaseSink.java:409)
        at org.apache.ddlutils.io.DataToDatabaseSink.insertBeanIntoDatabase(DataToDatabaseSink.java:383)
        at org.apache.ddlutils.io.DataToDatabaseSink.addBean(DataToDatabaseSink.java:314)
        at org.apache.ddlutils.io.DynaSqlCreateRule.end(DynaSqlCreateRule.java:84)
        at org.apache.commons.digester.Digester.endElement(Digester.java:1233)
        ... 57 more
Caused by: java.lang.NullPointerException
        at java.base/java.io.ByteArrayInputStream.<init>(ByteArrayInputStream.java:108)
        at org.apache.ddlutils.platform.PlatformImplBase.setStatementParameterValue(PlatformImplBase.java:2765)
        at org.apache.ddlutils.platform.PlatformImplBase.setObject(PlatformImplBase.java:2720)
        at org.apache.ddlutils.platform.PlatformImplBase.insert(PlatformImplBase.java:1867)
        at org.apache.ddlutils.io.DataToDatabaseSink.purgeBatchQueue(DataToDatabaseSink.java:399)
        ... 61 more

Important note:
This is the end of the relevant error stacktrace.
Earlier parts as misleading and point to 'xml parsing error for an unrelated table'
Cause is dbsourcemanager using batchMode(true) for the data loading so the error is happening and the end of the batch (even if problem is caused way earlier)
Put attached AD_IMAGE.xml example file into src-db/database/sourcedata folder
run ant create.database using Oracle database

Improve code instacktrace above to add handling for missing value (null) to the BLOB codepath avoiding to try to constuct a ByteArrayInputSteam with null.
No tags attached.
xml AD_IMAGE.xml (673) 2021-01-13 16:06
https://issues.openbravo.com/file_download.php?file_id=15247&type=bug
Issue History
2021-01-13 16:06shuehnerNew Issue
2021-01-13 16:06shuehnerAssigned To => platform
2021-01-13 16:06shuehnerFile Added: AD_IMAGE.xml
2021-01-13 16:06shuehnerModules => Core
2021-01-13 16:06shuehnerTriggers an Emergency Pack => No
2021-01-13 17:28shuehnerCategoryA. Platform => Y. DBSourceManager
2022-02-01 07:24alostaleAssigned Toplatform => Triage Platform Base

There are no notes attached to this issue.