[hibernate-issues] [Hibernate-JIRA] Created: (HHH-5590) Don't log and rethrow exceptions in AbstractFlushingEventListener

Gregg (JIRA) noreply at atlassian.com
Fri Sep 24 12:07:57 EDT 2010


Don't log and rethrow exceptions in AbstractFlushingEventListener
-----------------------------------------------------------------

                 Key: HHH-5590
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5590
             Project: Hibernate Core
          Issue Type: Bug
          Components: core
    Affects Versions: 3.6.0.CR1, 3.5.6, 3.3.2
         Environment: Hibernate 3.3.2.GA
Oracle Database 10.1.0.4.0
JDK 1.6.0_17
            Reporter: Gregg
            Priority: Trivial
         Attachments: AbstractFlushingEventListener.patch

For a similar issue covering logging-and-rethrowing overall, see http://opensource.atlassian.com/projects/hibernate/browse/HB-1308.  This issue covers a specific instance in order to minimize the impact on the codebase.  However, I would be all for elimination of every instance of log-and-rethrow in the codebase.

In this particular instance, I have a table A with a foreign key referencing records in table B.  In my user interface, I give the user the ability to delete records from table B.  If the user attempts to delete a record from table B that is referred to in table A, the database throws an integrity constraint violation.  This exception is caught in AbstractFlushingEventListener.performExecutions, logged, and rethrown.  My code sees the exception and informs the user that the record cannot be deleted because it's already in use in the system.  So the exception ends up showing up in my logs (from the log.error() statement in AbstractFlushingEventListener.performExecutions) even though I'm handling it properly.  I would like the log.error() statement removed since the code propagates the exception.  Attached is a patchfile.

I'm not including a test case because I feel the issue is so simplistic that one isn't necessary.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list