Examples of CommandLineException


Examples of flash.tools.debugger.CommandLineException

        e = new AlreadyActiveApplicationException(detailMessage, m_isDebugging);
      }
    }
    else
    {
      e = new CommandLineException(detailMessage, getLaunchCommand(), getProcessMessages(), exitValue);
    }

    return e;
  }
View Full Code Here

Examples of net.rim.tumbler.exception.CommandLineException

    }

    public boolean parse( String[] inputParams ) throws PackageException, CommandLineException {
        // Validate at least one parameter.
        if( inputParams.length < 1 ) {
            throw new CommandLineException( "EXCEPTION_INVALID_COMMAND_LINE" );
        }

        // Get first param - exception case: /h
        String input1 = inputParams[ 0 ].toLowerCase().trim();
        if( input1.equals( OPTION_HELP ) ) {
            Logger.logMessage( LogType.NONE, "BBWP_USAGE", WidgetPackager.getVersion() );
            return false;
        }

        // Check archive format
        if( !input1.endsWith( ".zip" ) ) {
            throw new CommandLineException( "EXCEPTION_INVALID_COMMAND_LINE" );
        }

        // Parse the command line
        _widgetArchive = getAbsolutePath( input1 );
        _archiveName = parseWidgetName( _widgetArchive );

        Pattern patternWidgetName = Pattern.compile( "[a-zA-Z][a-zA-Z0-9]*" );
        if( !patternWidgetName.matcher( _archiveName ).matches() ) {
            throw new PackageException( "EXCEPTION_INVALID_ARCHIVE_NAME" );
        }

        // Parse options
        try {
            parseOptionParameters( inputParams );
        } catch( Exception e ) {
            throw new CommandLineException( "EXCEPTION_INVALID_COMMAND_LINE" );
        }
        return true;
    }
View Full Code Here

Examples of org.apache.maven.it.util.cli.CommandLineException

            }
        }

        if ( classWorldFile == null )
        {
            throw new CommandLineException( "Cannot find plexus-classworlds in " + coreDir );
        }

        URLClassLoader cl;

        try
        {
            cl = new URLClassLoader( new URL[] { classWorldFile.toURI().toURL() }, null );
        }
        catch ( MalformedURLException e )
        {
            throw new CommandLineException( "Cannot conver to url: " + classWorldFile, e );
        }

        class ExitSecurityException
            extends SecurityException
        {

            private static final long serialVersionUID = 5650869246591762064L;

            private int status;

            public ExitSecurityException( int status )
            {
                this.status = status;
            }

            public int getStatus()
            {
                return status;
            }
        }

        try
        {
            Class<?> c = cl.loadClass( "org.codehaus.plexus.classworlds.launcher.Launcher" );

            Method m = c.getMethod( "mainWithExitCode", new Class[] { String[].class } );

            SecurityManager oldSm = System.getSecurityManager();

            try
            {
                System.setSecurityManager( new SecurityManager()
                {
                    public void checkPermission( Permission perm )
                    {
                        // ok
                    }

                    public void checkExit( int status )
                    {
                        throw new ExitSecurityException( status );
                    }
                } );
            }
            catch ( AccessControlException e )
            {
                throw new CommandLineException( "Error isntalling securitymanager", e );
            }

            cli.createArgument().setValue( "-f" );
            cli.createArgument().setValue( cli.getWorkingDirectory().getAbsolutePath() + "/pom.xml" );

            PrintStream oldOut = System.out;
            PrintStream oldErr = System.err;

            String oldCwConf = System.getProperty( "classworlds.conf" );
            String oldMavenHome = System.getProperty( "maven.home" );

            ClassLoader oldCl = Thread.currentThread().getContextClassLoader();

            try
            {
                Thread.currentThread().setContextClassLoader( cl );// ClassLoader.getSystemClassLoader() );
                FileOutputStream logWriter = new FileOutputStream( logFile );
                System.setOut( new PrintStream( logWriter ) );
                System.setErr( new PrintStream( logWriter ) );

                System.setProperty( "classworlds.conf", new File( mavenHome, "bin/m2.conf" ).getAbsolutePath() );
                System.setProperty( "maven.home", mavenHome );

                return ( (Integer) m.invoke( null, new Object[] { cli.getArguments() } ) ).intValue();
            }
            catch ( ExitSecurityException e )
            {
                oldOut.println( "exit security exception caught: status=" + e.getStatus() );
                return e.getStatus();
            }
            finally
            {
                System.setOut( oldOut );
                System.setErr( oldErr );
                if ( oldCwConf == null )
                {
                    System.getProperties().remove( "classworlds.conf" );
                }
                else
                {
                    System.setProperty( "classworlds.conf", oldCwConf );
                }
                if ( oldMavenHome == null )
                {
                    System.getProperties().remove( "maven.home" );
                }
                else
                {
                    System.setProperty( "maven.home", oldMavenHome );
                }
                Thread.currentThread().setContextClassLoader( oldCl );
                System.setSecurityManager( oldSm );
            }
        }
        catch ( ClassNotFoundException e )
        {
            throw new CommandLineException( "Cannot load classworlds launcher", e );
        }
        catch ( NoSuchMethodException e )
        {
            throw new CommandLineException( "Cannot find classworlds launcher's main method", e );
        }
        catch ( IllegalArgumentException e )
        {
            throw new CommandLineException( "Error executing classworlds launcher's main method", e );
        }
        catch ( InvocationTargetException e )
        {
            if ( e.getCause() instanceof ExitSecurityException )
            {
                return ( (ExitSecurityException) e.getCause() ).getStatus();
            }
            throw new CommandLineException( "Error executing classworlds launcher's main method", e );
        }
        catch ( IllegalAccessException e )
        {
            throw new CommandLineException( "Error executing classworlds launcher's main method", e );
        }
    }
View Full Code Here

Examples of org.apache.maven.shared.utils.cli.CommandLineException

      for (final File a : artifacts) {
        final JarSignerRequest request = this.signing.signRequest(this.outputDirectory, a);

        try {
          final JavaToolResult result = this.jarSigner.execute(request);
          final CommandLineException signException = result.getExecutionException();
          final int signExitCode = result.getExitCode();
          if (signException != null) {
            failSignature(signException);
          }
          if (signExitCode > 0) {
View Full Code Here

Examples of org.clapper.util.cmdline.CommandLineException

            }
        }

        catch (IOException ex)
        {
            throw new CommandLineException (ex);
        }

        catch (RegexException ex)
        {
            throw new CommandLineException (ex);
        }
    }
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() )
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() )
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.codehaus.plexus.util.cli.CommandLineException

        if ( exitCode != 0 )
        {
            StringBuilder msg = new StringBuilder( "Exit code: " + exitCode + " - " + err.getOutput() );
            msg.append( '\n' );
            msg.append( "Command line was:" + CommandLineUtils.toString( cmd.getCommandline() ) );
            throw new CommandLineException( msg.toString() );
        }

        if ( StringUtils.isNotEmpty( err.getOutput() ) )
        {
            return parseJavadocVersion( err.getOutput() );
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() )
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.