-
Bug
-
Resolution: Done
-
Minor
-
JBossAS-3.2.7 Final
-
None
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,143 ****
-
— 134,149 ----
}
catch(InvocationTargetException e)
{
! Throwable t = e.getTargetException();
! if (t instanceof FinderException)
else
{ ! log.error("Error invoking custom finder " + finderMethod.getName( ), ! t); ! throw new FinderException("Errror invoking cutom finder " + ! finderMethod.getName() + ": " + t); ! } }
}