flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fpompermaier <...@git.apache.org>
Subject [GitHub] flink pull request #3598: [FLINK-6103] LocalFileSystem rename() uses File.re...
Date Fri, 24 Mar 2017 12:49:33 GMT
Github user fpompermaier commented on a diff in the pull request:

    --- Diff: flink-core/src/main/java/org/apache/flink/core/fs/local/LocalFileSystem.java
    @@ -262,8 +265,13 @@ public FSDataOutputStream create(
     	public boolean rename(final Path src, final Path dst) throws IOException {
     		final File srcFile = pathToFile(src);
     		final File dstFile = pathToFile(dst);
    -		return srcFile.renameTo(dstFile);
    +		//Files.move fails if the destination directory doesn't exist
    +		if(dstFile.getParentFile()!= null && !dstFile.getParentFile().exists()){
    +			Files.createDirectories(dstFile.getParentFile().toPath());
    +		}
    +		//this throws an IOException if any error occurs
    +		Files.move(srcFile.toPath(), dstFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
    --- End diff --
    So why is the method trowing an IOException?

If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.

View raw message