Logging in catch block
Description
Activity
Show:

Ondrej MotlikMarch 23, 2011 at 12:10 PM
Code can be found in class AbstractEntityManagerImpl
Details
Assignee
UnassignedUnassignedReporter
Ondrej MotlikOndrej Motlik(Deactivated)Components
Priority
Major
Details
Details
Assignee
Unassigned
UnassignedReporter

Components
Priority
Created March 23, 2011 at 11:52 AM
Updated March 23, 2011 at 12:10 PM
I have experienced very unpleasant problem in live environment where UnsupportedOperationException appeared. It was caused by calling rollback method which is not implemented (HHH-5019). But the cause of exception was hidden in log files, because of following code:
public RuntimeException convert(RuntimeException e) {
RuntimeException result = e;
if ( e instanceof HibernateException ) {
result = convert( ( HibernateException ) e );
}
else {
markAsRollback();
}
return result;
}
My suggestion is to add in else part logger. It will do no harm and it will possible to see cause of problem in log file especially in environments where manual debugging is not possible. Thanks in advance.