[Demonstration 1]

[Buggy Method]
private StorageLocation loadSegmentWithRetry(DataSegment segment, String storageDirStr) throws SegmentLoadingException {
    for (StorageLocation loc : locations) {
        // locIter is ordered from empty to full
        if (!loc.canHandle(segment.getSize())) {
            throw new ISE("Segment[%s:%,d] too large for storage[%s:%,d].", segment.getIdentifier(), segment.getSize(), loc.getPath(), loc.available());
        }
        File storageDir = new File(loc.getPath(), storageDirStr);
        try {
            loadInLocationWithStartMarker(segment, storageDir);
            return loc;
        } catch (SegmentLoadingException e) {
            log.makeAlert(e, "Failed to load segment in current location %s, try next location if any", loc.getPath().getAbsolutePath()).addData("location", loc.getPath().getAbsolutePath()).emit();
            try {
                cleanupCacheFiles(loc.getPath(), storageDir);
            } catch (IOException e1) {
                log.error(e1, "Failed to cleanup location " + storageDir.getAbsolutePath());
            }
        }
    }
    throw new SegmentLoadingException("Failed to load segment %s in all locations.", segment.getIdentifier());
}

[Buggy Hunk]
for (StorageLocation loc : locations) {

[Patch]
for (StorageLocation loc : getSortedSet(locations)) {

[Demonstration 2]

[Buggy Method]
public void cancel() {
    try {
        mmSocket.close();
    } catch (IOException e) {
    }
}

[Buggy Hunk]
}catch (IOException e) {}

[Patch]
}catch (IOException e) { System.out.print("error at 215");}

[Demonstration 3]

[Buggy Method]
public boolean hasBeenDelivered(Calendar currentDate) {
    if (MyCalendarUtils.getDiff(currentDate, deliveryDate) > 0) {
        return true;
    }
    return false;
}

[Buggy Hunk]
if ( MyCalendarUtils.getDiff(currentDate, deliveryDate) > 0 ) {

[Patch]
if ( MyCalendarUtils.getDiff(currentDate, deliveryDate) >= 0 ) {