public CommandLine parse(String[] args) throws ParseException {
        // create the command line parser
        GnuParser parser = new GnuParser();
        Options buildCommandLineOptions = buildCommandLineOptions();
        CommandLine cmd = null;
        try {
            cmd = parser.parse(buildCommandLineOptions, args);
            if (cmd.getOptions().length == 0 || cmd.hasOption("h")) {
                printHelp(buildCommandLineOptions);
                return null;
            }
            if (cmd.getArgList().isEmpty()) {
                throw new MissingOptionException("The 'inputPage' is mandatory! No page to run given");
            }
            return cmd;
        } catch (MissingOptionException e) {
            if (args == null || args.length == 0) {
                logger.debug("option --help has been set. Ignoring Missing Option exception");
                printHelp(buildCommandLineOptions);
                return cmd;
            }
            for (String arg : args) {
                if (StringUtils.equals("-h", arg) || StringUtils.equals("--help", arg)) {
                    logger.debug("option --help has been set. Ignoring Missing Option exception");
                    printHelp(buildCommandLineOptions);
                    return null;
                }
            }
            handleParseException(buildCommandLineOptions, e);
            throw e;
        } catch (ParseException e) {
            handleParseException(buildCommandLineOptions, e);
            throw e;
        }
    }
public CommandLine parse ( String [ ] args ) throws ParseException { GnuParser parser = new GnuParser ( ) ; Options buildCommandLineOptions = buildCommandLineOptions ( ) ; CommandLine cmd = null ; try { cmd = parser . parse ( buildCommandLineOptions , args ) ; if ( cmd . getOptions ( ) . length == 0 || cmd . hasOption ( "h" ) ) { printHelp ( buildCommandLineOptions ) ; return null ; } if ( cmd . getArgList ( ) . isEmpty ( ) ) { throw new MissingOptionException ( "The 'inputPage' is mandatory! No page to run given" ) ; } return cmd ; } catch ( MissingOptionException e ) { if ( args == null || args . length == 0 ) { logger . debug ( "option --help has been set. Ignoring Missing Option exception" ) ; printHelp ( buildCommandLineOptions ) ; return cmd ; } for ( String arg : args ) { if ( StringUtils . equals ( "-h" , arg ) || StringUtils . equals ( "--help" , arg ) ) { logger . debug ( "option --help has been set. Ignoring Missing Option exception" ) ; printHelp ( buildCommandLineOptions ) ; return null ; } } handleParseException ( buildCommandLineOptions , e ) ; throw e ; } catch ( ParseException e ) { handleParseException ( buildCommandLineOptions , e ) ; throw e ; } }
<p>parse.</p>

@param args an array of {@link java.lang.String} objects.
@return null if the help is asked.
@throws org.apache.commons.cli.ParseException if any.