| Summary: | Require for patch: NPE when generate MS word using BIRT | ||||||
|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | Alex Chen <xiaodic> | ||||
| Component: | BIRT | Assignee: | Gang Liu <hustlg> | ||||
| Status: | VERIFIED FIXED | QA Contact: | Xiaodan Wang <xwang> | ||||
| Severity: | major | ||||||
| Priority: | P3 | CC: | bluesoldier, jouyang | ||||
| Version: | unspecified | ||||||
| Target Milestone: | 2.6.1 | ||||||
| Hardware: | PC | ||||||
| OS: | Windows XP | ||||||
| Whiteboard: | Obsolete | ||||||
| Attachments: |
|
||||||
|
Description
Alex Chen
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). |