Examples of CommandLineException


Examples of org.codehaus.plexus.util.cli.CommandLineException

                StringBuilder msg = new StringBuilder( "Exit code: " + exitCode + " - " + err.getOutput() );
                msg.append( '\n' );
                msg.append( "Command line was:" + cmdLine );

                throw new CommandLineException( msg.toString() );
            }
        }
        catch ( CommandLineException e )
        {
            if ( getLogger().isErrorEnabled() )
View Full Code Here

Examples of org.codehaus.plexus.util.cli.CommandLineException

                StringBuilder msg = new StringBuilder( "Exit code: " + exitCode + " - " + err.getOutput() );
                msg.append( '\n' );
                msg.append( "Command line was:" + cmdLine );

                throw new CommandLineException( msg.toString() );
            }
        }
        catch ( CommandLineException e )
        {
            if ( getLogger().isErrorEnabled() )
            {
                getLogger().error( "CommandLineException " + e.getMessage(), e );
            }
        }

        boolean clientspecExists = consumer.isSuccess();

        // Perform the actual checkout using that clientspec
        try
        {
            if ( clientspecExists )
            {
                try
                {
                    getLastChangelist( prepo, workingDirectory, specname );
                    cl = createCommandLine( prepo, workingDirectory, version, specname );
                    if ( getLogger().isDebugEnabled() )
                    {
                        getLogger().debug( "Executing: " + PerforceScmProvider.clean( cl.toString() ) );
                    }
                    Process proc = cl.execute();
                    BufferedReader br = new BufferedReader( new InputStreamReader( proc.getInputStream() ) );
                    String line;
                    while ( ( line = br.readLine() ) != null )
                    {
                        if ( getLogger().isDebugEnabled() )
                        {
                            getLogger().debug( "Consuming: " + line );
                        }
                        consumer.consumeLine( line );
                    }
                    CommandLineUtils.StringStreamConsumer err = new CommandLineUtils.StringStreamConsumer();
                    int exitCode = CommandLineUtils.executeCommandLine( cl, consumer, err );

                    if ( exitCode != 0 )
                    {
                        String cmdLine = CommandLineUtils.toString( cl.getCommandline() );

                        StringBuilder msg = new StringBuilder( "Exit code: " + exitCode + " - " + err.getOutput() );
                        msg.append( '\n' );
                        msg.append( "Command line was:" + cmdLine );

                        throw new CommandLineException( msg.toString() );
                    }
                    if ( getLogger().isDebugEnabled() )
                    {
                        getLogger().debug( "Perforce sync complete." );
                    }
View Full Code Here

Examples of org.codehaus.plexus.util.cli.CommandLineException

                cliOutput.add( line );
            }
        } );
        if ( result != 0 )
        {
            throw new CommandLineException( "cli to get JAVA_HOME informations return code " + result );
        }
        return cliOutput;
    }
View Full Code Here

Examples of org.jboss.as.cli.CommandLineException

            final String cmdName = parsedCmd.getOperationName();
            CommandHandler handler = cmdRegistry.getCommandHandler(cmdName.toLowerCase());
            if (handler != null) {
                if (isBatchMode() && handler.isBatchMode(this)) {
                    if (!(handler instanceof OperationCommand)) {
                        throw new CommandLineException("The command is not allowed in a batch.");
                    } else {
                        try {
                            ModelNode request = ((OperationCommand) handler).buildRequest(this);
                            BatchedCommand batchedCmd = new DefaultBatchedCommand(line, request);
                            Batch batch = getBatchManager().getActiveBatch();
                            batch.add(batchedCmd);
                            printLine("#" + batch.size() + " " + batchedCmd.getCommand());
                        } catch (CommandFormatException e) {
                            throw new CommandFormatException("Failed to add to batch '" + line + "'", e);
                        }
                    }
                } else {
                    handler.handle(this);
                }
            } else {
                throw new CommandLineException("Unexpected command '" + line + "'. Type 'help --commands' for the list of supported commands.");
            }
        }
    }
View Full Code Here

Examples of org.jboss.as.cli.CommandLineException

                switch (initialConnection(tempClient)) {
                    case SUCCESS:
                        newClient = tempClient;
                        break;
                    case CONNECTION_FAILURE:
                        throw new CommandLineException("The controller is not available at " + host + ":" + port);
                    case AUTHENTICATION_FAILURE:
                        throw new CommandLineException("Unable to authenticate against controller at " + host + ":" + port);
                    case SSL_FAILURE:
                        try {
                            retry = handleSSLFailure();
                        } catch (IOException ignored) {
                        }
                        if (retry == false) {
                            throw new CommandLineException("Unable to negotiate SSL connection with controller at " + host + ":" + port);
                        }
                        break;
                }

                if (newClient != null) {
                    if (this.client != null) {
                        disconnectController();
                    }

                    client = newClient;
                    this.controllerHost = host;
                    this.controllerPort = port;

                    List<String> nodeTypes = Util.getNodeTypes(newClient, new DefaultOperationRequestAddress());
                    domainMode = nodeTypes.contains(Util.SERVER_GROUP);
                }
            } catch (UnknownHostException e) {
                throw new CommandLineException("Failed to resolve host '" + host + "': " + e.getLocalizedMessage());
            }
        } while (retry);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.