Project: Birt
Bug 204651 AssertionError for an image (byte[]) in a scripted data set column of type "any"
Reported: 2007-09-26 03:39:01 | Status: resolved fixed

For the display of an image created dynamically by an own java class I use a scripted data set with one column of type "any" and a ScriptedDataSetEventAdapter that sets the column value with a byte[]. This was described in a BIRT example and works with BIRT 2.1.2. Now, we are using BIRT 2.2 and we get an AssertionError running our report creation JUnit test (where the assertion check is enabled). It seems that the constructor of the "ResultObject" class has got a new if-statement if the result field is of type "any". The assertion within the invoked method "ResultFieldMetadata.setDataType()" checks whether the data type is an Integer.class or a Double.class or ... As byte[] isn't part of the expected java data types the assertion error is thrown (see below). java.lang.AssertionError at org.eclipse.birt.data.engine.executor.ResultFieldMetadata.setDataType(Result FieldMetadata.java:100) at org.eclipse.birt.data.engine.executor.ResultObject.<init>(ResultObject.java: 55) at org.eclipse.birt.data.engine.executor.cache.ExpandableRowResultSet.next(Expa ndableRowResultSet.java:77) at org.eclipse.birt.data.engine.executor.cache.SmartCacheHelper.populateData(Sm artCacheHelper.java:268) at org.eclipse.birt.data.engine.executor.cache.SmartCacheHelper.initInstance(Sm artCacheHelper.java:241) at org.eclipse.birt.data.engine.executor.cache.SmartCacheHelper.getResultSetCac he(SmartCacheHelper.java:204) at org.eclipse.birt.data.engine.executor.cache.SmartCache.<init>(SmartCache.jav a:68) at org.eclipse.birt.data.engine.executor.transform.pass.PassUtil.populateOdiRes ultSet(PassUtil.java:113) at org.eclipse.birt.data.engine.executor.transform.pass.PassUtil.pass(PassUtil. java:66) at org.eclipse.birt.data.engine.executor.transform.pass.PassManager.doSinglePas s(PassManager.java:185) at org.eclipse.birt.data.engine.executor.transform.pass.PassManager.pass(PassMa nager.java:90) at org.eclipse.birt.data.engine.executor.transform.pass.PassManager.populateRes ultSet(PassManager.java:72) at org.eclipse.birt.data.engine.executor.transform.ResultSetPopulator.populateR esultSet(ResultSetPopulator.java:208) at org.eclipse.birt.data.engine.executor.transform.CachedResultSet.<init>(Cache dResultSet.java:132) at org.eclipse.birt.data.engine.executor.CandidateQuery.execute(CandidateQuery. java:106) at org.eclipse.birt.data.engine.impl.PreparedScriptDSQuery$ScriptDSQueryExecuto r.executeOdiQuery(PreparedScriptDSQuery.java:223) at org.eclipse.birt.data.engine.impl.QueryExecutor.execute(QueryExecutor.java:7 61) at org.eclipse.birt.data.engine.impl.ServiceForQueryResults.executeQuery(Servic eForQueryResults.java:216) at org.eclipse.birt.data.engine.impl.QueryResults.getResultIterator(QueryResult s.java:152) at org.eclipse.birt.report.engine.data.dte.QueryResultSet.<init>(QueryResultSet .java:83) at org.eclipse.birt.report.engine.data.dte.DteDataEngine.doExecuteQuery(DteData Engine.java:155) at org.eclipse.birt.report.engine.data.dte.DteDataEngine.doExecuteQuery(DteData Engine.java:115) at org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.execute(AbstractD ataEngine.java:178) at org.eclipse.birt.report.engine.executor.ExecutionContext.executeQuery(Execut ionContext.java:1678) at org.eclipse.birt.report.engine.executor.QueryItemExecutor.executeQuery(Query ItemExecutor.java:82) at org.eclipse.birt.report.engine.executor.TableItemExecutor.execute(TableItemE xecutor.java:61) at org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportItemExecu tor.execute(WrappedReportItemExecutor.java:45) at org.eclipse.birt.report.engine.internal.executor.dup.SuppressDuplicateItemEx ecutor.execute(SuppressDuplicateItemExecutor.java:42) at org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportItemExecu tor.execute(WrappedReportItemExecutor.java:45) at org.eclipse.birt.report.engine.internal.executor.l18n.LocalizedReportItemExe cutor.execute(LocalizedReportItemExecutor.java:33) at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutChildre n(HTMLBlockStackingLM.java:63) at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstrac tLM.java:171) at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.resumeLayout (HTMLInlineStackingLM.java:94) at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.layoutChildr en(HTMLInlineStackingLM.java:138) at org.eclipse.birt.report.engine.layout.html.HTMLRowLM.layoutChildren(HTMLRowL M.java:41) at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstrac tLM.java:171) at org.eclipse.birt.report.engine.layout.html.HTMLRowLM.layout(HTMLRowLM.java:3 1) at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutChildre n(HTMLBlockStackingLM.java:68) at org.eclipse.birt.report.engine.layout.html.HTMLTableLM.layoutChildren(HTMLTa bleLM.java:81) at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstrac tLM.java:171) at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutChildre n(HTMLBlockStackingLM.java:68) at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstrac tLM.java:171) at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.resumeLayout (HTMLInlineStackingLM.java:94) at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.layoutChildr en(HTMLInlineStackingLM.java:138) at org.eclipse.birt.report.engine.layout.html.HTMLRowLM.layoutChildren(HTMLRowL M.java:41) at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstrac tLM.java:171) at org.eclipse.birt.report.engine.layout.html.HTMLRowLM.layout(HTMLRowLM.java:3 1) at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutChildre n(HTMLBlockStackingLM.java:68) at org.eclipse.birt.report.engine.layout.html.HTMLTableLM.layoutChildren(HTMLTa bleLM.java:81) at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstrac tLM.java:171) at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layoutChildren(HTMLPag eLM.java:142) at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout(HTMLPageLM.java :84) at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTM LReportLayoutEngine.java:90) at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderT ask.java:148) at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTas k.java:71)

Files changed in fix:
data/org.eclipse.birt.data/src/org/eclipse/birt/data/engine/executor/ResultFieldMetadata.java