[Demonstration 1]

[Buggy Method]
@SuppressWarnings("unchecked")
protected <T> T extractValue(Class<T> parameterType, String domain, String name, String strval, Map<String, Map<String, Object>> properties, ModulePropertyLocator propertyLocator) {
    Object pVal = propertyLocator.getProperty(domain, name, Object.class, config, properties);
    // If the value is found,
    // check if it is a compatible type with T, if so
    // return the value, otherwise consider the value as
    // a string which should be parsed and converted to
    // a value
    if (pVal != null) {
        if (parameterType.isAssignableFrom(pVal.getClass())) {
            return (T) pVal;
        } else {
            strval = pVal.toString();
        }
    }
    // In this case the string val should have a value
    // If the value is same as NULL_STR that means we
    // should return a null value, if it is LOAD_STR then
    // we should consider this property as a module that
    // should be loaded by a loader
    if (strval != null) {
        if (strval.equals(NULLVal.NULL_STR)) {
            return null;
        }
        if (strval.equals(NULLVal.LOAD_STR)) {
            return getParameter(parameterType, null, properties, null);
        }
    }
    // Use a mapper to map the default string value to the given type
    if (strval != null && !strval.isEmpty()) {
        Mapper mapper = propertyLocator.getMapperOfType(parameterType, String.class, parameterType, config, properties);
        if (mapper == null) {
            throw new IllegalArgumentException("Can not map a string value to a type: " + parameterType);
        }
        return mapper.map(strval, parameterType);
    }
    // The property could not be initialized so an exception is thrown
    throw new IllegalArgumentException("Can not extract a value of " + parameterType.getName() + " " + " at " + domain + ":" + name + " with value " + strval);
}

[Buggy Hunk]
return getParameter(parameterType, null, properties, null);

[Patch]
return getParameter(parameterType, null, properties, propertyLocator);

[Demonstration 2]

[Buggy Method]
public void save(File file) throws IOException {
    try (FileWriter writer = new FileWriter(file)) {
        for (EConfigItem e : EConfigItem.values()) {
            // comment line
            writer.append("# " + e.comment + "\n");
            writer.append(e.key + "=" + e.def + "\n");
            writer.append("\n");
        }
    }
}

[Buggy Hunk]
try (FileWriter writer = new FileWriter(file)) {

[Patch]
try (Writer writer = new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.US_ASCII)) {

[Demonstration 3]

[Buggy Method]
public void countn() {
    int querySize = pagesFoundList.get(0).pageWord.size();
    for (int i = 0; i < querySize; i++) {
        int count = 0;
        for (int j = 0; j < pagesFoundList.size(); j++) {
            if (pagesFoundList.get(j).pageWord.get(i).getAmountWord() > 0) {
                count++;
            }
        }
        Integer temp = new Integer(count);
        n.add(temp);
    }
}

[Buggy Hunk]
Integer temp = new Integer(count);

[Patch]
Integer temp = new Integer(count - 1);