Skip to content

Commit d6fd82c

Browse files
committed
Revert "HADOOP-17255. JavaKeyStoreProvider fails to create a new key if the keystore is HDFS. (#2291)"
This reverts commit 1c7043b.
1 parent ce883fe commit d6fd82c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/JavaKeyStoreProvider.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import org.apache.hadoop.conf.Configuration;
2424
import org.apache.hadoop.fs.FSDataInputStream;
2525
import org.apache.hadoop.fs.FSDataOutputStream;
26-
import org.apache.hadoop.fs.FileContext;
2726
import org.apache.hadoop.fs.FileStatus;
2827
import org.apache.hadoop.fs.FileSystem;
2928
import org.apache.hadoop.fs.Path;
@@ -104,7 +103,6 @@ public class JavaKeyStoreProvider extends KeyProvider {
104103
private final Path path;
105104
private final FileSystem fs;
106105
private FsPermission permissions;
107-
private FileContext context;
108106
private KeyStore keyStore;
109107
private char[] password;
110108
private boolean changed = false;
@@ -132,7 +130,6 @@ private JavaKeyStoreProvider(URI uri, Configuration conf) throws IOException {
132130
this.uri = uri;
133131
path = ProviderUtils.unnestUri(uri);
134132
fs = path.getFileSystem(conf);
135-
context = FileContext.getFileContext(conf);
136133
locateKeystore();
137134
ReadWriteLock lock = new ReentrantReadWriteLock(true);
138135
readLock = lock.readLock();
@@ -641,7 +638,10 @@ private void revertFromOld(Path oldPath, boolean fileExisted)
641638

642639
private void renameOrFail(Path src, Path dest)
643640
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+
}
645645
}
646646

647647
@Override

0 commit comments

Comments
 (0)