Program: 186936
Project: 186936
Buggy source:
/** 
 * Consume all command line options and turn them into properties.<br/> <p>The arguments are processed as follows: If an argument is of the form "-option" or "--option", it is considered to be an option. If an argument is an option, the next argument is considered to be the parameter, unless the option is boolean and the next argument is missing or an option as well. We add the pair to our properties, consuming both arguments. </p><p> If an argument starts with @, the rest of it is considered as a property file name, which is then loaded and added to the configuration.  The first non-option or the argument string   {@code --} terminates the option list.</p>
 * @param args The argument list
 * @return An array of unconsumed arguments
 * @throws Config.BadConfigurationException if an argument is malformed.
 */
public String[] consumeOptions(String[] args) throws Config.BadConfigurationException {
  int i=0;
  while (i < args.length) {
    if (cmds.containsKey(args[i])) {
      config.setProperty(getConfigKey(CMD_KEY),args[i]);
      OptionGroup cmdGroup=cmds.get(args[i]);
      return cmdGroup.consumeOptions(Arrays.copyOfRange(args,i + 1,args.length));
    }
    if (args[i].startsWith("String_Node_Str")) {
      String filename=args[i].substring(1);
      try {
        InputStream is=new BufferedInputStream(new FileInputStream(filename));
        config.addProperties(is,prefix);
      }
 catch (      FileNotFoundException e) {
        throw new Config.BadConfigurationException("String_Node_Str" + filename + "String_Node_Str",e);
      }
catch (      IOException e) {
        throw new Config.BadConfigurationException("String_Node_Str" + filename + "String_Node_Str"+ e.getMessage(),e);
      }
      i++;
      continue;
    }
    if (!args[i].startsWith("String_Node_Str"))     break;
    if ("String_Node_Str".equals(args[i]) || "String_Node_Str".equals(args[i])) {
      i++;
      break;
    }
    String key;
    if (args[i].charAt(1) == '-')     key=args[i].substring(2);
 else     key=args[i].substring(1);
    Option<?> spec=getOptionSpec(key);
    if (spec != null) {
      String val=null;
      if (i + 1 < args.length) {
        try {
          spec.parse(args[i + 1]);
          val=args[i + 1];
        }
 catch (        IllegalArgumentException ignored) {
        }
      }
      if (spec instanceof BoolOption && val == null) {
        val="String_Node_Str";
      }
 else       if (val == null) {
        throw new Config.BadConfigurationException("String_Node_Str" + spec);
      }
 else {
        i++;
      }
      config.setProperty(getConfigKey(spec),val);
    }
 else     if (spec == null) {
      if (key.startsWith("String_Node_Str")) {
        spec=getOptionSpec(key.substring(3));
        if (spec != null && spec instanceof BoolOption) {
          config.setProperty(getConfigKey(spec),"String_Node_Str");
        }
      }
    }
    if (spec == null) {
      throw new Config.BadConfigurationException("String_Node_Str" + key + "String_Node_Str"+ optionSet.keySet().toString()+ "String_Node_Str");
    }
    i++;
  }
  return Arrays.copyOfRange(args,i,args.length);
}

Fixed version (ground truth):
/** 
 * Consume all command line options and turn them into properties.<br/> <p>The arguments are processed as follows: If an argument is of the form "-option" or "--option", it is considered to be an option. If an argument is an option, the next argument is considered to be the parameter, unless the option is boolean and the next argument is missing or an option as well. We add the pair to our properties, consuming both arguments. </p><p> If an argument starts with @, the rest of it is considered as a property file name, which is then loaded and added to the configuration.  The first non-option or the argument string   {@code --} terminates the option list.</p>
 * @param args The argument list
 * @return An array of unconsumed arguments
 * @throws Config.BadConfigurationException if an argument is malformed.
 */
public String[] consumeOptions(String[] args) throws Config.BadConfigurationException {
  int i=0;
  while (i < args.length) {
    if (cmds.containsKey(args[i])) {
      config.setProperty(getConfigKey(CMD_KEY),args[i]);
      OptionGroup cmdGroup=cmds.get(args[i]);
      return cmdGroup.consumeOptions(Arrays.copyOfRange(args,i + 1,args.length));
    }
    if (args[i].startsWith("String_Node_Str")) {
      String filename=args[i].substring(1);
      try {
        InputStream is=new BufferedInputStream(new FileInputStream(filename));
        config.addProperties(is,prefix);
      }
 catch (      FileNotFoundException e) {
        throw new Config.BadConfigurationException("String_Node_Str" + filename + "String_Node_Str",e);
      }
catch (      IOException e) {
        throw new Config.BadConfigurationException("String_Node_Str" + filename + "String_Node_Str"+ e.getMessage(),e);
      }
      i++;
      continue;
    }
    if (!args[i].startsWith("String_Node_Str"))     break;
    if ("String_Node_Str".equals(args[i]) || "String_Node_Str".equals(args[i])) {
      i++;
      break;
    }
    String key;
    if (args[i].charAt(1) == '-')     key=args[i].substring(2);
 else     key=args[i].substring(1);
    Option<?> spec=getOptionSpec(key);
    if (spec != null) {
      String val=null;
      if (i + 1 < args.length) {
        try {
          spec.parse(args[i + 1]);
          val=args[i + 1];
        }
 catch (        IllegalArgumentException ignored) {
        }
      }
      if (spec instanceof BoolOption && val == null) {
        val="String_Node_Str";
      }
 else       if (val == null) {
        throw new Config.BadConfigurationException("String_Node_Str" + spec);
      }
 else {
        i++;
      }
      config.setProperty(getConfigKey(spec),val);
    }
 else     if (spec == null) {
      if (key.startsWith("String_Node_Str")) {
        spec=getOptionSpec(key.substring(3));
        if (spec != null && spec instanceof BoolOption) {
          config.setProperty(getConfigKey(spec),"String_Node_Str");
        }
      }
    }
    if (spec == null) {
      throw new Config.BadConfigurationException("String_Node_Str" + key);
    }
    i++;
  }
  return Arrays.copyOfRange(args,i,args.length);
}