本文整理汇总了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;
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}
示例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 <[email protected]>", 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;
}
示例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());
}
}
示例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());
}
}
示例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();
}
示例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));
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
}
示例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);
}