use of com.intellij.cvsSupport2.errorHandling.CvsException 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.errorHandling.CvsException in project intellij-community by JetBrains.
the class StoringLineSeparatorsLocalFileWriter method processException.
private void processException(IOException ex, InputStream inputStream, int length, IFileSystem fileSystem, FileObject fileObject, String cvsRoot) throws IOException {
File file = fileSystem.getFile(fileObject);
VcsException vcsEx = new CvsException(ex.getLocalizedMessage() + ": " + file.getAbsolutePath(), cvsRoot);
try {
if (ex.getLocalizedMessage().startsWith(COULD_NOT_DELETE_FILE_PREFIX)) {
myUpdatedFilesManager.couldNotUpdateFile(file);
vcsEx.setVirtualFile(CvsVfsUtil.findFileByIoFile(file));
}
} finally {
CvsUtil.skip(inputStream, length);
vcsEx.setIsWarning(true);
myErrorProcessor.addError(vcsEx);
}
}
use of com.intellij.cvsSupport2.errorHandling.CvsException in project intellij-community by JetBrains.
the class EditOperation method execute.
@Override
protected void execute(CvsRootProvider root, CvsExecutionEnvironment executionEnvironment, ReadWriteStatistics statistics, IProgressViewer progressViewer) throws CommandException, CommandAbortedException, VcsException {
super.execute(root, executionEnvironment, statistics, progressViewer);
final VcsException vcsException = new CvsException(FILES_BEING_EDITED_EXCEPTION, root.getCvsRootAsString());
for (EditedFileInfo info : myEditFileInfos) {
if (info.isSuitableFor(root))
return;
final File file = info.getFile(root);
final VirtualFile virtualFile = CvsVfsUtil.findFileByIoFile(file);
if (virtualFile != null)
vcsException.setVirtualFile(virtualFile);
}
if (!myEditFileInfos.isEmpty())
throw vcsException;
}
use of com.intellij.cvsSupport2.errorHandling.CvsException in project intellij-community by JetBrains.
the class ErrorMessagesProcessor method addError.
public void addError(String message, String relativeFilePath, ICvsFileSystem cvsFileSystem, String cvsRoot, boolean warning) {
VirtualFile vFile = getVirtualFile(cvsFileSystem, relativeFilePath);
VcsException vcsException = new CvsException(message, cvsRoot);
if (vFile != null)
vcsException.setVirtualFile(vFile);
vcsException.setIsWarning(warning);
myErrors.add(vcsException);
}
Aggregations