[Demonstration 1]

[Buggy Method]
public void onClick(MouseEvent e) {
    //Grabs the cardholder they just clicked, can be in hand or on board
    Cardholder clickedHolder = this.cardholderContaining(this.hand, e);
    if (clickedHolder == null) {
        clickedHolder = this.cardholderContaining(this.cardholders, e);
    }
    //Grab the one they selected
    if (clickedHolder != null && clickedHolder.isSrcClickable()) {
        this.selectedCardholder = clickedHolder;
        System.out.println("Selected " + this.selectedCardholder);
    } else if (clickedHolder != null && clickedHolder.isDestClickable()) {
        clickedHolder.setCard(this.selectedCardholder.getCard());
        clickedHolder.setSrcClickable(true);
        clickedHolder.setDestClickable(false);
        this.selectedCardholder.clearCard();
        this.selectedCardholder.setSrcClickable(false);
        this.selectedCardholder = null;
    }
    // Cardholder cardholderClick = this.cardholderContaining(this.cardholders,e);
    // //They clicked on a cardholder
    // if(cardholderClick != null) {
    //    //Make sure its empty
    //    if(cardholderClick.getCard() == null && this.selectedCard != null) {
    //       //Set in cardholder
    //       cardholderClick.setCard(this.selectedCard);
    //       //Remove from hand
    //       for(int i = 0; i < this.hand.size(); i++) {
    //          if(this.hand.get(i).getCard() == this.selectedCard) {
    //             this.hand.get(i).clearCard();
    //          }
    //       }
    //       //Clear selectedCard
    //       this.selectedCard = null;
    //    }
    // }
}

[Buggy Hunk]
} else if(clickedHolder != null && clickedHolder.isDestClickable()) {

[Patch]
} else if(clickedHolder != null && clickedHolder.isDestClickable() && this.selectedCardholder != null) {

[Demonstration 2]

[Buggy Method]
public long isAlive(long time) {
    return time < (timeSent + lifetime);
}

[Buggy Hunk]
public long isAlive(long time) {

[Patch]
public boolean isAlive(long time) {

[Demonstration 3]

[Buggy Method]
private static List<LoadMetadataDetails> identifySegmentsToBeMergedBasedOnSize(long compactionSize, List<LoadMetadataDetails> listOfSegmentsAfterPreserve, CarbonLoadModel carbonLoadModel, int partitionCount, String storeLocation) {
    List<LoadMetadataDetails> segmentsToBeMerged = new ArrayList<>(CarbonCommonConstants.DEFAULT_COLLECTION_SIZE);
    CarbonTableIdentifier tableIdentifier = carbonLoadModel.getCarbonDataLoadSchema().getCarbonTable().getCarbonTableIdentifier();
    // variable to store one  segment size across partition.
    long sizeOfOneSegmentAcrossPartition = 0;
    // total length
    long totalLength = 0;
    // check size of each segment , sum it up across partitions
    for (LoadMetadataDetails segment : listOfSegmentsAfterPreserve) {
        String segId = "";
        // segment is already merged. take the merged folder.
        if (null != segment.getMergedLoadName()) {
            segId = segment.getMergedLoadName();
        } else {
            segId = segment.getLoadName();
        }
        // calculate size across partitions
        for (int partition = 0; partition < partitionCount; partition++) {
            String loadPath = CarbonLoaderUtil.getStoreLocation(storeLocation, tableIdentifier, segId, partition + "");
            CarbonFile segmentFolder = FileFactory.getCarbonFile(loadPath, FileFactory.getFileType(loadPath));
            long sizeOfEachSegment = getSizeOfFactFileInLoad(segmentFolder);
            sizeOfOneSegmentAcrossPartition += sizeOfEachSegment;
        }
        totalLength += sizeOfOneSegmentAcrossPartition;
        // if the total length is less than compaction size then consider for compaction.
        if (totalLength < (compactionSize * 1024 * 1024)) {
            segmentsToBeMerged.add(segment);
        } else if (segmentsToBeMerged.size() < 2) {
            // reset everything as do only continuous merge.
            totalLength = 0;
            segmentsToBeMerged.removeAll(segmentsToBeMerged);
            // add the latest one to the list to check for next segments.
            segmentsToBeMerged.add(segment);
            totalLength = sizeOfOneSegmentAcrossPartition;
        }
        // after all partitions
        sizeOfOneSegmentAcrossPartition = 0;
    }
    return segmentsToBeMerged;
}

[Buggy Hunk]
segmentsToBeMerged.removeAll(segmentsToBeMerged);

[Patch]
segmentsToBeMerged.clear();