Remove duplicated method in VersionedAuthorizedKeys
open and read method were identicals, only keep read method.
Change-Id: I449b9c57a5fdcca26f1930e004b948ae68094a04
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/account/VersionedAuthorizedKeys.java b/gerrit-server/src/main/java/com/google/gerrit/server/account/VersionedAuthorizedKeys.java
index befccb6..c3fab98 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/account/VersionedAuthorizedKeys.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/account/VersionedAuthorizedKeys.java
@@ -104,7 +104,7 @@
public AccountSshKey addKey(Account.Id accountId, String pub)
throws IOException, ConfigInvalidException, InvalidSshKeyException {
- try (VersionedAuthorizedKeys authorizedKeys = open(accountId)) {
+ try (VersionedAuthorizedKeys authorizedKeys = read(accountId)) {
AccountSshKey key = authorizedKeys.addKey(pub);
commit(authorizedKeys);
return key;
@@ -113,7 +113,7 @@
public void deleteKey(Account.Id accountId, int seq)
throws IOException, ConfigInvalidException {
- try (VersionedAuthorizedKeys authorizedKeys = open(accountId)) {
+ try (VersionedAuthorizedKeys authorizedKeys = read(accountId)) {
if (authorizedKeys.deleteKey(seq)) {
commit(authorizedKeys);
}
@@ -122,7 +122,7 @@
public void markKeyInvalid(Account.Id accountId, int seq)
throws IOException, ConfigInvalidException {
- try (VersionedAuthorizedKeys authorizedKeys = open(accountId)) {
+ try (VersionedAuthorizedKeys authorizedKeys = read(accountId)) {
if (authorizedKeys.markKeyInvalid(seq)) {
commit(authorizedKeys);
}
@@ -139,15 +139,6 @@
}
}
- private VersionedAuthorizedKeys open(Account.Id accountId)
- throws IOException, ConfigInvalidException {
- Repository git = repoManager.openRepository(allUsersName);
- VersionedAuthorizedKeys authorizedKeys =
- authorizedKeysFactory.create(accountId);
- authorizedKeys.load(git);
- return authorizedKeys;
- }
-
private void commit(VersionedAuthorizedKeys authorizedKeys)
throws IOException {
try (MetaDataUpdate md = metaDataUpdateFactory.get().create(allUsersName,