[Demonstration 1]

[Buggy Method]
private void managePacket(Packet packet) {
    if (packet.isSemiAck()) {
        recorder.recordPacket(packet);
        return;
    }
    Neighbor nextNode = null;
    if (packet.isAck()) {
        // if it is the source of a packet sent
        if (packet.getSourceNodeID() == this.node.getId()) {
            Packet.incrementDeliveredPackets();
            recorder.recordPacket(packet);
            packet.drop();
            return;
        } else {
            nextNode = router.routePacket(packet);
            if (nextNode != null) {
                recorder.recordPacket(packet);
            }
        }
    } else {
        if (packet.getDestinationNodeID() == node.getId()) {
            packet.setAck(true);
            node.incrementReceivedPacketCounter();
            icasService.confirmSuccessfulDelivery(packet);
            nextNode = router.routePacket(packet);
            if (nextNode != null) {
                recorder.recordPacket(packet);
            }
        } else {
            if (dropBecauseAmCheater(packet)) {
                System.out.println(packet + " dropped by cheater " + node + " " + packet.getPathlist());
                dropPacket(packet);
                return;
            } else if (dropBecauseComingFromSelfishNode(packet)) {
                System.out.println(packet + " dropped by " + node + " " + packet.getPathlist());
                dropPacket(packet);
                return;
            } else if (packet.getHopsRemaining() == Integer.MIN_VALUE) {
                System.out.println(packet + " dropped for hops by " + node + " " + packet.getPathlist());
                dropPacket(packet);
                return;
            } else {
                // send to next neighbor
                nextNode = router.routePacket(packet);
                if (nextNode != null) {
                    recorder.recordPacket(packet);
                }
            }
        }
    }
    if (nextNode != null) {
        nextNode.getLink().addPacketToUpLink(node, packet);
        if (!packet.isAck()) {
            sendSemiAck(packet);
        }
    } else
        packet.drop();
}

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

[Patch]
if (nextNode != null && nextNode.getLink() != null) {

[Demonstration 2]

[Buggy Method]
@Override
public void put(K k, V v) {
    map = map.put(k, v);
}

[Buggy Hunk]
map = map.put(k, v);

[Patch]
map = map.insert(k, v);

[Demonstration 3]

[Buggy Method]
@Override
public ListInterface<E> insert(E d) {
    if (isEmpty()) {
        current = new Node(d);
        return this;
    }
    while (goToPrevious() && current.data.compareTo(d) > 0) ;
    if (current.prior == null && current.data.compareTo(d) > 0) {
        Node newNode = new Node(d, null, current);
        current.prior = newNode;
        current = newNode;
        return this;
    }
    while (goToNext() && current.data.compareTo(d) <= 0) ;
    if (current.next == null && current.data.compareTo(d) <= 0) {
        Node newNode = new Node(d, current, null);
        current.next = newNode;
        current = newNode;
        return this;
    }
    if (current.data.compareTo(d) > 0) {
        goToPrevious();
    }
    Node newNode = new Node(d, current, current.next);
    current.next.prior = newNode;
    current.prior.next = newNode;
    current = newNode;
    return this;
}

[Buggy Hunk]
current.prior.next = newNode;

[Patch]
current.next = newNode;