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