Skip to content

Commit 7e52c09

Browse files
committed
Revert "HADOOP-17255. JavaKeyStoreProvider fails to create a new key if the keystore is HDFS. (#2291)"
This reverts commit 7f5caca.
1 parent 2cb9e8f commit 7e52c09

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;
@@ -105,7 +104,6 @@ public class JavaKeyStoreProvider extends KeyProvider {
105104
private final Path path;
106105
private final FileSystem fs;
107106
private FsPermission permissions;
108-
private FileContext context;
109107
private KeyStore keyStore;
110108
private char[] password;
111109
private boolean changed = false;
@@ -133,7 +131,6 @@ private JavaKeyStoreProvider(URI uri, Configuration conf) throws IOException {
133131
this.uri = uri;
134132
path = ProviderUtils.unnestUri(uri);
135133
fs = path.getFileSystem(conf);
136-
context = FileContext.getFileContext(conf);
137134
locateKeystore();
138135
ReadWriteLock lock = new ReentrantReadWriteLock(true);
139136
readLock = lock.readLock();
@@ -642,7 +639,10 @@ private void revertFromOld(Path oldPath, boolean fileExisted)
642639

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

648648
@Override

0 commit comments

Comments
 (0)