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

Bug 358107

Summary: Report with scripted dataset: There is an error in saving files of data set cache.
Product: z_Archived Reporter: Henning von Bargen <h.vonbargen>
Component: BIRTAssignee: Birt-ReportDesigner <Birt-ReportDesigner-inbox>
Status: CLOSED INVALID QA Contact:
Severity: major    
Priority: P3 CC: bluesoldier, h.vonbargen
Version: 3.7.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Henning von Bargen CLA 2011-09-19 08:37:04 EDT
Build Identifier: M20110909-1335

I have a complex report with several JDBC datasets and one scripted dataset.
When I try to open the preview in the Designer, it shows an error (in red) at the end of the (incomplete) output:
The following items have errors: 


List LayoutbloeckeList: 
- There is an error in saving files of data set cache.
org.eclipse.birt.report.engine.executor.ApplicationClassLoader (Element ID:970) 
data.engine.datasetcache.save.error ( 2 time(s) )
detail : org.eclipse.birt.report.engine.api.EngineException: There is an error in saving files of data set cache.
org.eclipse.birt.report.engine.executor.ApplicationClassLoader (Element ID:970)
	at org.eclipse.birt.report.engine.executor.ExecutionContext.addException(ExecutionContext.java:1214)
	at org.eclipse.birt.report.engine.executor.ExecutionContext.addException(ExecutionContext.java:1193)
	at org.eclipse.birt.report.engine.executor.QueryItemExecutor.executeQuery(QueryItemExecutor.java:96)
...
caused by:
Caused by: java.io.NotSerializableException: org.eclipse.birt.report.engine.executor.ApplicationClassLoader
...

The source for the scripted DS is:

open:

BerichtResultateHelper.blockInfoI = 0;

fetch:

if (BerichtResultateHelper.blockInfoI < BerichtResultateHelper.blockInfoL.length) {
	var block_key = BerichtResultateHelper.blockInfoL[BerichtResultateHelper.blockInfoI];
	var info = BerichtResultateHelper.blockInfoM[block_key]; 
	row["BLOCK_KEY"] = info.BLOCK_KEY;
	row["BLOCK_UEBERSCHRIFT_TEXT"] = info.BLOCK_UEBERSCHRIFT_TEXT;
	row["LAYOUT"] = info.LAYOUT;
	row["TEILPROBE"] = info.TEILPROBE;
	row["TEILPROBENBEZ1_TEXT"] = info.TEILPROBENBEZ1_TEXT;
	row["TEILPROBENBEZ2_TEXT"] = info.TEILPROBENBEZ2_TEXT;
	row["TEILPROBENBEZ3_TEXT"] = info.TEILPROBENBEZ3_TEXT;
	BerichtResultateHelper.blockInfoI++;
	return true;
}
return false;

The other events are not used.

The same report works fine with BIRT 2.6.2 !



Reproducible: Always
Comment 1 Henning von Bargen CLA 2011-09-20 02:52:06 EDT
More Info:

My observations were not quite correct.

The scripted dataset contains a column "SpaltenInfo" of type "Java Object".
In the onFetch event, there is a line:

var info = ...; 
// info is assigned a Javascript object of the (user-defined) type Map,
// which is just an ordinary object with a more useful toString method.

row["SpaltenInfo"] = info;

As a workaround, I replaced my Javascript Map object with an java.util.HashMap
and changed the code in other places of the report where I access keys/values correspondingly; 
e.g. I replaced row["SpaltenInfo"]["someKey"] with row["SpaltenInfo"].get("someKey")

After this change, the report worked.

So the reason for the error seems to be that I used a JavaScript object for a column value.