(final FileSystem fs, final Path src, final Path dest)
| 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"); |
no test coverage detected