Bug 201672 ClassCastException when rendering a crosstab report
I encountered follow exceptions for attached report(with 50000 data records or so): org.eclipse.birt.report.service.api.ReportServiceException: Error happened while running the report; nested exception is: java.lang.ClassCastException: org.eclipse.birt.data.engine.olap.data.impl.aggregation.sort.AggrValueOnlyResultRow Stack Trace: org.eclipse.birt.data.engine.olap.data.util.StructureDiskArray.writeObject(StructureDiskArray.java:52) org.eclipse.birt.data.engine.olap.data.util.BaseDiskArray.add(BaseDiskArray.java:69) org.eclipse.birt.data.engine.olap.data.util.BufferedStructureArray.add(BufferedStructureArray.java:62) org.eclipse.birt.data.engine.olap.data.impl.aggregation.sort.AggregationSortHelper.populateAggrDiskArray(AggregationSortHelper.java:83) org.eclipse.birt.data.engine.olap.data.impl.aggregation.sort.AggregationSortHelper.sort(AggregationSortHelper.java:52) org.eclipse.birt.data.engine.olap.data.impl.aggregation.sort.AggrSortHelper.sort(AggrSortHelper.java:119) org.eclipse.birt.data.engine.olap.data.api.CubeQueryExecutorHelper.applyAggrSort(CubeQueryExecutorHelper.java:523) org.eclipse.birt.data.engine.olap.data.api.CubeQueryExecutorHelper.execute(CubeQueryExecutorHelper.java:326) org.eclipse.birt.data.engine.olap.query.view.QueryExecutor.populateRs(QueryExecutor.java:132) org.eclipse.birt.data.engine.olap.query.view.QueryExecutor.execute(QueryExecutor.java:93) org.eclipse.birt.data.engine.olap.query.view.BirtCubeView.getCubeCursor(BirtCubeView.java:105) org.eclipse.birt.data.engine.olap.impl.query.CubeQueryResults.getCubeCursor(CubeQueryResults.java:70) org.eclipse.birt.report.engine.data.dte.CubeResultSet.(CubeResultSet.java:78) org.eclipse.birt.report.engine.data.dte.DteDataEngine.doExecuteCube(DteDataEngine.java:236) org.eclipse.birt.report.engine.data.dte.DteDataEngine.doExecuteQuery(DteDataEngine.java:122) org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.execute(AbstractDataEngine.java:182) org.eclipse.birt.report.engine.executor.ExecutorManager$ExecutorContext.executeQuery(ExecutorManager.java:403) org.eclipse.birt.report.item.crosstab.core.re.executor.BaseCrosstabExecutor.executeQuery(BaseCrosstabExecutor.java:103) org.eclipse.birt.report.item.crosstab.core.re.executor.CrosstabReportItemExecutor.execute(CrosstabReportItemExecutor.java:102) org.eclipse.birt.report.engine.executor.ExtendedItemExecutor.execute(ExtendedItemExecutor.java:57) org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportItemExecutor.execute(WrappedReportItemExecutor.java:45) org.eclipse.birt.report.engine.internal.executor.dup.SuppressDuplicateItemExecutor.execute(SuppressDuplicateItemExecutor.java:42) org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportItemExecutor.execute(WrappedReportItemExecutor.java:45) org.eclipse.birt.report.engine.internal.executor.l18n.LocalizedReportItemExecutor.execute(LocalizedReportItemExecutor.java:33) org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:63) org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout(HTMLPageLM.java:80) org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:104) org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:140) org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:68) org.eclipse.birt.report.service.ReportEngineService.runAndRenderReport(Unknown Source) org.eclipse.birt.report.service.ReportEngineService.runAndRenderReport(Unknown Source) org.eclipse.birt.report.service.BirtViewerReportService.runAndRenderReport(Unknown Source) org.eclipse.birt.report.service.actionhandler.BirtGetPageAllActionHandler.__execute(Unknown Source) org.eclipse.birt.report.service.actionhandler.AbstractBaseActionHandler.execute(Unknown Source) org.eclipse.birt.report.soapengine.processor.AbstractBaseDocumentProcessor.__executeAction(Unknown Source) org.eclipse.birt.report.soapengine.processor.AbstractBaseComponentProcessor.executeAction(Unknown Source) org.eclipse.birt.report.soapengine.processor.BirtDocumentProcessor.handleGetPageAll(Unknown Source) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) java.lang.reflect.Method.invoke(Unknown Source) org.eclipse.birt.report.soapengine.processor.AbstractBaseComponentProcessor.process(Unknown Source) org.eclipse.birt.report.soapengine.endpoint.BirtSoapBindingImpl.getUpdatedObjects(Unknown Source) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) java.lang.reflect.Method.invoke(Unknown Source) org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:397) org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:186) org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323) org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32) org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118) org.apache.axis.SimpleChain.invoke(SimpleChain.java:83) org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:453) org.apache.axis.server.AxisServer.invoke(AxisServer.java:281) org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699) org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherServlet.doPost(Unknown Source) javax.servlet.http.HttpServlet.service(HttpServlet.java:709) org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214) org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825) org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738) org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526) org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) java.lang.Thread.run(Unknown Source)
data/org.eclipse.birt.data/src/org/eclipse/birt/data/engine/olap/data/impl/aggregation/sort/AggregationSortHelper.java
private List keys;
	AggrResultRowComparator( List keys )
	{
		this.keys = keys;
	}
	public int compare( Object arg0, Object arg1 )
	{
		IAggregationResultRow obj1 = (IAggregationResultRow) arg0;
		IAggregationResultRow obj2 = (IAggregationResultRow) arg1;
		List keyValue1 = new ArrayList( );
		List keyValue2 = new ArrayList( );
		int offset = 0;
		for ( int i = 0; i < keys.size( ); i++ )
		{
			SortKey sk = (SortKey) keys.get( i );
			for ( int j = 0; j < sk.getAggrKeys( ).length; j++ )
			{
				keyValue1.add( obj1.getAggregationValues( )[offset+j] );
				keyValue2.add( obj2.getAggregationValues( )[offset+j] );
			}
			keyValue1.add( obj1.getLevelMembers( )[sk.getLevelKeyIndex( )].getKeyValues( )[0] );
			keyValue2.add( obj2.getLevelMembers( )[sk.getLevelKeyIndex( )].getKeyValues( )[0] );
			offset = sk.getAggrKeys( ).length;
		}
		return CompareUtil.compare( AggregationSortHelper.toObjArray( keyValue1 ),
				AggregationSortHelper.toObjArray( keyValue2 ),
				AggregationSortHelper.toDirectionArray( this.keys ) );
	}
}