Bug 150944 org.eclipse.birt.data.engine.core.DataException when running report using API
I have a report that throws a org.eclipse.birt.data.engine.core.DataException exception (see Stack trace below) whenever I try to run it using the report engine API. The report works perfectly under Eclipse preview, and when viewed in an app server (Tomcat, Weblogic). I use the following code to create the PDF file: private static void executeReport(final String reportFile, final String pdfFile) throws EngineException { //Engine Configuration - set and get temp dir, BIRT home, Servlet context EngineConfig config = new EngineConfig(); config.setEngineHome( birtReportEngineHome ); //Create the report engine ReportEngine engine = new ReportEngine( config ); //Open a report design - use design to modify design, retrieve embedded images etc. IReportRunnable design = engine.openReportDesign(reportFile); //Create task to run the report - use the task to execute and run the report, IRunAndRenderTask task = engine.createRunAndRenderTask(design); //Set Render context to handle url and image locataions PDFRenderContext renderContext = new PDFRenderContext(); renderContext.setEmbededFont(true); HashMap contextMap = new HashMap(); contextMap.put( EngineConstants.APPCONTEXT_PDF_RENDER_CONTEXT, renderContext ); task.setAppContext( contextMap ); //Set rendering options - such as file or stream output, //output format, whether it is embeddable, etc RenderOptionBase options = new RenderOptionBase(); options.setOutputFileName(pdfFile); options.setOutputFormat(RenderOptionBase.OUTPUT_FORMAT_PDF); task.setRenderOption(options); //run the report and destroy the engine task.run(); engine.destroy(); } And when I run the report, I get the following stack trace: SEVERE: A BIRT exception occurred: Can not convert the value of 2006-07-10 to Date type.. See next exception for more information. Can not convert the value of 2006-07-10 to Date type. org.eclipse.birt.data.engine.core.DataException: A BIRT exception occurred: Can not convert the value of 2006-07-10 to Date type.. See next exception for more information. Can not convert the value of 2006-07-10 to Date type. at org.eclipse.birt.data.engine.core.DataException.wrap(DataException.java:114) at org.eclipse.birt.data.engine.expression.ColumnReferenceExpression.evaluate(ColumnReferenceExpression.java:132) at org.eclipse.birt.data.engine.script.ScriptEvalUtil.evalExpr(ScriptEvalUtil.java:501) at org.eclipse.birt.data.engine.executor.transform.group.GroupInstanceSorter.populateGroupBoundaryInfoSortings(GroupInstanceSorter.java:144) at org.eclipse.birt.data.engine.executor.transform.group.GroupInstanceSorter.populateGroupBoundaryInfosSortings(GroupInstanceSorter.java:117) at org.eclipse.birt.data.engine.executor.transform.group.GroupInstanceSorter.doGroupSorting(GroupInstanceSorter.java:62) at org.eclipse.birt.data.engine.executor.transform.group.GroupProcessorManager.doGroupFilteringAndSorting(GroupProcessorManager.java:79) at org.eclipse.birt.data.engine.executor.transform.MultiPassRowProcessor.populateResultSet(MultiPassRowProcessor.java:334) at org.eclipse.birt.data.engine.executor.transform.MultiPassRowProcessor.doPopulation(MultiPassRowProcessor.java:137) at org.eclipse.birt.data.engine.executor.transform.MultiPassRowProcessor.pass(MultiPassRowProcessor.java:103) at org.eclipse.birt.data.engine.executor.transform.ResultSetPopulator.populateResultSet(ResultSetPopulator.java:206) at org.eclipse.birt.data.engine.executor.transform.CachedResultSet.<init>(CachedResultSet.java:69) at org.eclipse.birt.data.engine.executor.DataSourceQuery.execute(DataSourceQuery.java:488) at org.eclipse.birt.data.engine.impl.PreparedOdaDSQuery$OdaDSQueryExecutor.executeOdiQuery(PreparedOdaDSQuery.java:257) at org.eclipse.birt.data.engine.impl.QueryExecutor.execute(QueryExecutor.java:695) at org.eclipse.birt.data.engine.impl.ServiceForQueryResults.executeQuery(ServiceForQueryResults.java:152) at org.eclipse.birt.data.engine.impl.QueryResults.getResultIterator(QueryResults.java:158) at org.eclipse.birt.report.engine.data.dte.DteResultSet.<init>(DteResultSet.java:79) at org.eclipse.birt.report.engine.data.dte.DteDataEngine.doExecuteQuery(DteDataEngine.java:113) at org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.execute(AbstractDataEngine.java:208) at org.eclipse.birt.report.engine.executor.ExecutionContext.executeQuery(ExecutionContext.java:1541) at org.eclipse.birt.report.engine.executor.QueryItemExecutor.executeQuery(QueryItemExecutor.java:62) at org.eclipse.birt.report.engine.executor.TableItemExecutor.execute(TableItemExecutor.java:74) at org.eclipse.birt.report.engine.internal.executor.l18n.LocalizedReportItemExecutor.execute(LocalizedReportItemExecutor.java:35) at org.eclipse.birt.report.engine.layout.content.BlockStackingExecutor.getNextChild(BlockStackingExecutor.java:47) at org.eclipse.birt.report.engine.layout.pdf.PDFBlockStackingLM.traverseChildren(PDFBlockStackingLM.java:72) at org.eclipse.birt.report.engine.layout.pdf.PDFStackingLM.layoutChildren(PDFStackingLM.java:130) at org.eclipse.birt.report.engine.layout.pdf.PDFPageLM.layout(PDFPageLM.java:198) at org.eclipse.birt.report.engine.layout.pdf.PDFReportLayoutEngine.layoutReport(PDFReportLayoutEngine.java:55) at org.eclipse.birt.report.engine.layout.pdf.PDFReportLayoutEngine.layout(PDFReportLayoutEngine.java:68) at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:187) at biz.scarlet.provisioning.xng.reporting.XngReporter.executeReport(XngReporter.java:119) at biz.scarlet.provisioning.xng.reporting.XngReporter.main(XngReporter.java:52) Caused by: org.eclipse.birt.core.exception.BirtException: Can not convert the value of 2006-07-10 to Date type. at org.eclipse.birt.core.data.DataTypeUtil.toDate(DataTypeUtil.java:474) at org.eclipse.birt.core.data.DataTypeUtil.toDate(DataTypeUtil.java:900) at org.eclipse.birt.core.data.DataTypeUtil.toDate(DataTypeUtil.java:398) at org.eclipse.birt.core.data.DataTypeUtil.convert(DataTypeUtil.java:96) at org.eclipse.birt.data.engine.expression.ColumnReferenceExpression.evaluate(ColumnReferenceExpression.java:128) ... 31 more
core/org.eclipse.birt.core/src/org/eclipse/birt/core/data/DataTypeUtil.java
{
	
	private static Map dateTimeholder = new HashMap();
	private static Map dateHolder = new HashMap();
	
	/**
	 * 
	 *
	 */
	private DateFormatHolder(){}
	
	/**
	 * 
	 * @param dateStyle
	 * @param timeStyle
	 * @param locale
	 * @return
	 */
	public static DateFormat getDateTimeInstance( int dateStyle, int timeStyle, ULocale locale )
	{