private Map<Integer, ContributorAgreement> getAgreementToAdd(ReviewDb db, ProjectConfig config) throws SQLException { Statement stmt = ((JdbcSchema) db).getConnection().createStatement(); try { ResultSet rs = stmt.executeQuery( "SELECT short_name, id, require_contact_information," + " short_description, agreement_url, auto_verify " + "FROM contributor_agreements WHERE active = 'Y'"); try { Map<Integer, ContributorAgreement> agreements = Maps.newHashMap(); while (rs.next()) { String name = rs.getString(1); if (config.getContributorAgreement(name) != null) { continue; // already exists } ContributorAgreement a = config.getContributorAgreement(name, true); agreements.put(rs.getInt(2), a); a.setRequireContactInformation("Y".equals(rs.getString(3))); a.setDescription(rs.getString(4)); a.setAgreementUrl(rs.getString(5)); if ("Y".equals(rs.getString(6))) { a.setAutoVerify(new GroupReference(null, null)); } } return agreements; } finally { rs.close(); } } finally { stmt.close(); } }