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

Bug 321762

Summary: Classpath issues with Chart Builder
Product: z_Archived Reporter: Jason Weathersby <jasonweathersby>
Component: BIRTAssignee: Birt-ReportDesigner <Birt-ReportDesigner-inbox>
Status: VERIFIED FIXED QA Contact: Xiaoying Gu <bluesoldier>
Severity: normal    
Priority: P3 CC: bluesoldier, xiaofeng.zhang, yi.wang
Version: 2.6.0   
Target Milestone: 2.6.1   
Hardware: PC   
OS: Windows 7   
Whiteboard: Obsolete
Attachments:
Description Flags
projects to reproduce the issue
none
chart builder problem none

Description Jason Weathersby CLA 2010-08-04 13:08:12 EDT
When referencing an external java project in a scripted datasource, chart builder complains about not locating the class.  A normal table works fine.
See the attached two projects.  To reproduce import both projects and configure the designer classpath to point to the java project.  There are two reports in the report project.  One with a table and no chart that works fine.  Another with the same table and a chart bound to the table (this works but still get errror in builder).  Open the report with no chart and try to add a chart to report and bind it to the dataset.  Set the category value to row["col2"].getMake(); set the value series to row["col1"].

Note the issue is slightly different in 2.6.1.  No error in the builder but the chart does not produce the right data.

Jason
Comment 1 Jason Weathersby CLA 2010-08-04 13:09:09 EDT
Created attachment 175853 [details]
projects to reproduce the issue
Comment 2 Jason Weathersby CLA 2010-08-04 15:03:30 EDT
This also may have something to do witch caching the resultset that has a java object as one of the columns.  I noticed that if I take the report with no chart and just add the same table that the column that contains the java object then shows null for both.
Comment 3 Jason Weathersby CLA 2010-08-04 16:22:55 EDT
Some more details.  This does appear to be 2 different bugs.  The problem with using the dataset twice (either 2 tables or a table and a chart) appears to have to do with the reading from cache.  The data engine does not seem to locate the class.  In the ObjectSecurity.java class this line:

	public static Object readObject( final ObjectInputStream is )
			throws IOException, DataException, ClassNotFoundException
	{
		try
		{
			if ( is == null )
				return null;
			return AccessController.doPrivileged( new PrivilegedExceptionAction<Object>( ) {

				public Object run( ) throws IOException, ClassNotFoundException
				{
					return is.readObject( );
				}
			} );

throws the classnotfound exception, when it is looking for the java object for the column.  This exception is swallowed in the ResultObjectUtil.java class when it tries to read the object from cache.

					try
					{
						obs[j] = ObjectSecurity.readObject( ois );
					}
					catch ( Exception e )
					{
						// impossible
					}

I manually added my class to the data engine plugin and it worked, but I still get the error in the chart builder.  Attached is a screen shot.
Comment 4 Jason Weathersby CLA 2010-08-04 16:24:03 EDT
Created attachment 175888 [details]
chart builder problem
Comment 5 Yi Wang CLA 2010-08-10 03:59:54 EDT
Fixed.
The cause of the issue is that chart's live preview did not support resolving class path from the preference.
Comment 6 Jason Weathersby CLA 2010-08-10 09:42:08 EDT
Does this also fix the data engine not finding the class when using a java object data type when a data set is used more than once?
Comment 7 Yi Wang CLA 2010-08-10 22:08:47 EDT
(In reply to comment #6)
> Does this also fix the data engine not finding the class when using a java
> object data type when a data set is used more than once?

I'm afraid not. What does that mean? How can I reproduce it?  Your attached reports work fine, except that the chart cannot work in chart builder, and I've fixed this issue.
Comment 8 Jason Weathersby CLA 2010-08-10 22:12:29 EDT
Sorry, I should have been clearer.  Drag the dataset above the chart so that you have a table and the chart tied to the same dataset and run the report and it will fail.
Comment 9 Xiaoying Gu CLA 2010-08-11 04:39:59 EDT
(In reply to comment #8)
> Sorry, I should have been clearer.  Drag the dataset above the chart so that
> you have a table and the chart tied to the same dataset and run the report and
> it will fail.

This issue has been fixed in DTE side.
Comment 10 Xiaoying Gu CLA 2010-08-11 23:28:20 EDT
Verified in daily build 2.6.1.v20100812-0630