[hibernate-issues] [Hibernate-JIRA] Created: (HSHARDS-48) NullPointerException in disconnect method

Aviad Lichtenstadt (JIRA) noreply at atlassian.com
Wed Oct 17 05:31:38 EDT 2007


NullPointerException in disconnect method
-----------------------------------------

                 Key: HSHARDS-48
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HSHARDS-48
             Project: Hibernate Shards
          Issue Type: Bug
    Affects Versions: 3.0.0.Beta2
            Reporter: Aviad Lichtenstadt
            Assignee: Max Ross


Sometimes when the disconnect method of ShardedSessionImpl is called a NullPointerException occurs

This happened when attaching the OpenSessionInViewFilter to a shardSessionFactory

Here is the fixed method (validate that the session is not null when calling disconnect:

public Connection disconnect() throws HibernateException {
    for (Shard s : getShards()) {
        Session sess = s.getSession();
        if (sess != null) {
            sess.disconnect();
        }
    }
    // we do not allow application-supplied connections, so we can always return
    // null
    return 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

        



More information about the hibernate-issues mailing list