Repository: incubator-beam Updated Branches: refs/heads/master 479c19a0b -> 1543ea952
[BEAM-951] Inline copyOne() and improve comments. Project: http://git-wip-us.apache.org/repos/asf/incubator-beam/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-beam/commit/18b286ed Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/18b286ed Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/18b286ed Branch: refs/heads/master Commit: 18b286ed5bd5b09c39fe95f64a9c74b77f5950bc Parents: a7be3f2 Author: Pei He <[email protected]> Authored: Tue Nov 15 11:59:08 2016 -0800 Committer: Davor Bonaci <[email protected]> Committed: Thu Nov 17 10:54:55 2016 -0800 ---------------------------------------------------------------------- .../beam/sdk/util/FileIOChannelFactory.java | 26 +++++++++----------- 1 file changed, 11 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/18b286ed/sdks/java/core/src/main/java/org/apache/beam/sdk/util/FileIOChannelFactory.java ---------------------------------------------------------------------- diff --git a/sdks/java/core/src/main/java/org/apache/beam/sdk/util/FileIOChannelFactory.java b/sdks/java/core/src/main/java/org/apache/beam/sdk/util/FileIOChannelFactory.java index 5cba970..0eefb77 100644 --- a/sdks/java/core/src/main/java/org/apache/beam/sdk/util/FileIOChannelFactory.java +++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/util/FileIOChannelFactory.java @@ -175,21 +175,17 @@ public class FileIOChannelFactory implements IOChannelFactory { String src = srcFilenames.get(i); String dst = destFilenames.get(i); LOG.debug("Copying {} to {}", src, dst); - copyOne(src, dst); - } - } - - private void copyOne(String source, String destination) throws IOException { - try { - // Copy the source file, replacing the existing destination. - // Paths.get(x) will not work on win cause of the ":" after the drive letter - Files.copy( - new File(source).toPath(), - new File(destination).toPath(), - StandardCopyOption.REPLACE_EXISTING); - } catch (NoSuchFileException e) { - LOG.debug("{} does not exist.", source); - // Suppress exception if file does not exist. + try { + // Copy the source file, replacing the existing destination. + // Paths.get(x) will not work on Windows OSes cause of the ":" after the drive letter. + Files.copy( + new File(src).toPath(), + new File(dst).toPath(), + StandardCopyOption.REPLACE_EXISTING); + } catch (NoSuchFileException e) { + LOG.debug("{} does not exist.", src); + // Suppress exception if file does not exist. + } } }
