MCPcopy Create free account
hub / github.com/apache/orc / moveFiles

Method moveFiles

java/tools/src/java/org/apache/orc/tools/FileDump.java:647–667  ·  view source on GitHub ↗
(final FileSystem fs, final Path src, final Path dest)

Source from the content-addressed store, hash-verified

645 }
646
647 private static void moveFiles(final FileSystem fs, final Path src, final Path dest)
648 throws IOException {
649 try {
650 // create the dest directory if not exist
651 if (!fs.exists(dest.getParent())) {
652 fs.mkdirs(dest.getParent());
653 }
654
655 // if the destination file exists for some reason delete it
656 fs.delete(dest, false);
657
658 if (fs.rename(src, dest)) {
659 System.err.println("Moved " + src + " to " + dest);
660 } else {
661 throw new IOException("Unable to move " + src + " to " + dest);
662 }
663
664 } catch (Exception e) {
665 throw new IOException("Unable to move " + src + " to " + dest, e);
666 }
667 }
668
669 private static Path getRecoveryFile(final Path corruptPath) {
670 return new Path(corruptPath.getParent(), corruptPath.getName() + ".recovered");

Callers 1

recoverFileMethod · 0.95

Calls 4

getParentMethod · 0.80
mkdirsMethod · 0.45
deleteMethod · 0.45
renameMethod · 0.45

Tested by

no test coverage detected