Project: Birt
Bug 311831 Width of images set to a percent value causes java.lang.ArrayIndexOutOfBoundsException in Excel emitter
Reported: 2010-05-06 04:17:26 | Status: resolved fixed

Build Identifier: BIRT 2.5.2 release If you set the width of an embedded image to a percent value the Excel emitter throws an ArrayIndexOutOfBoundsException caused from the ExcelLayoutEngine. Stacktrace: org.eclipse.birt.report.service.api.ReportServiceException: Error happened while running the report at org.apache.axis.AxisFault.makeFault(AxisFault.java:101) at org.eclipse.birt.report.utility.BirtUtility.makeAxisFault(BirtUtility.java:748) at org.eclipse.birt.report.service.actionhandler.AbstractBaseActionHandler.execute(AbstractBaseActionHandler.java:94) at org.eclipse.birt.report.presentation.aggregation.layout.EngineFragment.doService(EngineFragment.java:318) at org.eclipse.birt.report.presentation.aggregation.AbstractBaseFragment.service(AbstractBaseFragment.java:76) at org.eclipse.birt.report.servlet.BirtEngineServlet.__doGet(BirtEngineServlet.java:120) at org.eclipse.birt.report.servlet.BaseReportEngineServlet.doGet(BaseReportEngineServlet.java:185) at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.eclipse.birt.report.servlet.BaseReportEngineServlet.service(BaseReportEngineServlet.java:116) at org.eclipse.equinox.http.registry.internal.ServletManager$ServletWrapper.service(ServletManager.java:180) at org.eclipse.equinox.http.servlet.internal.ServletRegistration.handleRequest(ServletRegistration.java:90) at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:111) at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:59) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.eclipse.equinox.http.jetty.internal.HttpServerManager$InternalHttpServiceServlet.service(HttpServerManager.java:318) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:380) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:324) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:535) at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:865) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:540) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:213) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:520) Caused by: org.eclipse.birt.report.service.api.ReportServiceException: Error happened while running the report at org.eclipse.birt.report.service.ReportEngineService.throwDummyException(ReportEngineService.java:1097) at org.eclipse.birt.report.service.ReportEngineService.runAndRenderReport(ReportEngineService.java:926) at org.eclipse.birt.report.service.BirtViewerReportService.runAndRenderReport(BirtViewerReportService.java:973) at org.eclipse.birt.report.service.actionhandler.BirtRunAndRenderActionHandler.__execute(BirtRunAndRenderActionHandler.java:76) at org.eclipse.birt.report.service.actionhandler.AbstractBaseActionHandler.execute(AbstractBaseActionHandler.java:90) ... 27 more Caused by: org.eclipse.birt.report.engine.api.EngineException: Error happened while running the report at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:186) at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:75) at org.eclipse.birt.report.service.ReportEngineService.runAndRenderReport(ReportEngineService.java:920) ... 30 more Caused by: java.lang.ArrayIndexOutOfBoundsException: -1 at java.util.ArrayList.get(ArrayList.java:323) at org.eclipse.birt.report.engine.emitter.excel.DataCache.addData(DataCache.java:72) at org.eclipse.birt.report.engine.emitter.excel.layout.ExcelLayoutEngine.addDatatoCache(ExcelLayoutEngine.java:1039) at org.eclipse.birt.report.engine.emitter.excel.layout.ExcelLayoutEngine.addEmptyData(ExcelLayoutEngine.java:898) at org.eclipse.birt.report.engine.emitter.excel.layout.ExcelLayoutEngine.addData(ExcelLayoutEngine.java:870) at org.eclipse.birt.report.engine.emitter.excel.layout.ExcelLayoutEngine.addImageData(ExcelLayoutEngine.java:695) at org.eclipse.birt.report.engine.emitter.excel.ExcelEmitter.startImage(ExcelEmitter.java:441) at org.eclipse.birt.report.engine.emitter.CompositeContentEmitter.startImage(CompositeContentEmitter.java:274) at org.eclipse.birt.report.engine.emitter.ContentEmitterUtil.startContent(ContentEmitterUtil.java:74) at org.eclipse.birt.report.engine.layout.html.buffer.DummyPageBuffer.startContent(DummyPageBuffer.java:125) at org.eclipse.birt.report.engine.layout.html.HTMLLeafItemLM.start(HTMLLeafItemLM.java:67) at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:139) at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70) at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout(HTMLPageLM.java:90) at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:99) at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:170) ... 32 more Reproducible: Always Steps to Reproduce: 1. Open report designer and create a blank report. 2. Insert an embedded image and set width of the image to a percent value, for instance: 100% 3. Value of height is not relevant in this case. 4. Click on Excel export in designer toolbar to create an Excel report. 5. The stacktrace appears. 6. All other emitter works fine.

Files changed in fix:
engine/org.eclipse.birt.report.engine.emitter.prototype.excel/src/org/eclipse/birt/report/engine/emitter/excel/ImageData.java engine/org.eclipse.birt.report.engine.emitter.prototype.excel/src/org/eclipse/birt/report/engine/emitter/excel/layout/ExcelLayoutEngine.java