Search in sources :

Example 11 with IOCommandException

use of org.netbeans.lib.cvsclient.command.IOCommandException in project intellij-community by JetBrains.

the class CreateModuleCommand method execute.

// Implemented ============================================================
public boolean execute(IRequestProcessor requestProcessor, IEventSender eventManager, ICvsListenerRegistry listenerRegistry, IClientEnvironment clientEnvironment, IProgressViewer progressViewer) throws CommandException, AuthenticationException {
    // check necessary fields
    BugLog.getInstance().assertNotNull(module);
    final String repositoryRoot = FileUtils.removeTrailingSlash(clientEnvironment.getCvsRoot().getRepositoryPath()) + '/' + module;
    final Requests requests = new Requests(CommandRequest.IMPORT, clientEnvironment);
    requests.addArgumentRequest("-b");
    requests.addArgumentRequest("1.1.1");
    requests.addMessageRequests("Create module");
    requests.addArgumentRequest(module);
    requests.addArgumentRequest("vendor-tag");
    requests.addArgumentRequest("release-tag");
    requests.addRequest(new DirectoryRequest(".", repositoryRoot));
    if (!requestProcessor.processRequests(requests, new DummyRequestsProgressHandler())) {
        return false;
    }
    try {
        createCvsDirectory(clientEnvironment, repositoryRoot);
    } catch (IOException ex) {
        throw new IOCommandException(ex);
    }
    return true;
}
Also used : DummyRequestsProgressHandler(org.netbeans.lib.cvsclient.progress.sending.DummyRequestsProgressHandler) IOException(java.io.IOException) DirectoryRequest(org.netbeans.lib.cvsclient.request.DirectoryRequest) Requests(org.netbeans.lib.cvsclient.request.Requests) IOCommandException(org.netbeans.lib.cvsclient.command.IOCommandException)

Example 12 with IOCommandException

use of org.netbeans.lib.cvsclient.command.IOCommandException in project intellij-community by JetBrains.

the class ExtConnectionCvsSettings method processException.

@Override
public CommandException processException(CommandException t) {
    Exception sourceException = t.getUnderlyingException();
    if (!(sourceException instanceof IOException))
        return t;
    String localizedMessage = t.getLocalizedMessage();
    if (localizedMessage == null || !localizedMessage.startsWith(UNHANDLED_RESPONSE_PREFIX))
        return t;
    String response = localizedMessage.substring(UNHANDLED_RESPONSE_PREFIX.length(), localizedMessage.length() - 1);
    if (StringUtil.startsWithConcatenation(response, USER, "@", HOST)) {
        return new IOCommandException(new IOException(CvsBundle.message("exception.text.ext.server.rejected.access")));
    } else {
        return new IOCommandException(new IOException(CvsBundle.message("exception.text.cannot.establish.external.connection", response)));
    }
}
Also used : IOException(java.io.IOException) CommandException(org.netbeans.lib.cvsclient.command.CommandException) IOException(java.io.IOException) AuthenticationException(org.netbeans.lib.cvsclient.connection.AuthenticationException) IOCommandException(org.netbeans.lib.cvsclient.command.IOCommandException) IOCommandException(org.netbeans.lib.cvsclient.command.IOCommandException)

Aggregations

IOException (java.io.IOException)12 IOCommandException (org.netbeans.lib.cvsclient.command.IOCommandException)12 Requests (org.netbeans.lib.cvsclient.request.Requests)10 ICvsFiles (org.netbeans.lib.cvsclient.command.ICvsFiles)8 ICvsListener (org.netbeans.lib.cvsclient.event.ICvsListener)7 IRequestsProgressHandler (org.netbeans.lib.cvsclient.progress.sending.IRequestsProgressHandler)4 DualListener (org.netbeans.lib.cvsclient.event.DualListener)3 RangeProgressViewer (org.netbeans.lib.cvsclient.progress.RangeProgressViewer)3 FileInfoAndMessageResponseProgressHandler (org.netbeans.lib.cvsclient.progress.receiving.FileInfoAndMessageResponseProgressHandler)3 FileStateRequestsProgressHandler (org.netbeans.lib.cvsclient.progress.sending.FileStateRequestsProgressHandler)3 DummyRequestsProgressHandler (org.netbeans.lib.cvsclient.progress.sending.DummyRequestsProgressHandler)2 CommandException (org.netbeans.lib.cvsclient.command.CommandException)1 AuthenticationException (org.netbeans.lib.cvsclient.connection.AuthenticationException)1 AbstractFileObject (org.netbeans.lib.cvsclient.file.AbstractFileObject)1 DirectoryRequest (org.netbeans.lib.cvsclient.request.DirectoryRequest)1