Community
Participate
Working Groups
Build Identifier: 2.5.2 We use BIRT engine API to generate MS word document in our code, but we get NPE when we upgrade to Eclipse 3.5.2: ========================================= Jun 3, 2010 4:09:02 PM org.eclipse.birt.report.engine.api.impl.RunTask doRun SEVERE: An error happened while running the report. Cause: Throwable occurred: java.lang.NullPointerException at org.eclipse.birt.report.engine.nLayout.area.impl.TableArea.s plit(TableArea.java:296) at org.eclipse.birt.report.engine.nLayout.area.impl.BlockContai nerArea._split(BlockContainerArea.java:366) at org.eclipse.birt.report.engine.nLayout.area.impl.BlockContai nerArea.split(BlockContainerArea.java:308) at org.eclipse.birt.report.engine.nLayout.area.impl.BlockContai nerArea._split(BlockContainerArea.java:366) at org.eclipse.birt.report.engine.nLayout.area.impl.BlockContai nerArea.split(BlockContainerArea.java:308) at org.eclipse.birt.report.engine.nLayout.area.impl.BlockContai nerArea._split(BlockContainerArea.java:366) at org.eclipse.birt.report.engine.nLayout.area.impl.BlockContai nerArea.split(BlockContainerArea.java:308) at org.eclipse.birt.report.engine.nLayout.area.impl.RowArea._sp lit(RowArea.java:318) =========================================== In Eclipse 3.5.2, the engine is org.eclipse.birt.report.engine_2.5.2.v20100210.jar, after checking CVS of BIRT, we find it has been fixed start from version 1.21.2.1 and 1.22 around 2010-05-10, http://dev.eclipse.org/viewcvs/index.cgi/source/org.eclipse. birt.report.engine/src/org/eclipse/birt/report/engine/nLayou t/area/impl/TableArea.java?root=BIRT_Project&view=log So could BIRT guys create a feature patch(need since Eclipse 3.4.x, http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.pde.doc.user/guide/tools/project_wizards/new_feature_patch.htm) based on Eclipse 3.5.2 for this fix? we need it in our product. Thanks much! --Alex Reproducible: Always
Can you attach your code? Can you double check if you did set "doc" as output format? Generating word document doesn't use any code in package org.eclipse.birt.report.engine.nLayout.area.*
(In reply to comment #1) > Can you attach your code? Can you double check if you did set "doc" as output > format? > Generating word document doesn't use any code in package > org.eclipse.birt.report.engine.nLayout.area.* The exception happened on generating step but rendering step, we do set "doc" in the option in the rendering step. ================= public void doGeneration(IProgressMonitor monitor){ MethodConfiguration config = options.getConfig(); String designName = outputPath + File.separator + config.getName() + ".rptdesign"; //$NON-NLS-1$ IReportRunnable design = null; try { design = engine.openReportDesign(designName); } catch (EngineException e1) { logger.log(Level.SEVERE, PublishingDocResource.openReportDesignFail, e1); return; } runTask = engine.createRunTask(design); ReportDesignHandle designHandle = (ReportDesignHandle)design.getDesignHandle(); if(designHandle.findParameter(TemplateManager.PARAM_SHOWDESCRIPTORS)!=null) runTask.setParameterValue(TemplateManager.PARAM_SHOWDESCRIPTORS, options.isShowDescriptorsInNavigationTree()); if(designHandle.findParameter(TemplateManager.PARAM_PUBLISHDESCRIPTORS)!=null) runTask.setParameterValue(TemplateManager.PARAM_PUBLISHDESCRIPTORS, options.isShowRelatedDescriptors()); designHandle.close(); docFile = outputPath+File.separator+config.getName()+".rptdocument"; //$NON-NLS-1$ monitor.subTask(PublishingDocResource.generatingReportDocument); runTask.setAppContext(new HashMap()); Runnable runnable = new Runnable(){ public void run() { try { // Context.enter(); runTask.run(docFile); // Context.exit(); } catch (EngineException e) { logger.log(Level.SEVERE, "", e); //$NON-NLS-1$ } } }; Thread th = new Thread(runnable); th.start(); while(runTask.getStatus()==IEngineTask.STATUS_NOT_STARTED || runTask.getStatus()==IEngineTask.STATUS_RUNNING){ if(monitor.isCanceled()){ runTask.cancel(); } try { Thread.sleep(100); } catch (InterruptedException e) { logger.log(Level.WARNING, "", e); //$NON-NLS-1$ } } // runTask.close(); if(runTask.getStatus()!=IEngineTask.STATUS_SUCCEEDED) status = IStatus.ERROR; runTask = null; config = null; Runtime.getRuntime().gc(); } public void doPresentation(IProgressMonitor monitor){ if(status == IStatus.ERROR) return; IReportDocument doc = null; try { // doc = engine.openReportDocument(docFile); doc = ReportDocument.getInstance(engine, docFile, toc); } catch (EngineException e1) { PublishDocPlugin.getDefault().getLogger().logError(e1); } renderTask = engine.createRenderTask(doc); RenderOption option = new RenderOption(); option.setOption(PDFRenderOption.FIT_TO_PAGE, false); option.setOption(PDFRenderOption.PAGEBREAK_PAGINATION_ONLY, false); option.setOption(PDFRenderOption.HTML_PAGINATION, false); output = options.getOutputFilename(); option.setOutputFileName(output); if(options.getOutputFormat()==PublishDocOptions.OUTPUT_FORMAT_PDF) option.setOutputFormat(IRenderOption.OUTPUT_FORMAT_PDF); else if(options.getOutputFormat()==PublishDocOptions.OUTPUT_FORMAT_MSWORD) option.setOutputFormat("doc"); //$NON-NLS-1$ option.setSupportedImageFormats("JPG;PNG;BMP;SVG"); //$NON-NLS-1$ // option.setOption("htmlPagination", Boolean.TRUE); //$NON-NLS-1$ renderTask.setRenderOption(option); monitor.subTask(PublishingDocResource.renderingReport); renderTask.setAppContext(new HashMap()); Runnable runnable = new Runnable(){ public void run() { try { // Context.enter(); renderTask.render(); // Context.exit(); } catch (EngineException e) { PublishDocPlugin.getDefault().getLogger().logError(e); } } }; Thread th = new Thread(runnable); th.start(); while(renderTask.getStatus()==IEngineTask.STATUS_NOT_STARTED || renderTask.getStatus()==IEngineTask.STATUS_RUNNING){ if(monitor.isCanceled()){ renderTask.cancel(); } try { Thread.sleep(100); } catch (InterruptedException e) { PublishDocPlugin.getDefault().getLogger().logError(e); } } // renderTask.close(); doc.close(); if(renderTask.getStatus()==IEngineTask.STATUS_SUCCEEDED) status = IStatus.OK; renderTask = null; } =================
defer to future.
Please ignore the last operation
(In reply to comment #0) > Build Identifier: 2.5.2 > > We use BIRT engine API to generate MS word document in our code, but we get NPE > when we upgrade to Eclipse 3.5.2: > Can you preview the report as DOC in BIRT designer 2.5.2?
Created attachment 175683 [details] provide the patch for this bug
This bug exists in 2.6.0M3-2.6.0M7, it had been fixed since 2.6.0RC1 fixed.
Verified in build (2.6.1.v20100915-1750).