[Demonstration 1]

[Buggy Method]
public int lookup(String key, int index, int j) {
    int base = 1;
    if (index != 0) {
        base = baseBuffer.get(index);
    }
    int keyLength = key.length();
    for (int i = j; i < keyLength; i++) {
        int previous = index;
        if (compact) {
            index = base + key.charAt(i);
        } else {
            index = index + base + key.charAt(i);
        }
        if (index > baseBuffer.limit()) {
            // Too long
            return -1;
        }
        base = baseBuffer.get(index);
        if (base == 0) {
            // Didn't find match
            return -1;
        }
        if (checkBuffer.get(index) != previous) {
            // check doesn't match
            return -1;
        }
        if (base >= TAIL_OFFSET) {
            // If base is bigger than TAIL_OFFSET, start processing "tail"
            return matchTail(base, index, key.substring(i + 1));
        }
    }
    // If we reach at the end of input keyword, check if it is complete match by looking for following terminating character
    int endIndex;
    if (compact) {
        endIndex = base + TERMINATING_CHARACTER;
    } else {
        endIndex = index + base + TERMINATING_CHARACTER;
    }
    return checkBuffer.get(endIndex) == index ? index : 0;
}

[Buggy Hunk]
if (index > baseBuffer.limit()) { // Too long

[Patch]
if (index >= baseBuffer.limit()) { // Too long

[Demonstration 2]

[Buggy Method]
private void CheckConcate(String value1, String value2) {
    if (!value2.equals("null") && !value2.equals("") && !value2.equals(" টাকা")) {
        key[increment] = value1;
        value[increment] = value2;
        increment++;
    }
}

[Buggy Hunk]
if (!value2.equals("null") && !value2.equals("")&& !value2.equals(" টাকা")) {

[Patch]
if (!value2.equals("null") && !value2.equals("")&& !value2.equals(" টাকা")&&!value2.equals(" ০")) {

[Demonstration 3]

[Buggy Method]
@Override
public void notifyChangedSlot(LocoNetSlot s) {
    log.debug("notifyChangedSlot - slot {}, slotStatus {}", s.getSlot(), Integer.toHexString(s.slotStatus()));
    // This is invoked only if the SlotManager knows that the LnThrottleManager is
    // interested in the address associated with this slot.
    // need to check to see if the slot is in a suitable state for creating a throttle.
    if (s.slotStatus() == LnConstants.LOCO_IN_USE) {
        // loco is already in-use or is consist-mid or consist-sub
        log.warn("slot {} address {} is  already in-use.", s.getSlot(), s.locoAddr());
        // is the throttle ID the same as for this JMRI instance?  If not, do not accept the slot.
        if (s.id() != throttleID) {
            // notify the LnThrottleManager about failure of acquisition.
            // NEED TO TRIGGER THE NEW "STEAL REQUIRED" FUNCITONALITY HERE
            //note: throttle listener expects to have "callback" method notifyStealThrottleRequired
            //invoked if a "steal" is required.  Make that happen as part of the "acquisition" process
            slotForAddress.put(s.locoAddr(), s);
            notifyStealRequest(s.locoAddr());
            return;
        }
    }
    if ((s.consistStatus() == LnConstants.CONSIST_MID) | (s.consistStatus() == LnConstants.CONSIST_SUB)) {
        // cannot acquire loco account is consist-mid or consist-sub
        log.warn("slot {} address {} cannot be acquired for loco control account already in-use, consist-mid or consist-sub.", s.getSlot(), s.locoAddr());
        // notify the LnThrottleManager about failure of acquisition.
        notifyRefused(s.locoAddr(), "Locomotive burried in a consist cannot be acquired.");
        return;
    }
    commitToAcquireThrottle(s);
}

[Buggy Hunk]
if ((s.consistStatus() == LnConstants.CONSIST_MID) |

[Patch]
if ((s.consistStatus() == LnConstants.CONSIST_MID) ||