[Demonstration 1]

[Buggy Method]
public static Command createCommand(HttpServletRequest request) throws CommandException {
    String command = request.getParameter(PARAM_NAME);
    if (command != null) {
        try {
            command = command.toUpperCase();
            LOGGER.info("Command {}", command);
            return CommandEnum.valueOf(command).getCommand();
        } catch (IllegalArgumentException e) {
            throw new CommandException(e);
        }
    } else {
        LOGGER.info("Default command {}", command);
        return new ShowContactListCommand();
    }
}

[Buggy Hunk]
LOGGER.info("Default command {}", command);

[Patch]
LOGGER.info("Default command {}", CommandEnum.SHOW_CONTACT_LIST);

[Demonstration 2]

[Buggy Method]
@Override
protected void fillBuff() throws IOException {
    outPos = outCount = 0;
    Arrays.fill(inBuf, (byte) 84);
    inCount = 0;
    while (inCount < 5 && !eod) {
        int c = readNonWhiteSpace();
        if (c >= '!' && c <= 'u')
            inBuf[inCount++] = (byte) (c - '!');
        else if (c == 'z') {
            if (inCount != 0)
                throw new IOException("'z' in the middle of a 5-tuple");
            inCount = 5;
            Arrays.fill(inBuf, (byte) 0);
        } else if (c == '~') {
            c = in.read();
            if (c != '>')
                throw new IOException("Wrong character " + c + " after '~'");
            eod = true;
        } else if (c == -1)
            throw new IOException("EOF before '~>'");
        else
            throw new IOException("Illegal character " + c);
    }
    long value = 0;
    for (int i = 0; i < 5; i++) {
        value = value * 85 + inBuf[i];
    }
    switch(inCount) {
        case 0:
            outCount = 0;
            break;
        case 1:
            throw new IOException("Final 5-tuple with only one character");
        default:
            outCount = inCount - 1;
            outBuf[0] = (byte) (value >> 24);
            outBuf[1] = (byte) (value >> 16);
            outBuf[2] = (byte) (value >> 8);
            outBuf[3] = (byte) value;
            if (value >> 32 != 0)
                throw new IOException("5-tupel represents a value > 0xFFFFFFFF");
            break;
    }
}

[Buggy Hunk]
if (value >> 32 != 0)

[Patch]
if (inCount == 5 && (value >> 32) != 0)

[Demonstration 3]

[Buggy Method]
void update(int p, int h, eboard e) {
    if (u.contains(p))
        return;
    if (e.c == 'X') {
        if (x.containsKey(p))
            x.replace(p, x.get(p) + h);
        else
            x.put(p, h);
    } else if (e.c == 'O') {
        if (o.containsKey(p))
            o.replace(p, o.get(p) + h);
        else
            o.put(p, h);
    } else {
        x.remove(p);
        o.remove(p);
    }
}

[Buggy Hunk]
if(u.contains(p))

[Patch]
if(u.containsKey(p))