[Demonstration 1]

[Buggy Method]
public static Expression clauseForm(Expression E) throws IOException {
    E = eliminateDoubleImplication(E);
    E = eliminateImplication(E);
    E = pushNegationInwards(E);
    E = Standardize(E);
    E = Skolemize(E);
    E = discardUniversalQuantifiers(E);
    E = translateIntoCNF(E);
    return E;
}

[Buggy Hunk]
E = pushNegationInwards(E);

[Patch]
E = pushNegationInwards(E, false);

[Demonstration 2]

[Buggy Method]
public ArgumentValue next(Mode mode) {
    if (pushbackValue != null) {
        /* Argument percolating back up the call chain */
        ArgumentValue ret = pushbackValue;
        pushbackValue = null;
        return ret;
    }
    if (index == 0 || index >= value.length()) {
        /* New value required */
        if (!iterator.hasNext())
            return null;
        value = iterator.next();
        index = 0;
    }
    if (mode != Mode.FORCE_ARGUMENTS && index == 0) {
        /* Beginning of an option */
        if (value.equals("-") || value.equals("--")) {
            /* Special case */
            return new ArgumentValue(ArgumentValue.Type.ARGUMENT, value);
        } else if (value.startsWith("--")) {
            /* Long option */
            index = value.indexOf('=') + 1;
            if (index != 0) {
                return new ArgumentValue(ArgumentValue.Type.LONG_OPTION, value.substring(2, index - 1));
            } else {
                return new ArgumentValue(ArgumentValue.Type.LONG_OPTION, value.substring(2));
            }
        } else if (value.startsWith("-")) {
            /* Short options */
            index = 2;
            return new ArgumentValue(ArgumentValue.Type.SHORT_OPTION, value.substring(2, 3));
        } else {
            /* Just an argument */
            return new ArgumentValue(ArgumentValue.Type.ARGUMENT, value);
        }
    } else if (mode != Mode.OPTIONS || index < 0) {
        /* A (possibly directly attached) argument */
        int idx = Math.abs(index);
        index = 0;
        return new ArgumentValue((idx != 0) ? ArgumentValue.Type.VALUE : ArgumentValue.Type.ARGUMENT, value.substring(idx));
    } else {
        /* More short options */
        index++;
        return new ArgumentValue(ArgumentValue.Type.SHORT_OPTION, value.substring(index - 1, index));
    }
}

[Buggy Hunk]
value.substring(2, 3));

[Patch]
value.substring(1, 2));

[Demonstration 3]

[Buggy Method]
String search(String text) throws Exception {
    String[] words = text.split("\\b");
    HashSet<String> wordSet = new HashSet<>(Arrays.asList(words));
    String result = null;
    BufferedReader br = null;
    InputStreamReader isr = null;
    try {
        isr = new InputStreamReader(this.getClass().getResourceAsStream(FILENAME));
        br = new BufferedReader(isr);
        String sCurrentLine;
        while (result == null && (sCurrentLine = br.readLine()) != null) {
            String[] parts = sCurrentLine.split(":");
            if (wordSet.contains(parts[0].toLowerCase())) {
                result = parts[1];
            }
        }
    } catch (IOException e) {
        log.info("IOException while reading file: {}", e.toString());
    } finally {
        try {
            if (br != null)
                br.close();
            if (isr != null)
                isr.close();
        } catch (IOException ex) {
            log.info("IOException while closing file: {}", ex.toString());
        }
    }
    if (result != null)
        return result;
    throw new Exception("NOT FOUND");
}

[Buggy Hunk]
String[] words = text.split("\\b");

[Patch]
String[] words = text.toLowerCase().split("\\b");