Package net.rim.tumbler.exception

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


    }

    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, isPlayBook() ? "BBWP_PLAYBOOK_USAGE" : "BBWP_USAGE", WidgetPackager.getVersion());
            return false;
        }

        Logger.logMessage(LogType.INFO, "PROGRESS_CMDLINE_OPTIONS");
       
        // 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

TOP

Related Classes of net.rim.tumbler.exception.CommandLineException

Copyright © 2018 www.massapicom. 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.