Although setting the onErrorType to blank on the image component of a report, errors occurring during the execution of the image expression do not get caught. And as a result the report generation fails.
With the help of Teodor and Lucian we found that the onErrorType attribute of the image element is applicable only to errors that occur during the loading of images from files or input streams.
It does not cover errors raised by the image expression at evaluation time. It has been like that for many years.
In cases where users are writing complex expressions to retrieve or manipulate images or are working with proprietary dataproviders, it would be beneficial and make sense to trap errors during image expression evaluation time as well. Here are some sample scenario's to reproduce the errors:
- Attached to this bugreport I added a sample report using a complex image expression. The sample report uses the empty data source to run. The expression fails and as a result, the report generation failed despite setting onErrorType to Blank.
- In my particular case I'd written a function to retrieve scaled images. The function had the following signature public BufferedImage getScaledImageFieldValue(String fieldname, int maxWidth, int maxHeight) throws JRException. A JRException was thrown in case of IO problems. Because the errors at expression evaluation time are not caught, the report generation failed when an IO problem occurred despite setting onErrorType to Blank.