[Demonstration 1]

[Buggy Method]
public static String truncate(String str, int length) {
    return str.length() <= length ? str : str.substring(0, length);
}

[Buggy Hunk]
return str.length() <= length ? str : str.substring(0, length);

[Patch]
return str == null || str.length() <= length ? str : str.substring(0, length);

[Demonstration 2]

[Buggy Method]
static int parseToken(String str, int index, String token, boolean optionalQuoted) {
    int length = str.length();
    int j = 0;
    int startIndex = index;
    for (int i = index; i < length && j < token.length(); i++, j++) {
        char c = str.charAt(i);
        char cj = token.charAt(j);
        if (c != j && c != (cj >= 'a' && cj <= 'z' ? cj - 0x20 : cj))
            return startIndex;
    }
    index += token.length();
    index = skipLinearWhitespace(str, index);
    if (optionalQuoted) {
        if (index < length && str.charAt(index) == '=') {
            index++;
            index = skipLinearWhitespace(str, index);
            if (index < length && str.charAt(index) == '"') {
                index = skipQuotedString(str, index);
            } else
                return startIndex;
            index = skipLinearWhitespace(str, index);
        }
    }
    if (index >= length)
        return index;
    if (str.charAt(index) == ',') {
        index++;
        index = skipLinearWhitespace(str, index);
        return index;
    }
    return startIndex;
}

[Buggy Hunk]
if(c!=j && c!=(cj>='a' && cj<='z' ? cj-0x20 : cj))

[Patch]
if(c!=cj && c!=(cj>='a' && cj<='z' ? cj-0x20 : cj))

[Demonstration 3]

[Buggy Method]
public static SourceStream FromFile(String filename) throws EmjInterExceptionBase {
    String contents = SourceLoader.Load(filename);
    return new SourceStream(contents);
}

[Buggy Hunk]
String contents = SourceLoader.Load(filename);

[Patch]
byte[] contents = SourceLoader.Load(filename);