Program: 51956
Project: 51956
Buggy source:
/** 
 * Command to modify an EPerson. 
 */
private static int cmdModify(Context context,String[] argv) throws AuthorizeException, SQLException {
  Options options=new Options();
  options.addOption(VERB_MODIFY);
  final OptionGroup identityOptions=new OptionGroup();
  identityOptions.addOption(OPT_EMAIL);
  identityOptions.addOption(OPT_NETID);
  options.addOptionGroup(identityOptions);
  options.addOption(OPT_GIVENNAME);
  options.addOption(OPT_SURNAME);
  options.addOption(OPT_PHONE);
  options.addOption(OPT_LANGUAGE);
  options.addOption(OPT_REQUIRE_CERTIFICATE);
  options.addOption(OPT_CAN_LOGIN);
  options.addOption(OPT_NEW_EMAIL);
  options.addOption(OPT_NEW_NETID);
  options.addOption("String_Node_Str","String_Node_Str",false,"String_Node_Str");
  GnuParser parser=new GnuParser();
  CommandLine command;
  try {
    command=parser.parse(options,argv);
  }
 catch (  ParseException e) {
    System.err.println(e.getMessage());
    return 1;
  }
  if (command.hasOption('h')) {
    new HelpFormatter().printHelp("String_Node_Str",options);
    return 0;
  }
  EPerson eperson=null;
  try {
    if (command.hasOption(OPT_NETID.getOpt())) {
      eperson=ePersonService.findByNetid(context,command.getOptionValue(OPT_NETID.getOpt()));
    }
 else     if (command.hasOption(OPT_EMAIL.getOpt())) {
      eperson=ePersonService.findByEmail(context,command.getOptionValue(OPT_EMAIL.getOpt()));
    }
 else {
      System.err.println("String_Node_Str");
      return 1;
    }
  }
 catch (  SQLException e) {
    System.err.append(e.getMessage());
    return 1;
  }
  boolean modified=false;
  if (null == eperson) {
    System.err.println("String_Node_Str");
    return 1;
  }
 else {
    if (command.hasOption(OPT_NEW_EMAIL.getOpt())) {
      eperson.setEmail(command.getOptionValue(OPT_NEW_EMAIL.getOpt()));
      modified=true;
    }
    if (command.hasOption(OPT_NEW_NETID.getOpt())) {
      eperson.setNetid(command.getOptionValue(OPT_NEW_NETID.getOpt()));
      modified=true;
    }
    if (command.hasOption(OPT_GIVENNAME.getOpt())) {
      eperson.setFirstName(context,command.getOptionValue(OPT_GIVENNAME.getOpt()));
      modified=true;
    }
    if (command.hasOption(OPT_SURNAME.getOpt())) {
      eperson.setLastName(context,command.getOptionValue(OPT_SURNAME.getOpt()));
      modified=true;
    }
    if (command.hasOption(OPT_PHONE.getOpt())) {
      ePersonService.setMetadata(context,eperson,"String_Node_Str",command.getOptionValue(OPT_PHONE.getOpt()));
      modified=true;
    }
    if (command.hasOption(OPT_LANGUAGE.getOpt())) {
      eperson.setLanguage(context,command.getOptionValue(OPT_LANGUAGE.getOpt()));
      modified=true;
    }
    if (command.hasOption(OPT_REQUIRE_CERTIFICATE.getOpt())) {
      eperson.setRequireCertificate(Boolean.valueOf(command.getOptionValue(OPT_REQUIRE_CERTIFICATE.getOpt())));
      modified=true;
    }
    if (command.hasOption(OPT_CAN_LOGIN.getOpt())) {
      eperson.setCanLogIn(Boolean.valueOf(command.getOptionValue(OPT_CAN_LOGIN.getOpt())));
      modified=true;
    }
    if (modified) {
      try {
        ePersonService.update(context,eperson);
        context.complete();
        System.out.printf("String_Node_Str",eperson.getID());
      }
 catch (      SQLException ex) {
        context.abort();
        System.err.println(ex.getMessage());
        return 1;
      }
catch (      AuthorizeException ex) {
      }
    }
 else {
      System.out.println("String_Node_Str");
    }
  }
  return 0;
}

Fixed version (ground truth):
/** 
 * Command to modify an EPerson. 
 */
private static int cmdModify(Context context,String[] argv) throws AuthorizeException, SQLException {
  Options options=new Options();
  options.addOption(VERB_MODIFY);
  final OptionGroup identityOptions=new OptionGroup();
  identityOptions.addOption(OPT_EMAIL);
  identityOptions.addOption(OPT_NETID);
  options.addOptionGroup(identityOptions);
  options.addOption(OPT_GIVENNAME);
  options.addOption(OPT_SURNAME);
  options.addOption(OPT_PHONE);
  options.addOption(OPT_LANGUAGE);
  options.addOption(OPT_REQUIRE_CERTIFICATE);
  options.addOption(OPT_CAN_LOGIN);
  options.addOption(OPT_NEW_EMAIL);
  options.addOption(OPT_NEW_NETID);
  options.addOption("String_Node_Str","String_Node_Str",false,"String_Node_Str");
  GnuParser parser=new GnuParser();
  CommandLine command;
  try {
    command=parser.parse(options,argv);
  }
 catch (  ParseException e) {
    System.err.println(e.getMessage());
    return 1;
  }
  if (command.hasOption('h')) {
    new HelpFormatter().printHelp("String_Node_Str",options);
    return 0;
  }
  EPerson eperson=null;
  try {
    if (command.hasOption(OPT_NETID.getOpt())) {
      eperson=ePersonService.findByNetid(context,command.getOptionValue(OPT_NETID.getOpt()));
    }
 else     if (command.hasOption(OPT_EMAIL.getOpt())) {
      eperson=ePersonService.findByEmail(context,command.getOptionValue(OPT_EMAIL.getOpt()));
    }
 else {
      System.err.println("String_Node_Str");
      return 1;
    }
  }
 catch (  SQLException e) {
    System.err.append(e.getMessage());
    return 1;
  }
  boolean modified=false;
  if (null == eperson) {
    System.err.println("String_Node_Str");
    return 1;
  }
 else {
    if (command.hasOption(OPT_NEW_EMAIL.getOpt())) {
      eperson.setEmail(command.getOptionValue(OPT_NEW_EMAIL.getOpt()));
      modified=true;
    }
    if (command.hasOption(OPT_NEW_NETID.getOpt())) {
      eperson.setNetid(command.getOptionValue(OPT_NEW_NETID.getOpt()));
      modified=true;
    }
    if (command.hasOption(OPT_GIVENNAME.getOpt())) {
      eperson.setFirstName(context,command.getOptionValue(OPT_GIVENNAME.getOpt()));
      modified=true;
    }
    if (command.hasOption(OPT_SURNAME.getOpt())) {
      eperson.setLastName(context,command.getOptionValue(OPT_SURNAME.getOpt()));
      modified=true;
    }
    if (command.hasOption(OPT_PHONE.getOpt())) {
      ePersonService.setMetadata(context,eperson,"String_Node_Str",command.getOptionValue(OPT_PHONE.getOpt()));
      modified=true;
    }
    if (command.hasOption(OPT_LANGUAGE.getOpt())) {
      eperson.setLanguage(context,command.getOptionValue(OPT_LANGUAGE.getOpt()));
      modified=true;
    }
    if (command.hasOption(OPT_REQUIRE_CERTIFICATE.getOpt())) {
      eperson.setRequireCertificate(Boolean.valueOf(command.getOptionValue(OPT_REQUIRE_CERTIFICATE.getOpt())));
      modified=true;
    }
    if (command.hasOption(OPT_CAN_LOGIN.getOpt())) {
      eperson.setCanLogIn(Boolean.valueOf(command.getOptionValue(OPT_CAN_LOGIN.getOpt())));
      modified=true;
    }
    if (modified) {
      try {
        ePersonService.update(context,eperson);
        context.complete();
        System.out.printf("String_Node_Str",eperson.getID().toString());
      }
 catch (      SQLException ex) {
        context.abort();
        System.err.println(ex.getMessage());
        return 1;
      }
catch (      AuthorizeException ex) {
      }
    }
 else {
      System.out.println("String_Node_Str");
    }
  }
  return 0;
}