[Demonstration 1]

[Buggy Method]
@Override
public boolean writeItemList(ArrayList<Task> tasks) throws IOException {
    String jsonFormat = convertToJsonFormat(tasks);
    File outputFile = new File(filePath);
    FileWriter outputFileWriter = new FileWriter(outputFile, false);
    outputFileWriter.write(jsonFormat);
    outputFileWriter.write(LINE_SEPARATOR);
    outputFileWriter.close();
    return true;
}

[Buggy Hunk]
File outputFile = new File(filePath);

[Patch]
File outputFile = new File(currentFilePath);

[Demonstration 2]

[Buggy Method]
protected byte[] readChunkedPostBody() throws IOException {
    ByteChunk body = new ByteChunk();
    byte[] buffer = new byte[CACHED_POST_LEN];
    int len = 0;
    while (len > -1) {
        len = getStream().read(buffer, 0, CACHED_POST_LEN);
        if (connector.getMaxPostSize() > 0 && (body.getLength() + len) > connector.getMaxPostSize()) {
            // Too much data
            checkSwallowInput();
            throw new IOException(sm.getString("coyoteRequest.chunkedPostTooLarge"));
        }
        if (len > 0) {
            body.append(buffer, 0, len);
        }
    }
    if (body.getLength() == 0) {
        return null;
    }
    if (body.getLength() < body.getBuffer().length) {
        int length = body.getLength();
        byte[] result = new byte[length];
        System.arraycopy(body.getBuffer(), 0, result, 0, length);
        return result;
    }
    return body.getBuffer();
}

[Buggy Hunk]
if (connector.getMaxPostSize() > 0 &&

[Patch]
if (connector.getMaxPostSize() >= 0 &&

[Demonstration 3]

[Buggy Method]
public String report() {
    return "\n\t---- Network Statistics Report ----\n" + "\n\tOriginal Packets Sent:      " + this.originalPacketCount + "\n\tRetransmitted Packets Sent: " + this.retransmittedPacketCount + "\n\tACK Packets Sent:           " + this.ackPacketCount + "\n\tCorrupted Packets Received: " + this.corruptedPacketCount + "\n\tAverage RTT:                " + this.averageRTT + "\n\tPacket loss %:              " + 100.0 * (1.0 - (0.5 * ((double) this.receiverPacketReceivedCount / (double) (this.originalPacketCount + this.retransmittedPacketCount)) + 0.5 * ((double) this.senderPacketReceivedCount / (double) this.ackPacketCount))) + "\n\tPacket corruption %:        " + 100.0 * (double) this.corruptedPacketCount / (double) (this.senderPacketReceivedCount + this.receiverPacketReceivedCount);
}

[Buggy Hunk]
+ "\n\tPacket loss %:              " + 100.0 * (1.0 - (0.5 * ((double)this.receiverPacketReceivedCount / (double)(this.originalPacketCount + this.retransmittedPacketCount)) + 0.5 * ((double)this.senderPacketReceivedCount / (double)this.ackPacketCount)))

[Patch]
+ "\n\tPacket loss %:              " + 100.0 * (1.0 - (0.5 * ((double)this.receiverPacketReceivedCount / (double)(this.originalPacketCount + this.retransmittedPacketCount - 1)) + 0.5 * ((double)this.senderPacketReceivedCount / (double)this.ackPacketCount)))