|
23 | 23 | import org.apache.hadoop.conf.Configuration; |
24 | 24 | import org.apache.hadoop.fs.FSDataInputStream; |
25 | 25 | import org.apache.hadoop.fs.FSDataOutputStream; |
26 | | -import org.apache.hadoop.fs.FileContext; |
27 | 26 | import org.apache.hadoop.fs.FileStatus; |
28 | 27 | import org.apache.hadoop.fs.FileSystem; |
29 | 28 | import org.apache.hadoop.fs.Path; |
@@ -105,7 +104,6 @@ public class JavaKeyStoreProvider extends KeyProvider { |
105 | 104 | private final Path path; |
106 | 105 | private final FileSystem fs; |
107 | 106 | private FsPermission permissions; |
108 | | - private FileContext context; |
109 | 107 | private KeyStore keyStore; |
110 | 108 | private char[] password; |
111 | 109 | private boolean changed = false; |
@@ -133,7 +131,6 @@ private JavaKeyStoreProvider(URI uri, Configuration conf) throws IOException { |
133 | 131 | this.uri = uri; |
134 | 132 | path = ProviderUtils.unnestUri(uri); |
135 | 133 | fs = path.getFileSystem(conf); |
136 | | - context = FileContext.getFileContext(conf); |
137 | 134 | locateKeystore(); |
138 | 135 | ReadWriteLock lock = new ReentrantReadWriteLock(true); |
139 | 136 | readLock = lock.readLock(); |
@@ -642,7 +639,10 @@ private void revertFromOld(Path oldPath, boolean fileExisted) |
642 | 639 |
|
643 | 640 | private void renameOrFail(Path src, Path dest) |
644 | 641 | throws IOException { |
645 | | - context.rename(src, dest, org.apache.hadoop.fs.Options.Rename.NONE); |
| 642 | + if (!fs.rename(src, dest)) { |
| 643 | + throw new IOException("Rename unsuccessful : " |
| 644 | + + String.format("'%s' to '%s'", src, dest)); |
| 645 | + } |
646 | 646 | } |
647 | 647 |
|
648 | 648 | @Override |
|
0 commit comments