private String getPassword() { String password = null; Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; try { conn = getConnection(); ps = conn.prepareStatement(principalsQuery); ps.setString(1, userName); rs = ps.executeQuery(); if( rs.next() == false ) { throw PicketBoxMessages.MESSAGES.unableToFindPrincipalInDB(userName); } password = rs.getString(1); } catch (Exception e) { throw new RuntimeException(e); } finally { safeClose(rs); safeClose(ps); safeClose(conn); } return password; }