[Demonstration 1]

[Buggy Method]
@Test
public void testAfficheErreur() {
    System.out.println("afficheErreur");
    Validation.validationPseudo("toto");
    Validation.validationIp("127.0.0.1");
    Validation.validationPort("4200");
    String val = Validation.afficheErreur();
    assertTrue(Validation.afficheErreur().isEmpty());
}

[Buggy Hunk]
String val = Validation.afficheErreur();

[Patch]
Validation.afficheErreur();

[Demonstration 2]

[Buggy Method]
public boolean parseNextLine() throws IOException {
    if (m_vcfMetadata == null) {
        parseMetadata();
    }
    String line = m_reader.readLine();
    if (line == null) {
        m_alreadyFinished = true;
        return false;
    }
    if (m_alreadyFinished) {
        // prevents user errors from causing infinite loops
        throw new IllegalStateException("Already finished reading the stream");
    }
    m_lineNumber++;
    try {
        List<String> data = toList(sf_tabSplitter, line);
        // CHROM
        String chromosome = data.get(0);
        // POS
        long position;
        try {
            position = Long.parseLong(data.get(1));
        } catch (NumberFormatException e) {
            throw new IllegalArgumentException("Position " + data.get(1) + " is not numerical");
        }
        // ID
        List<String> ids = null;
        if (!data.get(2).equals(".")) {
            if (m_rsidsOnly && !VcfUtils.RSID_PATTERN.matcher(data.get(2)).find()) {
                return true;
            }
            ids = toList(sf_commaSplitter, data.get(2));
        } else if (m_rsidsOnly) {
            return true;
        }
        // REF
        String ref = data.get(3);
        // ALT
        List<String> alt = null;
        if (!data.get(7).isEmpty() && !data.get(4).equals(".")) {
            alt = toList(sf_commaSplitter, data.get(4));
        }
        // QUAL
        BigDecimal quality = null;
        if (!data.get(5).isEmpty() && !data.get(5).equals(".")) {
            quality = new BigDecimal(data.get(5));
        }
        // FILTER
        List<String> filters = null;
        if (!data.get(6).equals("PASS")) {
            filters = toList(sf_semicolonSplitter, data.get(6));
        }
        // INFO
        ListMultimap<String, String> info = null;
        if (!data.get(7).equals("") && !data.get(7).equals(".")) {
            info = ArrayListMultimap.create();
            List<String> props = toList(sf_semicolonSplitter, data.get(7));
            for (String prop : props) {
                int idx = prop.indexOf('=');
                if (idx == -1) {
                    info.put(prop, "");
                } else {
                    String key = prop.substring(0, idx);
                    String value = prop.substring(idx + 1);
                    info.putAll(key, toList(sf_commaSplitter, value));
                }
            }
        }
        // FORMAT
        List<String> format = null;
        if (data.size() >= 9 && data.get(8) != null) {
            format = toList(sf_colonSplitter, data.get(8));
        }
        // samples
        VcfPosition pos = new VcfPosition(chromosome, position, ids, ref, alt, quality, filters, info, format);
        List<VcfSample> samples = new ArrayList<>();
        for (int x = 9; x < data.size(); x++) {
            samples.add(new VcfSample(format, toList(sf_colonSplitter, (data.get(x)))));
        }
        m_vcfLineParser.parseLine(m_vcfMetadata, pos, samples);
        m_lineNumber++;
    } catch (RuntimeException e) {
        throw new IllegalArgumentException("Error parsing VCF data line #" + m_lineNumber + ": " + line, e);
    }
    return true;
}

[Buggy Hunk]
ids = toList(sf_commaSplitter, data.get(2));

[Patch]
ids = toList(sf_semicolonSplitter, data.get(2));

[Demonstration 3]

[Buggy Method]
public boolean hasNext() {
    try {
        bufferedReader.mark(1);
        if (bufferedReader.read() < 0) {
            closeQuietly(bufferedReader);
            return false;
        }
        bufferedReader.reset();
        return true;
    } catch (IOException e) {
        logger.error("IOException while checking if next line in file is present");
        throw new RuntimeException(e);
    }
}

[Buggy Hunk]
bufferedReader.mark(1);

[Patch]
bufferedReader.mark(10);