Hi,<br />
<br />
I have integrated the BIRT engine into a web application - this was all reasonably successful and it has now been released. A user of the system has discovered an issue and having looked into it a bit it seems it is related to parameters of type 'date'.<br />
<br />
I have created a report (see attached - double click on section for drill through) that works successfully in the BIRT Eclipse preview tab but when deployed to our applciation fails with a ClassCastException (java.util.Date cannot be cast to java.sql.Date).<br />
<br />
I have written some custom code for the application that deals with parameters - it expects 'date' parameter types to internally be stored as java.sql.Date objects, but this date parameter passed as a drill down is an instance of java.util.Date.<br />
<br />
I have tested this with a simple report with one drill-down label that passes on the report's one parameter, a date parameter, to itself. This is fine in both the preview tab and my web application. However, the attached report doesn't work in my web app - it is a chart with a drill down link. The drill down link passes two date parameters.<br />
<br />
Having debugged my custom code to handle report parameters and write drill-down links, these two parameters are now java.util.Date objects whereas, in the simpler report, its date parameter was java.sql.Date.<br />
<br />
This is the relevant code that outputs the drill-down link:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
public class ReportingActionsHandler extends HTMLActionHandler implements IHTMLActionHandler
{
...
@Override
protected String buildDrillAction(IAction action, Object context)
{
Map drillParams = action.getParameterBindings();
// 'drillParams' map contains java.util.Date objects for parameters
// of type 'date' for a drill-down pie chart section.
// All other reports tested pass 'date' parameters as java.sql.Date objects.
...
}
...
}
</pre>
<br />
My custom code that causes the ClassCastException:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
public enum ReportParameterDataType
{
...
DATE("date", new Converter<java.sql.Date>()
{
public java.sql.Date parse(String value, Logger logger)
{
...
}
public String format(java.sql.Date value)
{
// ClassCastException thrown on method call

...
}
}),
DATE_TIME("dateTime", new Converter<java.util.Date>()
{
public java.util.Date parse(String value, Logger logger)
{
...
}
public String format(java.util.Date value)
{
...
}
}),
...
}
</pre>
<br />
So my question - is this some error in my report file or is BIRT internally inconsistent?<br />
<br />
Thanks in advance.