[Demonstration 1]

[Buggy Method]
public Boolean containsSomethingLikeUserName(String content) {
    Boolean containsSomethingLikeUserName = false;
    if (content.contains("title") && content.matches(regExForUser)) {
        containsSomethingLikeUserName = true;
    }
    return containsSomethingLikeUserName;
}

[Buggy Hunk]
if (content.contains("title") && content.matches(regExForUser)) {

[Patch]
if (content.contains("title") && (content.matches(regExForUser) || content.matches(regExForSpezial))) {

[Demonstration 2]

[Buggy Method]
void run() throws IOException, XMLStreamException {
    XMLInputFactory factory = XMLInputFactory.newInstance();
    XMLStreamReader reader = factory.createXMLStreamReader(new FileInputStream(ecrfXmlPath));
    XMLEcrfDatamodel datamodel = XMLEcrfDatamodelReader.readXMLDatamodel(reader);
    Iterable<EcrfField> allFields = Sets.newTreeSet(XMLEcrfDatamodelToEcrfFields.convert(datamodel));
    Iterable<EcrfPatient> allPatients = XMLPatientReader.readPatients(reader, allFields);
    List<EcrfPatient> filteredPatients = Lists.newArrayList();
    for (String patientId : patientIds) {
        EcrfPatient patient = findPatient(allPatients, patientId);
        if (patient == null) {
            LOGGER.warn("Did not find ECRF record for " + patientId);
            filteredPatients.add(new EcrfPatient(patientId, Maps.<EcrfField, List<String>>newHashMap()));
        }
    }
    //        writeDatamodelToCSV(allFields, csvOutPath);
    writePatientsToCSV(filteredPatients, allFields, csvOutPath);
}

[Buggy Hunk]
if (patient == null) {

[Patch]
if (patient != null) {

[Demonstration 3]

[Buggy Method]
private List<Portfolio> addAccuracy() {
    List<Portfolio> border = ((PortfolioChartPanel) chartPanel).getBorderPortfolios();
    List<Portfolio> accuracyPortfolios = new LinkedList<>();
    if (border == null || border.isEmpty()) {
        return accuracyPortfolios;
    }
    int length = instruments.length - 1;
    double[][] dataFiltered = ((PortfolioChartPanel) chartPanel).getDataFiltered();
    double[][] corrTable = Calc.correlationTable(dataFiltered);
    double[] avYields = new double[length];
    double[] sdYields = new double[length];
    for (int col = 0; col < length; col++) {
        double[] column = Calc.column(dataFiltered, col);
        avYields[col] = Calc.averageYields(column);
        sdYields[col] = Calc.stdevYields(column);
    }
    String[] trueInstr = Arrays.copyOfRange(instruments, 1, instruments.length);
    int dividers = 100;
    DefaultTableModel model = (DefaultTableModel) tableLimitations.getModel();
    int[] userMinimals = new int[length];
    int[] userMaximals = new int[length];
    int[] compares = new int[length];
    for (int col = 0; col < length; col++) {
        int minValue = Integer.valueOf((String) model.getValueAt(0, col + 1));
        int maxValue = Integer.valueOf((String) model.getValueAt(1, col + 1));
        if (minValue < 0 || maxValue > 100 || minValue > maxValue) {
            return accuracyPortfolios;
        }
        userMinimals[col] = minValue;
        userMaximals[col] = maxValue;
        compares[col] = Integer.valueOf((String) model.getValueAt(2, col + 1));
    }
    int index = 0;
    int size = border.size();
    while (index < size) {
        Portfolio first = border.get(index);
        Portfolio next = index < size - 1 ? border.get(index + 1) : first;
        int[] minimals = new int[length];
        int[] maximals = new int[length];
        for (int col = 0; col < length; col++) {
            minimals[col] = Math.min((int) (first.weights()[col] * 100), (int) (next.weights()[col] * 100)) - 100 / dividers;
            if (minimals[col] < 0) {
                minimals[col] = 0;
            }
            maximals[col] = Math.max((int) (first.weights()[col] * 100), (int) (next.weights()[col] * 100)) + 100 / dividers;
            if (maximals[col] > 100) {
                maximals[col] = 100;
            }
            if (minimals[col] < userMinimals[col]) {
                minimals[col] = userMinimals[col];
            }
            if (maximals[col] > userMaximals[col]) {
                maximals[col] = userMaximals[col];
            }
        }
        accuracyPortfolios.addAll(Calc.iteratePortfolios(corrTable, avYields, sdYields, minimals, maximals, trueInstr, dividers));
        index += 1;
    }
    accuracyPortfolios.sort(Portfolio::compareTo);
    List<Portfolio> portfoliosCompare = null;
    if (Arrays.stream(compares).sum() == 100) {
        portfoliosCompare = Calc.iteratePortfolios(corrTable, avYields, sdYields, compares, compares, trueInstr, 100);
    }
    ((PortfolioChartPanel) chartPanel).setPortfolios(accuracyPortfolios, portfoliosCompare, dataFiltered, Main.getPeriods(indexFrom, indexTo));
    return accuracyPortfolios;
}

[Buggy Hunk]
avYields[col] = Calc.averageYields(column);

[Patch]
avYields[col] = Calc.averageRealYields(column);