Program: 167811
Project: 167811
Buggy source:
public static ServerEnvironment determineEnvironment(String[] args,Properties systemProperties,Map<String,String> systemEnvironment,ServerEnvironment.LaunchType launchType){
  final int argsLength=args.length;
  String serverConfig=null;
  String initialServerConfig=null;
  RunningMode runningMode=RunningMode.NORMAL;
  ProductConfig productConfig;
  for (int i=0; i < argsLength; i++) {
    final String arg=args[i];
    try {
      if (CommandLineConstants.VERSION.equals(arg) || CommandLineConstants.SHORT_VERSION.equals(arg) || CommandLineConstants.OLD_VERSION.equals(arg)|| CommandLineConstants.OLD_SHORT_VERSION.equals(arg)) {
        productConfig=new ProductConfig(Module.getBootModuleLoader(),SecurityActions.getSystemProperty(ServerEnvironment.HOME_DIR));
        System.out.println(productConfig.getPrettyVersionString());
        return null;
      }
 else       if (CommandLineConstants.HELP.equals(arg) || CommandLineConstants.SHORT_HELP.equals(arg) || CommandLineConstants.OLD_HELP.equals(arg)) {
        usage();
        return null;
      }
 else       if (CommandLineConstants.SERVER_CONFIG.equals(arg) || CommandLineConstants.SHORT_SERVER_CONFIG.equals(arg) || CommandLineConstants.OLD_SERVER_CONFIG.equals(arg)) {
        serverConfig=args[++i];
      }
 else       if (arg.startsWith(CommandLineConstants.SERVER_CONFIG)) {
        serverConfig=parseValue(arg,CommandLineConstants.SERVER_CONFIG);
        if (serverConfig == null) {
          return null;
        }
      }
 else       if (arg.startsWith(CommandLineConstants.SHORT_SERVER_CONFIG)) {
        serverConfig=parseValue(arg,CommandLineConstants.SHORT_SERVER_CONFIG);
        if (serverConfig == null) {
          return null;
        }
      }
 else       if (arg.startsWith(CommandLineConstants.READ_ONLY_SERVER_CONFIG)) {
        initialServerConfig=parseValue(arg,CommandLineConstants.READ_ONLY_SERVER_CONFIG);
        if (initialServerConfig == null) {
          return null;
        }
      }
 else       if (arg.startsWith(CommandLineConstants.OLD_SERVER_CONFIG)) {
        serverConfig=parseValue(arg,CommandLineConstants.OLD_SERVER_CONFIG);
        if (serverConfig == null) {
          return null;
        }
      }
 else       if (CommandLineConstants.PROPERTIES.equals(arg) || CommandLineConstants.OLD_PROPERTIES.equals(arg) || CommandLineConstants.SHORT_PROPERTIES.equals(arg)) {
        if (!processProperties(arg,args[++i],systemProperties)) {
          return null;
        }
      }
 else       if (arg.startsWith(CommandLineConstants.PROPERTIES)) {
        String urlSpec=parseValue(arg,CommandLineConstants.PROPERTIES);
        if (urlSpec == null || !processProperties(arg,urlSpec,systemProperties)) {
          return null;
        }
      }
 else       if (arg.startsWith(CommandLineConstants.SHORT_PROPERTIES)) {
        String urlSpec=parseValue(arg,CommandLineConstants.SHORT_PROPERTIES);
        if (urlSpec == null || !processProperties(arg,urlSpec,systemProperties)) {
          return null;
        }
      }
 else       if (arg.startsWith(CommandLineConstants.OLD_PROPERTIES)) {
        String urlSpec=parseValue(arg,CommandLineConstants.OLD_PROPERTIES);
        if (urlSpec == null || !processProperties(arg,urlSpec,systemProperties)) {
          return null;
        }
      }
 else       if (arg.startsWith(CommandLineConstants.SYS_PROP)) {
        String name, value;
        int idx=arg.indexOf("String_Node_Str");
        if (idx == -1) {
          name=arg.substring(2);
          value="String_Node_Str";
        }
 else {
          name=arg.substring(2,idx);
          value=arg.substring(idx + 1,arg.length());
        }
        systemProperties.setProperty(name,value);
      }
 else       if (arg.startsWith(CommandLineConstants.PUBLIC_BIND_ADDRESS)) {
        int idx=arg.indexOf('=');
        if (idx == arg.length() - 1) {
          System.err.printf(ServerMessages.MESSAGES.noArgValue(arg));
          usage();
          return null;
        }
        String value=idx > -1 ? arg.substring(idx + 1) : args[++i];
        String propertyName=null;
        if (idx < 0) {
          propertyName=arg.length() == 2 ? ServerEnvironment.JBOSS_BIND_ADDRESS : ServerEnvironment.JBOSS_BIND_ADDRESS_PREFIX + arg.substring(2);
        }
 else         if (idx == 2) {
          propertyName=ServerEnvironment.JBOSS_BIND_ADDRESS;
        }
 else {
          propertyName=ServerEnvironment.JBOSS_BIND_ADDRESS_PREFIX + arg.substring(2,idx);
        }
        systemProperties.setProperty(propertyName,value);
      }
 else       if (arg.startsWith(CommandLineConstants.DEFAULT_MULTICAST_ADDRESS)) {
        int idx=arg.indexOf('=');
        if (idx == arg.length() - 1) {
          System.err.printf(ServerMessages.MESSAGES.valueExpectedForCommandLineOption(arg));
          System.err.println();
          usage();
          return null;
        }
        String value=idx > -1 ? arg.substring(idx + 1) : args[++i];
        systemProperties.setProperty(ServerEnvironment.JBOSS_DEFAULT_MULTICAST_ADDRESS,value);
      }
 else       if (CommandLineConstants.ADMIN_ONLY.equals(arg)) {
        runningMode=RunningMode.ADMIN_ONLY;
      }
 else       if (arg.startsWith(CommandLineConstants.SECURITY_PROP)) {
        String token=arg.substring(2);
        processSecurityProperties(token,systemProperties);
      }
 else {
        System.err.printf(ServerMessages.MESSAGES.invalidCommandLineOption(arg));
        usage();
        return null;
      }
    }
 catch (    IndexOutOfBoundsException e) {
      System.err.printf(ServerMessages.MESSAGES.valueExpectedForCommandLineOption(arg));
      usage();
      return null;
    }
  }
  if (serverConfig != null && initialServerConfig != null) {
    throw ServerMessages.MESSAGES.cannotHaveBothInitialServerConfigAndServerConfig();
  }
  String hostControllerName=null;
  productConfig=new ProductConfig(Module.getBootModuleLoader(),SecurityActions.getSystemProperty(ServerEnvironment.HOME_DIR));
  return new ServerEnvironment(hostControllerName,systemProperties,systemEnvironment,serverConfig,initialServerConfig,launchType,runningMode,productConfig);
}

Fixed version (ground truth):
public static ServerEnvironment determineEnvironment(String[] args,Properties systemProperties,Map<String,String> systemEnvironment,ServerEnvironment.LaunchType launchType){
  final int argsLength=args.length;
  String serverConfig=null;
  String initialServerConfig=null;
  RunningMode runningMode=RunningMode.NORMAL;
  ProductConfig productConfig;
  for (int i=0; i < argsLength; i++) {
    final String arg=args[i];
    try {
      if (CommandLineConstants.VERSION.equals(arg) || CommandLineConstants.SHORT_VERSION.equals(arg) || CommandLineConstants.OLD_VERSION.equals(arg)|| CommandLineConstants.OLD_SHORT_VERSION.equals(arg)) {
        productConfig=new ProductConfig(Module.getBootModuleLoader(),SecurityActions.getSystemProperty(ServerEnvironment.HOME_DIR));
        System.out.println(productConfig.getPrettyVersionString());
        return null;
      }
 else       if (CommandLineConstants.HELP.equals(arg) || CommandLineConstants.SHORT_HELP.equals(arg) || CommandLineConstants.OLD_HELP.equals(arg)) {
        usage();
        return null;
      }
 else       if (CommandLineConstants.SERVER_CONFIG.equals(arg) || CommandLineConstants.SHORT_SERVER_CONFIG.equals(arg) || CommandLineConstants.OLD_SERVER_CONFIG.equals(arg)) {
        serverConfig=args[++i];
      }
 else       if (arg.startsWith(CommandLineConstants.SERVER_CONFIG)) {
        serverConfig=parseValue(arg,CommandLineConstants.SERVER_CONFIG);
        if (serverConfig == null) {
          return null;
        }
      }
 else       if (arg.startsWith(CommandLineConstants.SHORT_SERVER_CONFIG)) {
        serverConfig=parseValue(arg,CommandLineConstants.SHORT_SERVER_CONFIG);
        if (serverConfig == null) {
          return null;
        }
      }
 else       if (arg.startsWith(CommandLineConstants.READ_ONLY_SERVER_CONFIG)) {
        initialServerConfig=parseValue(arg,CommandLineConstants.READ_ONLY_SERVER_CONFIG);
        if (initialServerConfig == null) {
          return null;
        }
      }
 else       if (arg.startsWith(CommandLineConstants.OLD_SERVER_CONFIG)) {
        serverConfig=parseValue(arg,CommandLineConstants.OLD_SERVER_CONFIG);
        if (serverConfig == null) {
          return null;
        }
      }
 else       if (CommandLineConstants.PROPERTIES.equals(arg) || CommandLineConstants.OLD_PROPERTIES.equals(arg) || CommandLineConstants.SHORT_PROPERTIES.equals(arg)) {
        if (!processProperties(arg,args[++i],systemProperties)) {
          return null;
        }
      }
 else       if (arg.startsWith(CommandLineConstants.PROPERTIES)) {
        String urlSpec=parseValue(arg,CommandLineConstants.PROPERTIES);
        if (urlSpec == null || !processProperties(arg,urlSpec,systemProperties)) {
          return null;
        }
      }
 else       if (arg.startsWith(CommandLineConstants.SHORT_PROPERTIES)) {
        String urlSpec=parseValue(arg,CommandLineConstants.SHORT_PROPERTIES);
        if (urlSpec == null || !processProperties(arg,urlSpec,systemProperties)) {
          return null;
        }
      }
 else       if (arg.startsWith(CommandLineConstants.OLD_PROPERTIES)) {
        String urlSpec=parseValue(arg,CommandLineConstants.OLD_PROPERTIES);
        if (urlSpec == null || !processProperties(arg,urlSpec,systemProperties)) {
          return null;
        }
      }
 else       if (arg.startsWith(CommandLineConstants.SYS_PROP)) {
        String name, value;
        int idx=arg.indexOf("String_Node_Str");
        if (idx == -1) {
          name=arg.substring(2);
          value="String_Node_Str";
        }
 else {
          name=arg.substring(2,idx);
          value=arg.substring(idx + 1,arg.length());
        }
        systemProperties.setProperty(name,value);
      }
 else       if (arg.startsWith(CommandLineConstants.PUBLIC_BIND_ADDRESS)) {
        int idx=arg.indexOf('=');
        if (idx == arg.length() - 1) {
          System.err.printf(ServerMessages.MESSAGES.noArgValue(arg));
          usage();
          return null;
        }
        String value=idx > -1 ? arg.substring(idx + 1) : args[++i];
        String propertyName=null;
        if (idx < 0) {
          propertyName=arg.length() == 2 ? ServerEnvironment.JBOSS_BIND_ADDRESS : ServerEnvironment.JBOSS_BIND_ADDRESS_PREFIX + arg.substring(2);
        }
 else         if (idx == 2) {
          propertyName=ServerEnvironment.JBOSS_BIND_ADDRESS;
        }
 else {
          propertyName=ServerEnvironment.JBOSS_BIND_ADDRESS_PREFIX + arg.substring(2,idx);
        }
        systemProperties.setProperty(propertyName,value);
      }
 else       if (arg.startsWith(CommandLineConstants.DEFAULT_MULTICAST_ADDRESS)) {
        int idx=arg.indexOf('=');
        if (idx == arg.length() - 1) {
          System.err.printf(ServerMessages.MESSAGES.valueExpectedForCommandLineOption(arg));
          System.err.println();
          usage();
          return null;
        }
        String value=idx > -1 ? arg.substring(idx + 1) : args[++i];
        systemProperties.setProperty(ServerEnvironment.JBOSS_DEFAULT_MULTICAST_ADDRESS,value);
      }
 else       if (CommandLineConstants.ADMIN_ONLY.equals(arg)) {
        runningMode=RunningMode.ADMIN_ONLY;
      }
 else       if (arg.startsWith(CommandLineConstants.SECURITY_PROP)) {
        String token=arg.substring(2);
        processSecurityProperties(token,systemProperties);
      }
 else       if (arg.equals(CommandLineConstants.DEBUG)) {
        final int next=i + 1;
        if (next < argsLength) {
          final String nextArg=args[next];
          if (!nextArg.startsWith("String_Node_Str")) {
            try {
              Integer.parseInt(nextArg);
              i++;
            }
 catch (            NumberFormatException ignore) {
            }
          }
        }
      }
 else {
        System.err.printf(ServerMessages.MESSAGES.invalidCommandLineOption(arg));
        usage();
        return null;
      }
    }
 catch (    IndexOutOfBoundsException e) {
      System.err.printf(ServerMessages.MESSAGES.valueExpectedForCommandLineOption(arg));
      usage();
      return null;
    }
  }
  if (serverConfig != null && initialServerConfig != null) {
    throw ServerMessages.MESSAGES.cannotHaveBothInitialServerConfigAndServerConfig();
  }
  String hostControllerName=null;
  productConfig=new ProductConfig(Module.getBootModuleLoader(),SecurityActions.getSystemProperty(ServerEnvironment.HOME_DIR));
  return new ServerEnvironment(hostControllerName,systemProperties,systemEnvironment,serverConfig,initialServerConfig,launchType,runningMode,productConfig);
}