JDBCCustomFinderQuery hides ObjectNotFoundException
---------------------------------------------------
Key: JBAS-1289
URL: http://jira.jboss.com/jira/browse/JBAS-1289
Project: JBoss Application Server
Type: Bug
Components: EJBs
Versions: JBossAS-3.2.7 Final
Reporter: David Deuchert
Assigned to: Scott M Stark
Priority: Minor
When a custom finder method returns an ObjectNotFoundException, the exception
is logged as an error and re-wrapped inside a more generic FinderException.
There are two problems here:
1) The hiding of the ObjectNotFoundException
2) The extra logging of an error level message, the application code might be
expecting an ObjectNotFound exception (test for existance) and does not require
logging...
The following is a code snippet that shows a diff between the current code and
a potential fix:
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/JDBCCustomFinderQuery.java
- Line #134
***************
*** 134,143 ****
}
catch(InvocationTargetException e)
{
! log.error("Error invoking custom finder " + finderMethod.getName(),
! e.getTargetException());
! throw new FinderException("Errror invoking cutom finder " +
! finderMethod.getName() + ": " + e.getTargetException());
}
}
--- 134,149 ----
}
catch(InvocationTargetException e)
{
! Throwable t = e.getTargetException();
! if (t instanceof FinderException) {
! // Just quietly rethrow the original finder exception...
! throw (FinderException)t;
! } else {
! log.error("Error invoking custom finder " + finderMethod.getName(
),
! t);
! throw new FinderException("Errror invoking cutom finder " +
! finderMethod.getName() + ": " + t);
! }
}
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
JBoss-Development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-development