[Demonstration 1]

[Buggy Method]
@Override
public void configureTask(Task task, BinarySpec binarySpec, LanguageSourceSet sourceSet, ServiceRegistry serviceRegistry) {
    PlayApplicationBinarySpecInternal playBinarySpec = (PlayApplicationBinarySpecInternal) binarySpec;
    LessSourceSet lessSourceSet = (LessSourceSet) sourceSet;
    CssSourceSet cssSourceSet = (CssSourceSet) playBinarySpec.getInputs().matching(inputSourceSet -> inputSourceSet.getName().equals(getCssSourceSetName(lessSourceSet))).iterator().next();
    PlayLessCompile lessCompile = (PlayLessCompile) task;
    lessCompile.setDescription("Compiles the " + lessSourceSet.getDisplayName() + ".");
    File generatedSourceDir = playBinarySpec.getNamingScheme().getOutputDirectory(task.getProject().getBuildDir(), "src");
    File cssSourceSetDir = new File(generatedSourceDir, cssSourceSet.getName());
    cssSourceSet.getSource().srcDir(cssSourceSetDir);
    playBinarySpec.getAssets().addAssetDir(cssSourceSetDir);
    lessCompile.setOutputDirectory(cssSourceSetDir);
    lessCompile.setSource(lessSourceSet.getSource());
    cssSourceSet.builtBy(lessCompile);
    playBinarySpec.getAssets().builtBy(lessCompile);
}

[Buggy Hunk]
PlayLessCompile lessCompile = (PlayLessCompile) task;

[Patch]
LessCompile lessCompile = (LessCompile) task;

[Demonstration 2]

[Buggy Method]
public static void storeProperties(Properties properties) throws Exception {
    prepareAndroidContext();
    StringBuilder sb = new StringBuilder();
    try {
        // Read the properties file first
        FileReader fr = new FileReader(propertiesPath);
        BufferedReader br = new BufferedReader(fr);
        String line = br.readLine();
        while (line != null) {
            String toBeProcessed = "";
            // nor comment line or empty line
            if (!line.startsWith("#") && !line.startsWith("!") && line.length() > 0) {
                // Multiple line entry
                while (line != null && line.endsWith("\\")) {
                    line = line.replace("\\", "");
                    toBeProcessed += line;
                    line = br.readLine();
                }
                toBeProcessed += line;
                if (toBeProcessed.contains(":")) {
                    // Use only = to separate key/value
                    toBeProcessed = toBeProcessed.replace(":", "=");
                } else if (!toBeProcessed.contains("=")) {
                    toBeProcessed += "=";
                }
                if (!toBeProcessed.matches("^[^ ]+ = [^ ]*$"))
                    // Normalize format: key = value
                    toBeProcessed = toBeProcessed.replaceFirst("([^ ]+).*=.*([^ ]*)", "$1 = $2");
                sb.append(toBeProcessed + "\n");
            } else {
                // Keep comments and empty lines as is
                sb.append(line + "\n");
            }
            line = br.readLine();
        }
        // Now sb contains a normalized string copy of the file
        fr.close();
        br.close();
    } catch (FileNotFoundException e) {
        System.out.println("GeneralUtils, storeProperties(): impossible to find " + propertiesPath);
    }
    try {
        HashMap<String, String> propertiesToAppend = new HashMap<String, String>();
        for (String key : properties.stringPropertyNames()) {
            // foreach key
            String value = properties.getProperty(key);
            // Find start position of the key in the sb
            int valueStartIndex = sb.indexOf(key + " = ");
            if (valueStartIndex == -1) {
                // Property not found in the properties file
                System.out.println("valueStartIndex: Property not found in the properties file, valueStartIndex " + valueStartIndex);
                // Append later at the end
                propertiesToAppend.put(key, value);
                continue;
            }
            // property found in the properties file
            int valueEndIndex = sb.indexOf("\n", valueStartIndex);
            valueStartIndex = sb.indexOf("=", valueStartIndex) + 2;
            // Update the actual value in the sb
            sb.replace(valueStartIndex, valueEndIndex, value);
        }
        if (propertiesToAppend.size() > 0) {
            sb.append("\n# Appended configuration \n");
            for (String key : propertiesToAppend.keySet()) {
                sb.append(key + " = " + propertiesToAppend.get(key) + "\n");
            }
        }
        // Write back to the properties file
        FileOutputStream fos = new FileOutputStream(propertiesPath, false);
        fos.write(sb.toString().getBytes());
        fos.close();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

[Buggy Hunk]
public static void storeProperties(Properties properties) throws Exception {

[Patch]
public static synchronized void storeProperties(Properties properties) throws Exception {

[Demonstration 3]

[Buggy Method]
@Override
public List<Command> buildPostCommand(List<Predicate> predicateList) {
    String host = getEndPoint("batch-query/");
    List<String> params = Lists.newLinkedList();
    params.add(host);
    String query = _workUnitState.getProp(ConfigurationKeys.SOURCE_QUERYBASED_QUERY, "SELECT * FROM " + _workUnitState.getProp(ConfigurationKeys.SOURCE_ENTITY));
    if (predicateList != null) {
        for (Predicate predicate : predicateList) {
            query = SqlQueryUtils.addPredicate(query, predicate.getCondition());
        }
    }
    String rowLimit = _workUnitState.getProp(ZuoraConfigurationKeys.ZUORA_ROW_LIMIT);
    if (StringUtils.isNotBlank(rowLimit)) {
        query += " LIMIT " + rowLimit;
    }
    List<ZuoraQuery> queries = Lists.newArrayList();
    queries.add(new ZuoraQuery(_workUnitState.getProp(ConfigurationKeys.JOB_NAME_KEY), query));
    ZuoraParams filterPayload = new ZuoraParams(_workUnitState.getProp(ZuoraConfigurationKeys.ZUORA_PARTNER, "sample"), _workUnitState.getProp(ZuoraConfigurationKeys.ZUORA_PROJECT, "sample"), queries, _workUnitState.getProp(ZuoraConfigurationKeys.ZUORA_API_NAME, "sample"), _workUnitState.getProp(ZuoraConfigurationKeys.ZUORA_OUTPUT_FORMAT, "csv"), _workUnitState.getProp(ConfigurationKeys.SOURCE_CONN_VERSION, "1.1"));
    params.add(gson.toJson(filterPayload));
    return Collections.singletonList(new RestApiCommand().build(params, RestApiCommand.RestApiCommandType.POST));
}

[Buggy Hunk]
_workUnitState.getProp(ZuoraConfigurationKeys.ZUORA_OUTPUT_FORMAT, "csv"),

[Patch]
_workUnitState.getProp(RestAPIConfigurationKeys.REST_API_OUTPUT_FORMAT, "csv"),