logo       

[picocontainer-scm] [jira] Created: (NANOPERSISTENCE-8) Infinite Loop in or: msg#00095

java.picocontainer.cvs

Subject: [picocontainer-scm] [jira] Created: (NANOPERSISTENCE-8) Infinite Loop in org.nanocontainer.persistence.hibernate.SessionComponent

Infinite Loop in org.nanocontainer.persistence.hibernate.SessionComponent
-------------------------------------------------------------------------

Key: NANOPERSISTENCE-8
URL: http://jira.codehaus.org/browse/NANOPERSISTENCE-8
Project: NanoContainer Persistence
Issue Type: Bug
Reporter: Michael Rimov
Assigned To: Michael Rimov


There's an infinite loop in the code if a hibernate exception is thrown if a
hibernate exception is thrown while calling invalidateDelegatedSession()

{code}
protected void invalidateDelegatedSession() throws HibernateException {
if (session != null) {
try {
session.clear();
session.close();
} catch (HibernateException ex) {
throw handleException(ex);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
} finally {
session = null;
}
}
}
{code}

handleException does:

{code}
protected RuntimeException handleException(RuntimeException cause)
throws HibernateException {
try {
invalidateDelegatedSession();
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
} catch (RuntimeException e) {
// Do nothing, only the original exception should be
reported.
}

return hibernateExceptionHandler.handle(cause);
}
{code}

which starts the loop all over again.

I believe it's acceptable to change invalidateDelegatedSession() to

{code}
/**
* Perform actions to dispose "burned" session properly.
*/
protected void invalidateDelegatedSession() throws HibernateException {
if (session != null) {
try {
session.clear();
session.close();
} finally {
session = null;
}
}
}
{code}

I've got the fixed code in my "NanoPersistence split modules", so if that one
gets okayed, I'll check in this fix right away as well.

Am I missing anything?

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



<hr/>
<p>
To unsubscribe from this list please visit:
</p>
<p>
<a
href="http://xircles.codehaus.org/manage_email";>http://xircles.codehaus.org/manage_email</a>




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise