Original issue moved from:
https://sourceforge.net/tracker/index.php?func=detail&aid=1462594&group_id=36382&atid=416703
Consult the original issue for any attachments.
[ 1462594 ] Incorrect override of getCause in JRException
Submitted By: Gunnar Grim - gugrim
Date Submitted: 2006-04-01 01:11
Last Updated By: ionutned - Comment added
Date Last Updated: 2006-04-17 02:02
Number of Comments: 1
Number of Attachments: 0
Assigned To: Nobody/Anonymous
Priority: 5
Summary:
Incorrect override of getCause in JRException
I believe the implementation of getCause in JRException is incorrect:
public Throwable getCause()
{
return this.nestedThrowable;
}
If a JRException is caught and then has its cause set using initCause, subsequent calls to getCause will still return null. The following implementation should solve this problem:
public Throwable getCause()
{
if (this.nestedThrowable != null)
return this.nestedThrowable;
else
return super.getCause();
}
An alternative would of course be to just drop the nestedThrowable and use the JDK support for nested throwables.
Comments
Date: 2006-04-17 02:02
Sender: ionutned
Logged In: YES
user_id=1247959
We cannot use JDK support for nested throwables, because methods like getCause() and initCause() were introduced in JDK1.4 and JasperReports is 1.3 compatible.
No Files Currently Attached
Recommended Comments