Java Mailing List Archive

http://www.gg3721.com/

Home » Hibernate Issues List »

[hibernate-issues] [Hibernate-JIRA] Updated: (HHH-2604)
Isolator.JdbcDelegate masks
the exception if it isn't possible to open a connection.

Anupam M (JIRA)

2008-07-03


Author LoginPost Reply

  [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alex Savitsky updated HHH-2604:
-------------------------------

  Attachment: Patch-HHH-2604-trunk.txt

I believe this patch should do - it adds a null check for connection at the beginning of finally. I did it against the trunk, let me know if it's needed against any specific branch.

> Isolator.JdbcDelegate masks the exception if it isn't possible to open a connection.
> ------------------------------------------------------------------------------------
>
>           Key: HHH-2604
>           URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2604
>         Project: Hibernate3
>       Issue Type: Bug
>   Affects Versions: 3.2.4
>      Environment: Hibernate 3.2.2ga
>        Reporter: Tushar Pokle
>        Assignee: Diego Plentz
>        Priority: Minor
>         Fix For: 3.2.x, 3.3.0.CR2
>
>      Attachments: Patch-HHH-2604-trunk.txt
>
>
> A defect in Isolator.JdbcDelegate makes it throw the wrong exception - a NullPointerException - that masks the true exception. In my case it was an UnsupportedOperationException("The user must supply a JDBC connection").
> The trouble is at the start of Isolator.JdbcDelegate.delegateWork(...):
> {code}
> 174    public void delegateWork(IsolatedWork work, boolean transacted) throws HibernateException {
> 175      Connection connection = null;
> 176      boolean wasAutoCommit = false;
> 177      try {
> 178        connection = session.getBatcher().openConnection();
> {code}
> If there is a failure opening a connection on line 178, the finally clause is executed. The finally clause needs the connection, which of course is null :-)

--
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

   
_______________________________________________
hibernate-issues mailing list
hibernate-issues@(protected)
https://lists.jboss.org/mailman/listinfo/hibernate-issues
©2008 gg3721.com - Jax Systems, LLC, U.S.A.