use of com.intellij.cvsSupport2.cvsoperations.cvsErrors.ErrorProcessor in project intellij-community by JetBrains.
the class CvsRootConfiguration method testConnection.
public void testConnection(Project project) throws AuthenticationException, IOException {
final IConnection connection = createSettings().createConnection(new ReadWriteStatistics());
final ErrorMessagesProcessor errorProcessor = new ErrorMessagesProcessor();
final CvsExecutionEnvironment cvsExecutionEnvironment = new CvsExecutionEnvironment(errorProcessor, CvsExecutionEnvironment.DUMMY_STOPPER, errorProcessor, PostCvsActivity.DEAF, project);
final CvsResult result = new CvsResultEx();
try {
ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> {
final GetModulesListOperation operation = new GetModulesListOperation(createSettings());
final CvsRootProvider cvsRootProvider = operation.getCvsRootProvider();
try {
if (connection instanceof SelfTestingConnection) {
((SelfTestingConnection) connection).test(CvsListenerWithProgress.createOnProgress());
}
operation.execute(cvsRootProvider, cvsExecutionEnvironment, connection, DummyProgressViewer.INSTANCE);
} catch (ValidRequestsExpectedException ex) {
result.addError(new CvsException(ex, cvsRootProvider.getCvsRootAsString()));
} catch (CommandException ex) {
result.addError(new CvsException(ex.getUnderlyingException(), cvsRootProvider.getCvsRootAsString()));
} catch (ProcessCanceledException ex) {
result.setIsCanceled();
} catch (BugLog.BugException e) {
LOG.error(e);
} catch (Exception e) {
result.addError(new CvsException(e, cvsRootProvider.getCvsRootAsString()));
}
}, CvsBundle.message("operation.name.test.connection"), true, null);
if (result.isCanceled())
throw new ProcessCanceledException();
if (result.hasErrors()) {
final VcsException vcsException = result.composeError();
throw new AuthenticationException(vcsException.getLocalizedMessage(), vcsException.getCause());
}
final List<VcsException> errors = errorProcessor.getErrors();
if (!errors.isEmpty()) {
final VcsException firstError = errors.get(0);
throw new AuthenticationException(firstError.getLocalizedMessage(), firstError);
}
} finally {
connection.close();
}
}
use of com.intellij.cvsSupport2.cvsoperations.cvsErrors.ErrorProcessor in project intellij-community by JetBrains.
the class StickyHeadGetter method getBranchHeadRevision.
@Nullable
protected String getBranchHeadRevision(final VirtualFile parent, final String name, final Convertor<CvsRevisionNumber, Boolean> chooser) {
final LocalPathIndifferentLogOperation operation = new LocalPathIndifferentLogOperation(new File(parent.getPath(), name));
final Ref<Boolean> logSuccess = new Ref<>(Boolean.TRUE);
final CvsExecutionEnvironment cvsExecutionEnvironment = new CvsExecutionEnvironment(new CvsMessagesAdapter(), CvsExecutionEnvironment.DUMMY_STOPPER, new ErrorProcessor() {
public void addError(VcsException ex) {
logSuccess.set(Boolean.FALSE);
}
public List<VcsException> getErrors() {
return null;
}
}, PostCvsActivity.DEAF, myProject);
try {
// should already be logged in
//operation.login(context);
operation.execute(cvsExecutionEnvironment, false);
} catch (VcsException | CommandAbortedException e) {
//
}
if (Boolean.TRUE.equals(logSuccess.get())) {
return extractRevision(operation, chooser);
}
return null;
}
Aggregations