Program: 92274
Project: 92274
Buggy source:
/** 
 * Creates a new command for the given arguments. The first value in the given array which is not an option is taken as the command name. All other values are options or filenames.
 * @param args The command-line arguments.
 * @throws InvalidCommandException If an invalid command has been given.
 * @throws InvalidOptionException If the given arguments contain an invalid option.
 */
protected Command(final String[] args) throws InvalidCommandException, InvalidOptionException {
  int commandIndex=-1;
  String commandName=null;
  for (int i=0; i < args.length; i++) {
    final String arg=args[i];
    if (arg.startsWith(Option.PREFIX)) {
      final String name=arg.substring(Option.PREFIX.length());
      final Option option;
      try {
        option=Option.valueOf(name.toUpperCase(Locale.US));
      }
 catch (      IllegalArgumentException e) {
        throw new InvalidOptionException(Errors.format(Errors.Keys.UnknownOption_1,name),e,name);
      }
      if (option.hasValue) {
        i++;
      }
    }
 else {
      commandName=arg;
      commandIndex=i;
      break;
    }
  }
  if (commandName == null) {
    command=new HelpSC(-1,args);
  }
 else {
    commandName=commandName.toLowerCase(Locale.US);
switch (commandName) {
case "String_Node_Str":
      command=new HelpSC(commandIndex,args);
    break;
case "String_Node_Str":
  command=new AboutSC(commandIndex,args);
break;
case "String_Node_Str":
command=new MimeTypeSC(commandIndex,args);
break;
case "String_Node_Str":
command=new MetadataSC(commandIndex,args);
break;
default :
throw new InvalidCommandException(Errors.format(Errors.Keys.UnknownCommand_1,commandName),commandName);
}
}
this.commandName=commandName;
}

Fixed version (ground truth):
/** 
 * Creates a new command for the given arguments. The first value in the given array which is not an option is taken as the command name. All other values are options or filenames.
 * @param args The command-line arguments.
 * @throws InvalidCommandException If an invalid command has been given.
 * @throws InvalidOptionException If the given arguments contain an invalid option.
 */
protected Command(final String[] args) throws InvalidCommandException, InvalidOptionException {
  int commandIndex=-1;
  String commandName=null;
  for (int i=0; i < args.length; i++) {
    final String arg=args[i];
    if (arg.startsWith(Option.PREFIX)) {
      final String name=arg.substring(Option.PREFIX.length());
      final Option option;
      try {
        option=Option.valueOf(name.toUpperCase(Locale.US));
      }
 catch (      IllegalArgumentException e) {
        throw new InvalidOptionException(Errors.format(Errors.Keys.UnknownOption_1,name),e,name);
      }
      if (option.hasValue) {
        i++;
      }
    }
 else {
      commandName=arg;
      commandIndex=i;
      break;
    }
  }
  if (commandName == null) {
    command=new HelpSC(-1,args);
  }
 else {
    commandName=commandName.toLowerCase(Locale.US);
switch (commandName) {
case "String_Node_Str":
      command=new HelpSC(commandIndex,args);
    break;
case "String_Node_Str":
  command=new AboutSC(commandIndex,args);
break;
case "String_Node_Str":
command=new MimeTypeSC(commandIndex,args);
break;
case "String_Node_Str":
command=new MetadataSC(false,commandIndex,args);
break;
case "String_Node_Str":
command=new MetadataSC(true,commandIndex,args);
break;
default :
throw new InvalidCommandException(Errors.format(Errors.Keys.UnknownCommand_1,commandName),commandName);
}
}
this.commandName=commandName;
}