当前位置: 首页>>代码示例>>Java>>正文


Java ConfigInvalidException类代码示例

本文整理汇总了Java中org.eclipse.jgit.errors.ConfigInvalidException的典型用法代码示例。如果您正苦于以下问题:Java ConfigInvalidException类的具体用法?Java ConfigInvalidException怎么用?Java ConfigInvalidException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ConfigInvalidException类属于org.eclipse.jgit.errors包,在下文中一共展示了ConfigInvalidException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: VirtualHostConfig

import org.eclipse.jgit.errors.ConfigInvalidException; //导入依赖的package包/类
@Inject
VirtualHostConfig(SitePaths sitePaths) {
  File configFile = sitePaths.etc_dir.resolve("virtualhost.config").toFile();
  FileBasedConfig fileConfig = new FileBasedConfig(configFile, FS.DETECTED);
  config = fileConfig;
  try {
    fileConfig.load();
  } catch (IOException | ConfigInvalidException e) {
    log.error("Unable to open or parse " + configFile + ": virtual domains are disabled", e);
    enabled = false;
    defaultProjects = new String[0];
    return;
  }
  defaultProjects = config.getStringList("default", null, "projects");
  enabled = !config.getSubsections("server").isEmpty() || defaultProjects.length > 0;
}
 
开发者ID:GerritForge,项目名称:gerrit-virtualhost,代码行数:17,代码来源:VirtualHostConfig.java

示例2: apply

import org.eclipse.jgit.errors.ConfigInvalidException; //导入依赖的package包/类
@Override
public Response<String> apply(AccountResource rsrc, HttpPasswordInput input)
    throws AuthException, ResourceNotFoundException, ResourceConflictException, OrmException,
        IOException, ConfigInvalidException, PermissionBackendException {
  if (self.get() != rsrc.getUser()) {
    permissionBackend.user(self).check(GlobalPermission.ADMINISTRATE_SERVER);
  }

  if (input == null) {
    input = new HttpPasswordInput();
  }
  input.httpPassword = Strings.emptyToNull(input.httpPassword);

  String newPassword;
  if (input.generate) {
    newPassword = generate();
  } else if (input.httpPassword == null) {
    newPassword = null;
  } else {
    // Only administrators can explicitly set the password.
    permissionBackend.user(self).check(GlobalPermission.ADMINISTRATE_SERVER);
    newPassword = input.httpPassword;
  }
  return apply(rsrc.getUser(), newPassword);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:26,代码来源:PutHttpPassword.java

示例3: updateLink

import org.eclipse.jgit.errors.ConfigInvalidException; //导入依赖的package包/类
/**
 * Update the link to another unique authentication identity to an existing account.
 *
 * <p>Existing external identities with the same scheme will be removed and replaced with the new
 * one.
 *
 * @param to account to link the identity onto.
 * @param who the additional identity.
 * @return the result of linking the identity to the user.
 * @throws OrmException
 * @throws AccountException the identity belongs to a different account, or it cannot be linked at
 *     this time.
 */
public AuthResult updateLink(Account.Id to, AuthRequest who)
    throws OrmException, AccountException, IOException, ConfigInvalidException {
  Collection<ExternalId> filteredExtIdsByScheme =
      externalIds.byAccount(to, who.getExternalIdKey().scheme());

  if (!filteredExtIdsByScheme.isEmpty()
      && (filteredExtIdsByScheme.size() > 1
          || !filteredExtIdsByScheme
              .stream()
              .filter(e -> e.key().equals(who.getExternalIdKey()))
              .findAny()
              .isPresent())) {
    externalIdsUpdateFactory.create().delete(filteredExtIdsByScheme);
  }
  return link(to, who);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:30,代码来源:AccountManager.java

示例4: onLoad

import org.eclipse.jgit.errors.ConfigInvalidException; //导入依赖的package包/类
@Override
protected void onLoad(LoadHandle handle) throws IOException, ConfigInvalidException {
  metaId = handle.id();
  if (metaId == null) {
    loadDefaults();
    return;
  }
  metaId = metaId.copy();

  RevCommit tipCommit = handle.walk().parseCommit(metaId);
  ObjectReader reader = handle.walk().getObjectReader();
  revisionNoteMap =
      RevisionNoteMap.parseRobotComments(args.noteUtil, reader, NoteMap.read(reader, tipCommit));
  ListMultimap<RevId, RobotComment> cs = MultimapBuilder.hashKeys().arrayListValues().build();
  for (RobotCommentsRevisionNote rn : revisionNoteMap.revisionNotes.values()) {
    for (RobotComment c : rn.getComments()) {
      cs.put(new RevId(c.revId), c);
    }
  }
  comments = ImmutableListMultimap.copyOf(cs);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:22,代码来源:RobotCommentNotes.java

示例5: applyImpl

import org.eclipse.jgit.errors.ConfigInvalidException; //导入依赖的package包/类
@Override
protected Response<?> applyImpl(
    BatchUpdate.Factory updateFactory, ChangeResource rsrc, PublishChangeEditInput in)
    throws IOException, OrmException, RestApiException, UpdateException, ConfigInvalidException,
        NoSuchProjectException {
  contributorAgreementsChecker.check(rsrc.getProject(), rsrc.getUser());
  Optional<ChangeEdit> edit = editUtil.byChange(rsrc.getNotes(), rsrc.getUser());
  if (!edit.isPresent()) {
    throw new ResourceConflictException(
        String.format("no edit exists for change %s", rsrc.getChange().getChangeId()));
  }
  if (in == null) {
    in = new PublishChangeEditInput();
  }
  editUtil.publish(
      updateFactory,
      rsrc.getNotes(),
      rsrc.getUser(),
      edit.get(),
      in.notify,
      notifyUtil.resolveAccounts(in.notifyDetails));
  return Response.none();
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:24,代码来源:PublishChangeEdit.java

示例6: find

import org.eclipse.jgit.errors.ConfigInvalidException; //导入依赖的package包/类
/**
 * Locate exactly one account matching the name or name/email string.
 *
 * @param nameOrEmail a string of the format "Full Name &lt;[email protected]&gt;", just the email
 *     address ("[email protected]"), a full name ("Full Name"), an account id ("18419") or an user
 *     name ("username").
 * @return the single account that matches; null if no account matches or there are multiple
 *     candidates.
 */
public Account find(String nameOrEmail) throws OrmException, IOException, ConfigInvalidException {
  Set<Account.Id> r = findAll(nameOrEmail);
  if (r.size() == 1) {
    return byId.get(r.iterator().next()).getAccount();
  }

  Account match = null;
  for (Account.Id id : r) {
    Account account = byId.get(id).getAccount();
    if (!account.isActive()) {
      continue;
    }
    if (match != null) {
      return null;
    }
    match = account;
  }
  return match;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:29,代码来源:AccountResolver.java

示例7: grant

import org.eclipse.jgit.errors.ConfigInvalidException; //导入依赖的package包/类
protected void grant(
    Project.NameKey project,
    String ref,
    String permission,
    boolean force,
    AccountGroup.UUID groupUUID)
    throws RepositoryNotFoundException, IOException, ConfigInvalidException {
  try (MetaDataUpdate md = metaDataUpdateFactory.create(project)) {
    md.setMessage(String.format("Grant %s on %s", permission, ref));
    ProjectConfig config = ProjectConfig.read(md);
    AccessSection s = config.getAccessSection(ref, true);
    Permission p = s.getPermission(permission, true);
    PermissionRule rule = Util.newRule(config, groupUUID);
    rule.setForce(force);
    p.add(rule);
    config.commit(md);
    projectCache.evict(config.getProject());
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:20,代码来源:AbstractDaemonTest.java

示例8: grantLabel

import org.eclipse.jgit.errors.ConfigInvalidException; //导入依赖的package包/类
protected void grantLabel(
    String label,
    int min,
    int max,
    Project.NameKey project,
    String ref,
    boolean force,
    AccountGroup.UUID groupUUID,
    boolean exclusive)
    throws RepositoryNotFoundException, IOException, ConfigInvalidException {
  String permission = Permission.LABEL + label;
  try (MetaDataUpdate md = metaDataUpdateFactory.create(project)) {
    md.setMessage(String.format("Grant %s on %s", permission, ref));
    ProjectConfig config = ProjectConfig.read(md);
    AccessSection s = config.getAccessSection(ref, true);
    Permission p = s.getPermission(permission, true);
    p.setExclusiveGroup(exclusive);
    PermissionRule rule = Util.newRule(config, groupUUID);
    rule.setForce(force);
    rule.setMin(min);
    rule.setMax(max);
    p.add(rule);
    config.commit(md);
    projectCache.evict(config.getProject());
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:27,代码来源:AbstractDaemonTest.java

示例9: apply

import org.eclipse.jgit.errors.ConfigInvalidException; //导入依赖的package包/类
@Override
public Response<?> apply(AccountResource rsrc, List<ProjectWatchInfo> input)
    throws AuthException, UnprocessableEntityException, OrmException, IOException,
        ConfigInvalidException, PermissionBackendException {
  if (self.get() != rsrc.getUser()) {
    permissionBackend.user(self).check(GlobalPermission.ADMINISTRATE_SERVER);
  }
  if (input == null) {
    return Response.none();
  }

  Account.Id accountId = rsrc.getUser().getAccountId();
  watchConfig.deleteProjectWatches(
      accountId,
      input
          .stream()
          .filter(Objects::nonNull)
          .map(w -> ProjectWatchKey.create(new Project.NameKey(w.project), w.filter))
          .collect(toList()));
  accountCache.evict(accountId);
  return Response.none();
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:23,代码来源:DeleteWatchedProjects.java

示例10: parse

import org.eclipse.jgit.errors.ConfigInvalidException; //导入依赖的package包/类
static RevisionNoteMap<ChangeRevisionNote> parse(
    ChangeNoteUtil noteUtil,
    Change.Id changeId,
    ObjectReader reader,
    NoteMap noteMap,
    PatchLineComment.Status status)
    throws ConfigInvalidException, IOException {
  Map<RevId, ChangeRevisionNote> result = new HashMap<>();
  for (Note note : noteMap) {
    ChangeRevisionNote rn =
        new ChangeRevisionNote(noteUtil, changeId, reader, note.getData(), status);
    rn.parse();
    result.put(new RevId(note.name()), rn);
  }
  return new RevisionNoteMap<>(noteMap, ImmutableMap.copyOf(result));
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:17,代码来源:RevisionNoteMap.java

示例11: migrateData

import org.eclipse.jgit.errors.ConfigInvalidException; //导入依赖的package包/类
@Override
protected void migrateData(ReviewDb db, UpdateUI ui) throws OrmException {
  try (Repository git = repoManager.openRepository(allProjectsName);
      MetaDataUpdate md =
          new MetaDataUpdate(GitReferenceUpdated.DISABLED, allProjectsName, git)) {
    ProjectConfig config = ProjectConfig.read(md);

    GroupReference registered = systemGroupBackend.getGroup(REGISTERED_USERS);
    AccessSection refsFor = config.getAccessSection("refs/for/*", true);
    grant(config, refsFor, Permission.ADD_PATCH_SET, false, false, registered);

    md.getCommitBuilder().setAuthor(serverUser);
    md.getCommitBuilder().setCommitter(serverUser);
    md.setMessage(COMMIT_MSG);
    config.commit(md);
  } catch (ConfigInvalidException | IOException ex) {
    throw new OrmException(ex);
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:20,代码来源:Schema_128.java

示例12: getRevisionNoteMap

import org.eclipse.jgit.errors.ConfigInvalidException; //导入依赖的package包/类
private RevisionNoteMap<ChangeRevisionNote> getRevisionNoteMap(RevWalk rw, ObjectId curr)
    throws ConfigInvalidException, OrmException, IOException {
  if (curr.equals(ObjectId.zeroId())) {
    return RevisionNoteMap.emptyMap();
  }
  if (migration.readChanges()) {
    // If reading from changes is enabled, then the old ChangeNotes may have
    // already parsed the revision notes. We can reuse them as long as the ref
    // hasn't advanced.
    ChangeNotes notes = getNotes();
    if (notes != null && notes.revisionNoteMap != null) {
      ObjectId idFromNotes = firstNonNull(notes.load().getRevision(), ObjectId.zeroId());
      if (idFromNotes.equals(curr)) {
        return notes.revisionNoteMap;
      }
    }
  }
  NoteMap noteMap = NoteMap.read(rw.getObjectReader(), rw.parseCommit(curr));
  // Even though reading from changes might not be enabled, we need to
  // parse any existing revision notes so we can merge them.
  return RevisionNoteMap.parse(
      noteUtil, getId(), rw.getObjectReader(), noteMap, PatchLineComment.Status.PUBLISHED);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:24,代码来源:ChangeUpdate.java

示例13: delete

import org.eclipse.jgit.errors.ConfigInvalidException; //导入依赖的package包/类
/**
 * Deletes external IDs.
 *
 * @throws IllegalStateException is thrown if there is an existing external ID that has the same
 *     key as any of the external IDs that should be deleted, but otherwise doesn't match the that
 *     external ID.
 */
public void delete(Collection<ExternalId> extIds)
    throws IOException, ConfigInvalidException, OrmException {
  RefsMetaExternalIdsUpdate u =
      updateNoteMap(
          o -> {
            UpdatedExternalIds updatedExtIds = new UpdatedExternalIds();
            for (ExternalId extId : extIds) {
              ExternalId removedExtId = remove(o.rw(), o.noteMap(), extId);
              updatedExtIds.onRemove(removedExtId);
            }
            return updatedExtIds;
          });
  externalIdCache.onRemove(u.oldRev(), u.newRev(), u.updatedExtIds().getRemoved());
  evictAccounts(u);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:23,代码来源:ExternalIdsUpdate.java

示例14: setAccountIdentity

import org.eclipse.jgit.errors.ConfigInvalidException; //导入依赖的package包/类
private void setAccountIdentity(IdentifiedUser user, HttpServletRequest req)
    throws ServletException, ConfigInvalidException {
  String fullName = req.getParameter("fullname");
  String email = req.getParameter("email");
  try {
    Id accountId = user.getAccountId();
    AuthResult result = accountManager.link(accountId, AuthRequest.forEmail(email));
    log.debug("Account {} linked to email {}: result = {}", accountId, email, result);

    putPreferred.apply(new AccountResource.Email(user, email), null);
    PutName.Input nameInput = new PutName.Input();
    nameInput.name = fullName;
    putName.apply(user, nameInput);
    log.debug(
        "Account {} updated with preferredEmail = {} and fullName = {}",
        accountId,
        email,
        fullName);

    accountCache.evict(accountId);
    log.debug("Account cache evicted for {}", accountId);
  } catch (Exception e) {
    throw new ServletException(
        "Cannot associate email '" + email + "' to current user '" + user + "'", e);
  }
}
 
开发者ID:GerritCodeReview,项目名称:plugins_github,代码行数:27,代码来源:AccountController.java

示例15: onLoad

import org.eclipse.jgit.errors.ConfigInvalidException; //导入依赖的package包/类
@Override
protected void onLoad(LoadHandle handle) throws IOException, ConfigInvalidException {
  ObjectId rev = handle.id();
  if (rev == null) {
    loadDefaults();
    return;
  }

  RevCommit tipCommit = handle.walk().parseCommit(rev);
  ObjectReader reader = handle.walk().getObjectReader();
  revisionNoteMap =
      RevisionNoteMap.parse(
          args.noteUtil,
          getChangeId(),
          reader,
          NoteMap.read(reader, tipCommit),
          PatchLineComment.Status.DRAFT);
  ListMultimap<RevId, Comment> cs = MultimapBuilder.hashKeys().arrayListValues().build();
  for (ChangeRevisionNote rn : revisionNoteMap.revisionNotes.values()) {
    for (Comment c : rn.getComments()) {
      cs.put(new RevId(c.revId), c);
    }
  }
  comments = ImmutableListMultimap.copyOf(cs);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:26,代码来源:DraftCommentNotes.java


注:本文中的org.eclipse.jgit.errors.ConfigInvalidException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。