private static boolean parseArguments(String args[],
                                        Configuration conf) {
    int argsLen = (args == null) ? 0 : args.length;
    StartupOption startOpt = StartupOption.REGULAR;
    for(int i=0; i < argsLen; i++) {
      String cmd = args[i];
      if ("-r".equalsIgnoreCase(cmd) || "--rack".equalsIgnoreCase(cmd)) {
        LOG.error("-r, --rack arguments are not supported anymore. RackID " +
            "resolution is handled by the NameNode.");
        System.exit(-1);
      } else if ("-rollback".equalsIgnoreCase(cmd)) {
        startOpt = StartupOption.ROLLBACK;
      } else if ("-regular".equalsIgnoreCase(cmd)) {
        startOpt = StartupOption.REGULAR;
      } else if ("-d".equalsIgnoreCase(cmd)) {
        ++i;
        if(i >= argsLen) {
          LOG.error("-D option requires following argument.");
          System.exit(-1);
        }
        String[] keyval = args[i].split("=", 2);
        if (keyval.length == 2) {
          conf.set(keyval[0], keyval[1]);
        } else {
          LOG.error("-D option invalid (expected =): " + args[i]);
          System.exit(-1);
        }
      } else
        return false;
    }
    setStartupOption(conf, startOpt);
    return true;
  }
private static boolean parseArguments ( String args [ ] , Configuration conf ) { int argsLen = ( args == null ) ? 0 : args . length ; StartupOption startOpt = StartupOption . REGULAR ; for ( int i = 0 ; i < argsLen ; i ++ ) { String cmd = args [ i ] ; if ( "-r" . equalsIgnoreCase ( cmd ) || "--rack" . equalsIgnoreCase ( cmd ) ) { LOG . error ( "-r, --rack arguments are not supported anymore. RackID " + "resolution is handled by the NameNode." ) ; System . exit ( - 1 ) ; } else if ( "-rollback" . equalsIgnoreCase ( cmd ) ) { startOpt = StartupOption . ROLLBACK ; } else if ( "-regular" . equalsIgnoreCase ( cmd ) ) { startOpt = StartupOption . REGULAR ; } else if ( "-d" . equalsIgnoreCase ( cmd ) ) { ++ i ; if ( i >= argsLen ) { LOG . error ( "-D option requires following argument." ) ; System . exit ( - 1 ) ; } String [ ] keyval = args [ i ] . split ( "=" , 2 ) ; if ( keyval . length == 2 ) { conf . set ( keyval [ 0 ] , keyval [ 1 ] ) ; } else { LOG . error ( "-D option invalid (expected =): " + args [ i ] ) ; System . exit ( - 1 ) ; } } else return false ; } setStartupOption ( conf , startOpt ) ; return true ; }
Parse and verify command line arguments and set configuration parameters.

@return false if passed argements are incorrect