本文整理汇总了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;