[Demonstration 1]

[Buggy Method]
private List<Pattern> getCompiledPattern() throws FileNotFoundException, InterruptedException {
    if (compiledPatterns == null) {
        compiledPatterns = new ArrayList<Pattern>();
        try {
            listener.getLogger().println("Scanning failed job console output using parsing rule file " + subTask.phaseConfig.getParsingRulesPath() + ".");
            final File rulesFile = new File(subTask.phaseConfig.getParsingRulesPath());
            FileInputStream fis = new FileInputStream(rulesFile.getAbsoluteFile());
            InputStreamReader isr = new InputStreamReader(fis, Charset.defaultCharset());
            final BufferedReader reader = new BufferedReader(isr);
            try {
                String line;
                while ((line = reader.readLine()) != null) {
                    compiledPatterns.add(Pattern.compile(line));
                }
            } finally {
                if (reader != null) {
                    reader.close();
                }
            }
        } catch (Exception e) {
            if (e instanceof InterruptedException) {
                throw new InterruptedException();
            } else if (e instanceof FileNotFoundException) {
                throw new FileNotFoundException();
            } else {
                listener.getLogger().println(e.toString());
                e.printStackTrace();
            }
        }
    }
    return compiledPatterns;
}

[Buggy Hunk]
InputStreamReader isr = new InputStreamReader(fis, Charset.defaultCharset());

[Patch]
InputStreamReader isr = new InputStreamReader(fis, Charset.forName("UTF-8"));

[Demonstration 2]

[Buggy Method]
public static void objChecker(Object obj, int depth, IORecord record, boolean register) {
    if (obj == null) {
        return;
    }
    Class clazz = obj.getClass();
    HashSet<Field> fields = FieldController.collectInstanceFields(clazz);
    try {
        for (Field f : fields) {
            if (f.getType() == int.class) {
                int val = f.getInt(obj);
                analyzeTaint(val, record, register);
            } else if (f.getType() == short.class) {
                short val = f.getShort(obj);
                analyzeTaint(val, record, register);
            } else if (f.getType() == boolean.class) {
                boolean val = f.getBoolean(obj);
                analyzeTaint(val, record, register);
            } else if (f.getType() == byte.class) {
                byte val = f.getByte(obj);
                analyzeTaint(val, record, register);
            } else if (f.getType() == char.class) {
                char val = f.getChar(obj);
                analyzeTaint(val, record, register);
            } else if (f.getType() == float.class) {
                float val = f.getFloat(obj);
                analyzeTaint(val, record, register);
            } else if (f.getType() == long.class) {
                long val = f.getLong(obj);
                analyzeTaint(val, record, register);
            } else if (f.getType() == double.class) {
                double val = f.getDouble(obj);
                analyzeTaint(val, record, register);
            } else if (String.class.isAssignableFrom(f.getType())) {
                String val = (String) f.get(obj);
                analyzeTaint(val, record, register);
            } else {
                Object val = f.get(obj);
                analyzeTaint(val, depth - 1, record, register);
            }
        }
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}

[Buggy Hunk]
analyzeTaint(val, depth - 1, record, register);

[Patch]
analyzeTaint(val, record, depth - 1, register);

[Demonstration 3]

[Buggy Method]
public static int getConfigInt(Properties config, String key, int def) {
    int vint = def;
    try {
        String val = config.getProperty(key);
        if (val != null) {
            def = Integer.parseInt(val);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return vint;
}

[Buggy Hunk]
def = Integer.parseInt(val);

[Patch]
vint = Integer.parseInt(val);