[Demonstration 1]

[Buggy Method]
@Override
public VsphereCredential convert(CredentialRequest source) {
    VsphereCredential vsphereCredential = new VsphereCredential();
    vsphereCredential.setName(source.getName());
    vsphereCredential.setDescription(source.getDescription());
    String userName = String.valueOf(source.getParameters().get(VsphereCredentialParam.USER.getName()));
    vsphereCredential.setUserName(userName);
    String password = String.valueOf(source.getParameters().get(OpenStackCredentialParam.PASSWORD.getName()));
    vsphereCredential.setPassword(password);
    vsphereCredential.setPublicKey(source.getPublicKey());
    return vsphereCredential;
}

[Buggy Hunk]
String password = String.valueOf(source.getParameters().get(OpenStackCredentialParam.PASSWORD.getName()));

[Patch]
String password = String.valueOf(source.getParameters().get(VsphereCredentialParam.PASSWORD.getName()));

[Demonstration 2]

[Buggy Method]
private static String createQuerySql(JSONObject jsonObject, String cohortTable, int cohortDefinitionId, boolean aggregated, boolean temporal) {
    StringBuilder fields = new StringBuilder();
    if (aggregated) {
        fields.append("covariate_id, sum_value, sum_value / (1.0 * (SELECT COUNT(*) FROM @cohort_table {@cohort_definition_id != -1} ? {WHERE cohort_definition_id = @cohort_definition_id})) AS average_value");
    } else {
        fields.append("row_id, covariate_id, covariate_value");
    }
    if (temporal) {
        fields.append(", time_id");
    }
    boolean hasFeature = false;
    StringBuilder sql = new StringBuilder();
    sql.append("SELECT " + fields.toString() + "\nFROM (\n");
    Iterator<Object> analysesIterator = jsonObject.getJSONArray(ANALYSES).iterator();
    while (analysesIterator.hasNext()) {
        JSONObject analysis = (JSONObject) analysesIterator.next();
        if (!aggregated || analysis.getBoolean("isBinary")) {
            if (hasFeature)
                sql.append(" UNION ALL\n");
            sql.append("SELECT " + fields.toString() + " FROM " + analysis.getString("covariateTable"));
            hasFeature = true;
        }
    }
    if (!hasFeature)
        return null;
    sql.append("\n) all_covariates;");
    return SqlRender.renderSql(sql.toString(), new String[] { "cohort_table", "cohort_definition_id" }, new String[] { cohortTable, Integer.toString(cohortDefinitionId) });
}

[Buggy Hunk]
if (!aggregated || analysis.getBoolean("isBinary")) {

[Patch]
if (analysis.has("covariateTable") && (!aggregated || analysis.getBoolean("isBinary"))) {

[Demonstration 3]

[Buggy Method]
public static String sendGET(final String url) throws ClientProtocolException, IOException, HttpRequestFailureException {
    LOGGER.infof("Entering sendGET(%s)", url);
    CloseableHttpClient httpClient = HttpClients.createDefault();
    HttpGet httpGet = new HttpGet(url);
    // httpGet.addHeader("User-Agent", USER_AGENT);
    CloseableHttpResponse httpResponse = httpClient.execute(httpGet);
    final int statusCode = httpResponse.getStatusLine().getStatusCode();
    if (statusCode != 200) {
        throw new HttpRequestFailureException(statusCode);
    }
    BufferedReader reader = new BufferedReader(new InputStreamReader(httpResponse.getEntity().getContent()));
    String inputLine;
    StringBuffer response = new StringBuffer();
    final String lineSeparator = System.getProperty("line.separator");
    while ((inputLine = reader.readLine()) != null) {
        response.append(inputLine);
        response.append(lineSeparator);
    }
    reader.close();
    httpClient.close();
    String result = response.toString();
    if (LOGGER.isTraceEnabled()) {
        LOGGER.tracef("Leaving sendGET(): %s", result);
    } else {
        LOGGER.info("Leaving sendGET()");
    }
    return result;
}

[Buggy Hunk]
httpResponse.getEntity().getContent()));

[Patch]
httpResponse.getEntity().getContent(), STREAM_CHARSET));