Session session = null;
Query query;
if (name != null) {
try {
session = DaoUtils.getSession();
<BUG>if (session != null) {</BUG>
query = session
.createQuery("SELECT DISTINCT a from Address a WHERE UPPER(a.emailAddress) = :emailAddress");
result = (Address) query.setParameter("emailAddress", name.toUpperCase(Locale.getDefault()))
.uniqueResult();
<BUG>}
} finally {</BUG>
DaoUtils.closeSession(session);

Session session = null;
Query query;
if (name != null) {
try {
session = DaoUtils.getSession();
query = session
.createQuery("SELECT DISTINCT a from Address a WHERE UPPER(a.emailAddress) = :emailAddress");
result = (Address) query.setParameter("emailAddress", name.toUpperCase(Locale.getDefault()))
.uniqueResult();
} catch (Exception e) {
log.error("Exception while getting the address: ", e);
} finally {
DaoUtils.closeSession(session);
