[Demonstration 1]

[Buggy Method]
@Override
public boolean rename(Path arg0, Path arg1) throws IOException {
    util.dbgPrint("rename");
    // TODO Auto-generated method stub
    return false;
}

[Buggy Hunk]
public boolean rename(Path arg0, Path arg1) throws IOException {

[Patch]
public boolean rename(Path src, Path dst) throws IOException {

[Demonstration 2]

[Buggy Method]
@Override
public PithosFileStatus getFileStatus(Path targetPath) throws IOException {
    // - Process the given path
    pithosPath = new PithosPath(targetPath);
    // - Check if it is the final call from outputstream and perform the
    // final action for the result file(s) movement
    if (PithosOutputStream.isClosed() && !isCommitCalled()) {
        // - Set the current path as the one that constitutes the commit
        // directory for Hadoop outputstream
        setCommitPithosPath(pithosPath);
        // - Perform the final commit by moving the result files to the root
        // output folder
        commitFinalResult();
    }
    urlEsc = null;
    try {
        urlEsc = Utils.urlEscape(null, null, pithosPath.getObjectAbsolutePath(), null);
    } catch (URISyntaxException e) {
        throw new IOException(e);
    }
    metadata = getHadoopPithosConnector().getPithosObjectMetaData(pithosPath.getContainer(), urlEsc, PithosResponseFormat.JSON);
    if (metadata.toString().contains("HTTP/1.1 404 NOT FOUND")) {
        throw new FileNotFoundException("File does not exist in Pithos FS.");
    }
    for (String obj : metadata.getResponseData().keySet()) {
        if (obj != null && (obj.matches("Content-Type") || obj.matches("Content_Type"))) {
            for (String fileType : metadata.getResponseData().get(obj)) {
                if (fileType.contains("application/directory") || fileType.contains("application/folder")) {
                    isDir = true;
                    break;
                } else {
                    isDir = false;
                }
            }
        }
    }
    if (isDir) {
        pithosFileStatus = new PithosFileStatus(true, hdfsBlockSize, false, targetPath);
    } else {
        for (String obj : metadata.getResponseData().keySet()) {
            if (obj != null && obj.matches("Content-Length")) {
                for (String lengthStr : metadata.getResponseData().get(obj)) {
                    length = Long.parseLong(lengthStr);
                }
            }
        }
        modificationTime = metadata.getResponseData().get("Last-Modified").get(0);
        pithosFileStatus = new PithosFileStatus(length, hdfsBlockSize, Utils.dateTimeToEpoch(modificationTime, ""), targetPath);
    }
    return pithosFileStatus;
}

[Buggy Hunk]
if (PithosOutputStream.isClosed() && !isCommitCalled()) {

[Patch]
if (PithosOutputStream.getStreamStatus() && !isCommitCalled()) {

[Demonstration 3]

[Buggy Method]
public void saveHotkeys() {
    File tempHotkeysFile = new File(hotkeysFile.toString() + ".temp");
    try (ObjectOutputStream hotkeysOut = new ObjectOutputStream(new FileOutputStream(hotkeysFile))) {
        hotkeysOut.writeObject(hotkeys.getMap());
        hotkeysOut.flush();
        hotkeysOut.close();
        Files.move(tempHotkeysFile.toPath(), hotkeysFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

[Buggy Hunk]
try ( ObjectOutputStream hotkeysOut = new ObjectOutputStream( new FileOutputStream( hotkeysFile ) ) ) {

[Patch]
try ( ObjectOutputStream hotkeysOut = new ObjectOutputStream( new FileOutputStream( tempHotkeysFile ) ) ) {