[Demonstration 1]

[Buggy Method]
public static List<Integer> createCommonDivisorList(final Iterator<Integer> values) {
    final Integer first = values.next();
    final List<Integer> result = createDivisorList(first);
    while (values.hasNext()) {
        final Integer next = values.next();
        removeNonDivisors(values, next);
    }
    return result;
}

[Buggy Hunk]
removeNonDivisors(values, next);

[Patch]
removeNonDivisors(result.iterator(), next);

[Demonstration 2]

[Buggy Method]
public <T> ArrayList<T> getResult(String target, String source, String c) {
    try {
        String query = "select " + target + " from " + source + " ";
        if (conditions != null) {
            query += "where " + c;
        }
        ArrayList<T> values = new ArrayList<T>();
        if (execute(query)) {
            results.absolute(1);
            do {
                values.add((T) results.getObject(1));
            } while (results.next());
        }
        return values;
    } catch (Exception e) {
        return null;
    }
}

[Buggy Hunk]
if (conditions != null) {

[Patch]
if (c != null) {

[Demonstration 3]

[Buggy Method]
private FoodInfo getInfoForCurrentLine(String currentLine) {
    FoodInfo currentFoodInfo = new FoodInfo();
    String[] parts = currentLine.split(Pattern.quote("^"));
    double[] nutInfo = new double[parts.length - 7];
    for (int i = 0; i < nutInfo.length; i++) {
        if (parts[i + 2].isEmpty()) {
            // Missing value -> 0 nutritional value
            nutInfo[i] = 0.0;
        } else {
            nutInfo[i] = Double.parseDouble(parts[i + 2]);
        }
    }
    // Sometimes the last value (percent residue) is missing in the file - that's a bug in the file, not program
    if (nutInfo.length != NUM_NUTRITION_FIELDS && nutInfo.length != NUM_NUTRITION_FIELDS - 1) {
        throw new ParsingException("File format problem");
    }
    // Tildes wrap strings in the file
    String foodName = parts[1].substring(1, parts[1].length() - 2);
    setNutritionalInfo(currentFoodInfo, nutInfo, foodName);
    return currentFoodInfo;
}

[Buggy Hunk]
String foodName = parts[1].substring(1, parts[1].length() - 2); // Tildes wrap strings in the file

[Patch]
String foodName = parts[1].substring(1, parts[1].length() - 1); // Tildes wrap strings in the file