本文整理匯總了Java中com.google.gerrit.common.errors.InvalidSshKeyException類的典型用法代碼示例。如果您正苦於以下問題:Java InvalidSshKeyException類的具體用法?Java InvalidSshKeyException怎麽用?Java InvalidSshKeyException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
InvalidSshKeyException類屬於com.google.gerrit.common.errors包,在下文中一共展示了InvalidSshKeyException類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addKey
import com.google.gerrit.common.errors.InvalidSshKeyException; //導入依賴的package包/類
public synchronized AccountSshKey addKey(Account.Id accountId, String pub)
throws IOException, ConfigInvalidException, InvalidSshKeyException {
VersionedAuthorizedKeys authorizedKeys = read(accountId);
AccountSshKey key = authorizedKeys.addKey(pub);
commit(authorizedKeys);
return key;
}
示例2: createBatchUserIfNotExistsYet
import com.google.gerrit.common.errors.InvalidSshKeyException; //導入依賴的package包/類
private void createBatchUserIfNotExistsYet() {
try (ReviewDb db = schema.open()) {
List<Account> accounts = db.accounts().anyAccounts().toList();
if (accounts.isEmpty()) {
logger.info("Cannot create batch user account. No admin user yet. Log in as admin user to Gerrit.");
executor.schedule(this::createBatchUserIfNotExistsYet, 2, TimeUnit.SECONDS);
return;
}
RequestContext oldContext = null;
try {
oldContext = context.setContext(new RequestContext() {
@Override
public CurrentUser getUser() {
return userFactory.create(accounts.iterator().next().getId());
}
@Override
public Provider<ReviewDb> getReviewDbProvider() {
return () -> db;
}
});
AccountExternalId.Key accountKey = new AccountExternalId.Key(AccountExternalId.SCHEME_USERNAME, username);
AccountExternalId accountExternalId = db.accountExternalIds().get(accountKey);
if (accountExternalId == null) {
accountExternalId = createBatchUser(db);
logger.info("Batch user account created");
}
authorizedKeys.addKey(accountExternalId.getAccountId(), sshKey);
sshKeyCache.evict(username);
} finally {
if (oldContext != null) {
context.setContext(oldContext);
}
}
} catch (OrmException | IOException | ConfigInvalidException | InvalidSshKeyException e) {
throw new RuntimeException(e);
}
}
示例3: create
import com.google.gerrit.common.errors.InvalidSshKeyException; //導入依賴的package包/類
@Override
public AccountSshKey create(AccountSshKey.Id id, String encoded) throws InvalidSshKeyException {
throw new InvalidSshKeyException();
}
示例4: create
import com.google.gerrit.common.errors.InvalidSshKeyException; //導入依賴的package包/類
AccountSshKey create(AccountSshKey.Id id, String encoded) throws InvalidSshKeyException;