[Demonstration 1]

[Buggy Method]
private void createPermanentFileStore(String strPath) {
    try {
        URI uri = new URI(strPath);
        File file = new File(uri);
        if (!file.exists()) {
            Path graphDir = Files.createDirectories(Paths.get(uri.getRawPath()));
            logger.warn("Creating new permanent file store: " + graphDir.toString());
        }
        Runtime.getRuntime().addShutdownHook(new Thread(this::close));
    } catch (FileAlreadyExistsException e) {
        logger.warn("Using existing permanent file store: " + strPath);
    } catch (IOException | URISyntaxException ioe) {
        throw new RuntimeException(ioe);
    }
}

[Buggy Hunk]
Path graphDir = Files.createDirectories(Paths.get(uri.getRawPath()));

[Patch]
Path graphDir = Files.createDirectories(file.toPath());

[Demonstration 2]

[Buggy Method]
private TimeMap readMfraBoxFromTail(ExtractorInput input) {
    DataSource dataSource = input.getDataSource();
    if (dataSource == null || !(dataSource instanceof UriDataSource)) {
        return null;
    }
    String uriString = ((UriDataSource) dataSource).getUri();
    if (uriString == null) {
        return null;
    }
    Uri uri = Uri.parse(uriString);
    if (!Util.isLocalFileUri(uri)) {
        // Do this only the local file
        return null;
    }
    try {
        File file = new File(uri.toString());
        long size = file.length();
        FileDataSource source = new FileDataSource();
        long mfraSize = readMfroBox(source, uri, size);
        if (mfraSize <= 0) {
            // no mfra offset found
            return null;
        }
        byte[] mfraData = new byte[(int) mfraSize];
        source.open(new DataSpec(uri, size - mfraSize, mfraData.length, null));
        source.read(mfraData, 0, mfraData.length);
        source.close();
        ParsableByteArray data = new ParsableByteArray(mfraData);
        // Skip the Atom size
        data.skipBytes(4);
        long atomType = data.readInt();
        if (atomType != Atom.TYPE_mfra) {
            return null;
        }
        TimeMap timeMap = new TimeMap();
        //noinspection StatementWithEmptyBody
        while (readTfra(timeMap, data)) {
        }
        return timeMap;
    } catch (Exception e) {
        Log.w(TAG, "Error while reading Random Access Boxes at the end of the source file: " + e.getMessage(), e);
    }
    return null;
}

[Buggy Hunk]
File file = new File(uri.toString());

[Patch]
File file = new File(uri.getPath());

[Demonstration 3]

[Buggy Method]
void copyTree(Path source, Path target) {
    if (!Files.exists(source)) {
        return;
    }
    log.log(Level.FINE, "copy `%s` to `%s`%n", source, target);
    try {
        Files.createDirectories(target);
        Files.walkFileTree(source, EnumSet.of(FileVisitOption.FOLLOW_LINKS), Integer.MAX_VALUE, new SimpleFileVisitor<>() {

            @Override
            public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
                Path targetdir = target.resolve(source.relativize(dir));
                try {
                    Files.copy(dir, targetdir);
                } catch (FileAlreadyExistsException e) {
                    if (!Files.isDirectory(targetdir)) {
                        throw e;
                    }
                }
                return FileVisitResult.CONTINUE;
            }

            @Override
            public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
                Files.copy(file, target.resolve(source.relativize(file)), StandardCopyOption.REPLACE_EXISTING);
                return FileVisitResult.CONTINUE;
            }
        });
    } catch (IOException e) {
        throw new Error("Copying " + source + " to " + target + " failed: " + e, e);
    }
}

[Buggy Hunk]
throw new Error("Copying " + source + " to " + target + " failed: " + e, e);

[Patch]
log.error(e, "copying `%s` to `%s` failed", source, target);