Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 318679

Summary: Error on generating Excel report from RAP application
Product: z_Archived Reporter: d.zinato
Component: BIRTAssignee: JingwenShen <jingwen.shen>
Status: CLOSED DUPLICATE QA Contact: Maggie Shen <lshen>
Severity: normal    
Priority: P3 CC: bluesoldier, jouyang
Version: 2.6.0   
Target Milestone: 2.6.1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
bronken report and related code none

Description d.zinato CLA 2010-07-02 05:21:49 EDT
Created attachment 173281 [details]
bronken report and related code

I updated my Eclipse up to Eclipse Helios, and I installed BIRT 2.6 and RAP 1.3.
Now, i have a problem with an old excel report, that currently works fine with RAP 1.3 M7 and Birt 2.5.
When i try to create report, i obtain an empty file with this error message:

2-lug-2010 11.00.51 org.eclipse.birt.report.engine.api.impl.RunAndRenderTask doRun
GRAVE: An error happened while running the report. Cause:
java.lang.NullPointerException
	at org.eclipse.birt.report.engine.emitter.html.util.HTMLEmitterUtil.buildOverflowStyle(HTMLEmitterUtil.java:289)
	at org.eclipse.birt.report.engine.emitter.html.HTMLVisionOptimize.buildCellStyle(HTMLVisionOptimize.java:362)
	at org.eclipse.birt.report.engine.emitter.html.HTMLReportEmitter.startCell(HTMLReportEmitter.java:2135)
	at org.eclipse.birt.report.engine.emitter.CompositeContentEmitter.startCell(CompositeContentEmitter.java:233)
	at org.eclipse.birt.report.engine.layout.html.HTMLTableLayoutEmitter.startCell(HTMLTableLayoutEmitter.java:701)
	at org.eclipse.birt.report.engine.emitter.ContentEmitterUtil.startContent(ContentEmitterUtil.java:59)
	at org.eclipse.birt.report.engine.layout.html.buffer.DummyPageBuffer.startContainer(DummyPageBuffer.java:106)
	at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.start(HTMLStackingLM.java:50)
	at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:139)
	at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.resumeLayout(HTMLInlineStackingLM.java:111)
	at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.layoutNodes(HTMLInlineStackingLM.java:160)
	at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
	at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)
	at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)
	at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)
	at org.eclipse.birt.report.engine.layout.html.HTMLTableLM.layoutChildren(HTMLTableLM.java:132)
	at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)
	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:172)
	at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:75)
	at osgi.tkdata.ui.rap.pometonpremix.ReportViewPart.runReport(ReportViewPart.java:44)
	at osgi.tkdata.ui.rap.pometonpremix.ExcelView.createExcelReport(ExcelView.java:80)
	at osgi.tkdata.ui.rap.pometonpremix.ExcelView.doReport(ExcelView.java:67)
	at osgi.tkdata.ui.rap.pometonpremix.ReportViewPart.createPartControl(ReportViewPart.java:95)
	at org.eclipse.ui.internal.ViewReference.createPartHelper(ViewReference.java:371)
	at org.eclipse.ui.internal.ViewReference.createPart(ViewReference.java:230)
	at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:594)
	at org.eclipse.ui.internal.Perspective.showView(Perspective.java:2091)
	at org.eclipse.ui.internal.WorkbenchPage.busyShowView(WorkbenchPage.java:1021)
	at org.eclipse.ui.internal.WorkbenchPage$19.run(WorkbenchPage.java:3662)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:66)
	at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage.java:3659)
	at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage.java:3635)
	at osgi.tkdata.ui.rap.pometonpremix.PometonPremixUIUtil.showView(PometonPremixUIUtil.java:151)
	at osgi.tkdata.ui.rap.pometonpremix.TrackingMixerView.doReport(TrackingMixerView.java:482)
	at osgi.tkdata.ui.rap.pometonpremix.TrackingMixerView.access$6(TrackingMixerView.java:464)
	at osgi.tkdata.ui.rap.pometonpremix.TrackingMixerView$7.widgetSelected(TrackingMixerView.java:367)
	at org.eclipse.swt.events.SelectionEvent.dispatchToObserver(SelectionEvent.java:194)
	at org.eclipse.rwt.internal.events.Event.processEvent(Event.java:44)
	at org.eclipse.swt.events.TypedEvent.processEvent(TypedEvent.java:161)
	at org.eclipse.swt.events.TypedEvent.executeNext(TypedEvent.java:201)
	at org.eclipse.swt.widgets.Display.runPendingMessages(Display.java:1100)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1090)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2390)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2351)
	at org.eclipse.ui.internal.Workbench.access$5(Workbench.java:2206)
	at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:424)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.jface.internal.databinding.realmadapter.RealmAdapter.run(RealmAdapter.java:44)
	at org.eclipse.rap.ui.internal.RealmAdapterHook.runWithDefault(RealmAdapterHook.java:48)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:427)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:157)
	at osgi.tkdata.fragment.ui.rap.pometonpremix.EntryPoint1.createUI(EntryPoint1.java:81)
	at org.eclipse.rwt.internal.lifecycle.EntryPointManager.createUI(EntryPointManager.java:92)
	at org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.createUI(RWTLifeCycle.java:244)
	at org.eclipse.rwt.internal.lifecycle.RWTLifeCycle$UIThreadController.run(RWTLifeCycle.java:113)
	at java.lang.Thread.run(Unknown Source)
	at org.eclipse.rwt.internal.lifecycle.UIThread.run(UIThread.java:102)

In the same application, i have other excel reports that still work fine after the update to helios/birt 2.6, so i think that could be a problem related to missing bundle(s) or broken compatibility.

I splitted code for report generation into several Java files, and the report itself is populated by an hashmap (loaded into RAP session and read into report by Javascript code).
This is the snippet about the hashmap generation:

private void doReport()
	{
		try
		{
			//verifico se ci sono dati
			if(currSelectedTracking==null)
			{				
				MessageDialog.openError(this.top.getShell(), "Errore", "Selezionare una riga!");
				return;
			}
			
			String reportName="tracking_report.rptdesign";
			//Setto i parametri di utilizzo per il report!
			RWT.getSessionStore().setAttribute(SessionKeyEnumeration.REPORT_NAME, reportName);			
			RWT.getSessionStore().setAttribute(SessionKeyEnumeration.REPORT_VARIABLES_TABLE, this.getReportVariablesTable(currSelectedTracking));
			//Prima CHIUDO, se aperta
			PometonPremixUIUtil.closeView("PometonPremixUI.excelview");
			//Poi riapro, per far scatenare il DWNLOAD
			PometonPremixUIUtil.showView("PometonPremixUI.excelview");				 
		}
		catch(Exception err)
		{
			this.logger.log(LogService.LOG_ERROR,"doReport error:"+LogUtils.getMessageAndStackTrace(err));
		}
	}
	
	private Dictionary<String,Object> getReportVariablesTable(PremixTracking track)
	{
		Dictionary<String,Object> result=new Hashtable<String, Object>();
		
		try
		{	
			final String recipeProduct=track.getRecipeName();			
			final Date startexec=track.getStartExecution();
			final Date endexec=track.getStopExecution();			
			final String startDate=DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(startexec);
			final String endDate=DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(endexec);
						
			result.put("recipe_name", recipeProduct);
			result.put("revision", track.getRevision()!=null?track.getRevision():"");
			result.put("batch", track.getBatch()!=null?track.getBaseWeight():"");
			result.put("base_weight", track.getBaseWeight());
			result.put("extra_weight", track.getExtraWeight());
			result.put("start_execution", startDate);
			result.put("stop_execution", endDate);
			result.put("container_weight_1", track.getContainerWeight1());
			result.put("container_weight_2", track.getContainerWeight2());
			result.put("container_weight_3", track.getContainerWeight3());
			result.put("container_weight_4", track.getContainerWeight4());
			result.put("container_weight_5", track.getContainerWeight5());
			result.put("container_weight_6", track.getContainerWeight6());
			result.put("container_weight_7", track.getContainerWeight7());
			result.put("container_weight_8", track.getContainerWeight8());
			result.put("container_weight_9", track.getContainerWeight9());
			result.put("container_weight_10", track.getContainerWeight10());	
			
			//....SOME STUFF...

			result.put("recipe_weight_1", recipeFbWeight[0]);
			result.put("recipe_weight_2", recipeFbWeight[1]);                 
			result.put("recipe_weight_3", recipeFbWeight[2]);                 
			result.put("recipe_weight_4", recipeFbWeight[3]);                 
			result.put("recipe_weight_5", recipeFbWeight[4]);                 
			result.put("recipe_weight_6", recipeFbWeight[5]);                 
			result.put("recipe_weight_7", recipeFbWeight[6]);                 
			result.put("recipe_weight_8", recipeFbWeight[7]);                 
			result.put("recipe_weight_9", recipeFbWeight[8]);                 
			result.put("recipe_weight_10", recipeFbWeight[9]);    
			
			result.put("recipe_component_1", recipeFbName[0]);
			result.put("recipe_component_2", recipeFbName[1]);                 
			result.put("recipe_component_3", recipeFbName[2]);                 
			result.put("recipe_component_4", recipeFbName[3]);                 
			result.put("recipe_component_5", recipeFbName[4]);                 
			result.put("recipe_component_6", recipeFbName[5]);                 
			result.put("recipe_component_7", recipeFbName[6]);                 
			result.put("recipe_component_8", recipeFbName[7]);                 
			result.put("recipe_component_9", recipeFbName[8]);                 
			result.put("recipe_component_10", recipeFbName[9]);		
		}
		catch(Exception err)
		{
			if(this.logger!=null)
				this.logger.log(LogService.LOG_ERROR, "getReportVariablesTable ERROR:"+LogUtils.getMessageAndStackTrace(err));
			else err.printStackTrace();
		}
		return result;
	}

I attached the report and the code about file generation from RAP view.
Comment 1 d.zinato CLA 2010-07-05 04:31:09 EDT
I don't know if these informations can be useful...i hope so.

I commented all javascript code into report, and i run the BIRT Report Viewer.
The report is correctly displayed, and i can export it in excel without error.

This could be a problem about bundles used in my run configuration (absence of bundles or conflict), what do you think? The "Validate Bundles" button displays 
"No problem were detected", but the situation at compile time is different than situation at run time....
Comment 2 Xiaoying Gu CLA 2010-08-18 04:22:48 EDT
This should be a duplicated one to https://bugs.eclipse.org/bugs/show_bug.cgi?id=318062, which has been fixed in latest 2.6.1 build.

Would you please have a re-try with Helios SR1 RC1?
Comment 3 d.zinato CLA 2010-08-18 12:36:36 EDT
I can retry, but i don't understand: i need of Birt 2.6.1 with current Helios release, or Birt 2.6.1 with Helios SR1 RC1?
In both case, i have to build the source code of BIRT and Helios, or are available the precompiled builds?
tnx
Comment 4 Xiaoying Gu CLA 2010-08-18 22:17:38 EDT
(In reply to comment #3)
> I can retry, but i don't understand: i need of Birt 2.6.1 with current Helios
> release, or Birt 2.6.1 with Helios SR1 RC1?
> In both case, i have to build the source code of BIRT and Helios, or are
> available the precompiled builds?
> tnx

You can install the BIRT 2.6.1 RC1 from update site:
http://download.eclipse.org/birt/update-site/2.6-interim/ 

It should work with Helios build and you don't need to build source codes of BIRT and Helios
Comment 5 d.zinato CLA 2010-08-31 03:07:21 EDT
I tried to install BIRT 2.6.1 RC1 from site.
Before installation, i completely removed the old BIRT version from Eclipse.

I obtained this error message:

Cannot complete the install because one or more required items could not be found.
  Software being installed: BIRT Framework 2.6.1.v20100709a-9iF787JGLY4z0p2GMBCrsdqw60Um (org.eclipse.birt.feature.group 2.6.1.v20100709a-9iF787JGLY4z0p2GMBCrsdqw60Um)
  Missing requirement: BIRT Sample Database Connection Profile UI Plug-in 2.6.1.v20100805 (org.eclipse.birt.report.data.oda.jdbc.dbprofile.sampledb.ui 2.6.1.v20100805) requires 'bundle org.eclipse.datatools.connectivity.apache.derby.ui [1.0.3,2.0.0)' but it could not be found
  Cannot satisfy dependency:
    From: BIRT Framework 2.6.1.v20100709a-9iF787JGLY4z0p2GMBCrsdqw60Um (org.eclipse.birt.feature.group 2.6.1.v20100709a-9iF787JGLY4z0p2GMBCrsdqw60Um)
    To: org.eclipse.birt.report.data.oda.jdbc.dbprofile.sampledb.ui [2.6.1.v20100805]

Is this procedure right?or i need to update Birt 2.6.1 RC1 on existing 2.6.0?
I tried this way, because the update procedure raised other error messages....
Comment 6 Xiaoying Gu CLA 2010-08-31 03:22:18 EDT
Please see the bug comment: https://bugs.eclipse.org/bugs/show_bug.cgi?id=323323#c1 

Please add http://download.eclipse.org/releases/maintenance to your available update site list, the required dtp 1.8.1 new bundle is only available on the helios maintancence site and dtp update site.
Comment 7 Xiaoying Gu CLA 2010-09-15 02:41:21 EDT
Marked as duplicated.

Feel free to reopen if you still can reproduce this issue.

*** This bug has been marked as a duplicate of bug 318062 ***