[Demonstration 1]

[Buggy Method]
@Override
public void execute(Frame frame) {
    OperandStack stack = frame.getOperandStack();
    int index = stack.popInt();
    Objectz arrRef = stack.popRef();
    AALoad.checkNotNull(arrRef);
    long[] longs = arrRef.longs();
    AALoad.checkIndex(longs.length, index);
    stack.pushFloat(longs[index]);
}

[Buggy Hunk]
stack.pushFloat(longs[index]);

[Patch]
stack.pushLong(longs[index]);

[Demonstration 2]

[Buggy Method]
protected void removeSSRC(long ssrc) {
    //find the ssrc
    int index = -1;
    if (ssrcList == null || ssrcList.length == 0) {
        //list is already empty so there's nothing to do.
        return;
    }
    for (int i = 0; i < ssrcList.length; i++) {
        if (ssrcList[i] == ssrc) {
            index = i;
            break;
        }
    }
    if (index < 0 || index >= ssrcList.length) {
        //the ssrc we are trying to remove is not in the list so there's
        //nothing to do.
        return;
    }
    //if we get here and the list has a single element this would mean we
    //simply need to empty it as the only element is the one we are removing
    if (ssrcList.length == 1) {
        setSsrcList(null);
        return;
    }
    long[] newSsrcList = new long[ssrcList.length];
    System.arraycopy(ssrcList, 0, newSsrcList, 0, index);
    if (index < ssrcList.length - 1) {
        System.arraycopy(ssrcList, index + 1, newSsrcList, index, ssrcList.length - index - 1);
    }
    setSsrcList(newSsrcList);
}

[Buggy Hunk]
long[] newSsrcList = new long[ssrcList.length];

[Patch]
long[] newSsrcList = new long[ssrcList.length - 1];

[Demonstration 3]

[Buggy Method]
@Override
public void write(FramedChunk chunk) throws IOException {
    Frame[] frames = chunk.getFrames();
    source.writeInt(frames.length);
    for (Frame frame : frames) {
        byte type = frame.getType();
        byte[] bytes = frame.getPayload();
        int len = bytes == null ? 0 : bytes.length;
        source.writeInt(len);
        source.writeByte(type);
        if (bytes != null) {
            source.write(bytes);
        }
    }
}

[Buggy Hunk]
public void write(FramedChunk chunk)

[Patch]
public synchronized void write(FramedChunk chunk)