protected void parseOptions ( String [ ] paramArgs ) throws CommandLineParsingException { String [ ] args = fixupArgs ( paramArgs ) ; boolean seenCommand = false ; for ( String arg : args ) { if ( isCommand ( arg ) ) { this . command = arg ; if ( this . command . equalsIgnoreCase ( COMMANDS . MIGRATE ) ) { this . command = COMMANDS . UPDATE ; } else if ( this . command . equalsIgnoreCase ( COMMANDS . MIGRATE_SQL ) ) { this . command = COMMANDS . UPDATE_SQL ; } seenCommand = true ; } else if ( seenCommand ) { // ChangeLog parameter: if ( arg . startsWith ( "-D" ) ) { String [ ] splitArg = splitArg ( arg ) ; String attributeName = splitArg [ 0 ] . replaceFirst ( "^-D" , "" ) ; String value = splitArg [ 1 ] ; changeLogParameters . put ( attributeName , value ) ; } else { commandParams . add ( arg ) ; if ( arg . startsWith ( "--" ) ) { parseOptionArgument ( arg ) ; } } } else if ( arg . startsWith ( "--" ) ) { parseOptionArgument ( arg ) ; } else { throw new CommandLineParsingException ( String . format ( coreBundle . getString ( "unexpected.value" ) , arg ) ) ; } } // Now apply default values from the default property files. We waited with this until this point // since command line parameters might have changed the location where we will look for them. parseDefaultPropertyFiles ( ) ; }
Parses the command line options . If an invalid argument is given a CommandLineParsingException is thrown .