private AuthResult byPreferredEmail(final HttpServletResponse rsp, final String email) {
   try {
     final ReviewDb db = schema.open();
     try {
       List<Account> matches = db.accounts().byPreferredEmail(email).toList();
       return matches.size() == 1 ? auth(matches.get(0)) : null;
     } finally {
       db.close();
     }
   } catch (OrmException e) {
     getServletContext().log("cannot query database", e);
     return null;
   }
 }
 private AuthResult byUserName(final HttpServletResponse rsp, final String userName) {
   try {
     final ReviewDb db = schema.open();
     try {
       AccountExternalId.Key key = new AccountExternalId.Key(SCHEME_USERNAME, userName);
       return auth(db.accountExternalIds().get(key));
     } finally {
       db.close();
     }
   } catch (OrmException e) {
     getServletContext().log("cannot query database", e);
     return null;
   }
 }
 private AuthResult byAccountId(final HttpServletResponse rsp, final String idStr) {
   final Account.Id id;
   try {
     id = Account.Id.parse(idStr);
   } catch (NumberFormatException nfe) {
     return null;
   }
   try {
     final ReviewDb db = schema.open();
     try {
       return auth(db.accounts().get(id));
     } finally {
       db.close();
     }
   } catch (OrmException e) {
     getServletContext().log("cannot query database", e);
     return null;
   }
 }