Jump to content
We've recently updated our Privacy Statement, available here ×

What kind of errors (java exceptions or something else) are catched in the library when the onErrorType attribute on the image component is set to "Blank"


tcleenewerck

Recommended Posts

We had to implement our own function to fetch images because we need to manipulate them before we give them to the Jasper report library. However in case some error occurs we throw a JRException. Although the onErrorType attribute on the image component is set to "Blank" the generation of our report fails. It seems that a JRException is not captured and recognised as an error. As a result the exception propagates and breaks the generation of the report. We've tried to used other types of exceptions such as IOException but that doesn't seem to work as well. 

What kind of errors (java exception or something else) are catched so that the report generation succeeds and that the image is left blank as expected.

Looking forward for some help
Thomas

 
Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

I'm currently using library 6.2.0. We have implemented our own provider.
The provider produces images which we can retrieve using a certain expression.

..getScaledImageFieldValue(...)

The signature of the method that we call to rettrieve the image is:

public BufferedImage getScaledImageFieldValue(String fieldname, int maxWidth, int maxHeight) throws JRException {

The JRException is not caught when we fail to retrieve the image for example due to a network break-down.  

Link to comment
Share on other sites

  • 3 weeks later...

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. Data providers should behave as a database: when data (in this case an image) is requested, it should not fail but simply respond with an image or null.

However as it is possible to write complex expression, it would be useful to trap errors during image expression evaluation as well. Upon request, a bugreport for this has been submitted: http://community.jaspersoft.com/jasperreports-library/issues/9156.

Thank you Teodor and Lucian for looking into this.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...