Program: 89639
Project: 89639
Buggy source:
/** 
 * Create a new domain in the DB.
 * @see DomainDAO#create(Connection,Domain)
 */
@Override protected void create(Connection connection,Domain d){
  ArgumentNotValid.checkNotNull(d,"String_Node_Str");
  ArgumentNotValid.checkNotNullOrEmpty(d.getName(),"String_Node_Str");
  if (exists(connection,d.getName())) {
    String msg="String_Node_Str" + d;
    log.debug(msg);
    throw new PermissionDenied(msg);
  }
  PreparedStatement s=null;
  log.debug("String_Node_Str" + d.getName());
  try {
    connection.setAutoCommit(false);
    s=connection.prepareStatement("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str",Statement.RETURN_GENERATED_KEYS);
    DBUtils.setName(s,1,d,Constants.MAX_NAME_SIZE);
    DBUtils.setComments(s,2,d,Constants.MAX_COMMENT_SIZE);
    DBUtils.setStringMaxLength(s,3,StringUtils.conjoin("String_Node_Str",d.getCrawlerTraps()),Constants.MAX_CRAWLER_TRAP_SIZE,d,"String_Node_Str");
    long initialEdition=1;
    s.setLong(4,initialEdition);
    AliasInfo aliasInfo=d.getAliasInfo();
    DBUtils.setLongMaybeNull(s,5,aliasInfo == null ? null : DBUtils.selectLongValue(connection,"String_Node_Str",aliasInfo.getAliasOf()));
    DBUtils.setDateMaybeNull(s,6,aliasInfo == null ? null : aliasInfo.getLastChange());
    s.executeUpdate();
    d.setID(DBUtils.getGeneratedID(s));
    s.close();
    Iterator<Password> passwords=d.getAllPasswords();
    while (passwords.hasNext()) {
      Password p=passwords.next();
      insertPassword(connection,d,p);
    }
    Iterator<SeedList> seedlists=d.getAllSeedLists();
    if (!seedlists.hasNext()) {
      String msg="String_Node_Str" + d;
      log.debug(msg);
      throw new ArgumentNotValid(msg);
    }
    while (seedlists.hasNext()) {
      SeedList sl=seedlists.next();
      insertSeedlist(connection,d,sl);
    }
    Iterator<DomainConfiguration> dcs=d.getAllConfigurations();
    if (!dcs.hasNext()) {
      String msg="String_Node_Str" + d;
      log.debug(msg);
      throw new ArgumentNotValid(msg);
    }
    while (dcs.hasNext()) {
      DomainConfiguration dc=dcs.next();
      insertConfiguration(connection,d,dc);
      createConfigSeedlistsEntries(connection,d,dc);
      createConfigPasswordsEntries(connection,d,dc);
    }
    s=connection.prepareStatement("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    DBUtils.setName(s,1,d.getDefaultConfiguration(),Constants.MAX_NAME_SIZE);
    s.setLong(2,d.getID());
    s.setLong(3,d.getID());
    s.executeUpdate();
    s.close();
    for (Iterator<HarvestInfo> hi=d.getHistory().getHarvestInfo(); hi.hasNext(); ) {
      insertHarvestInfo(connection,d,hi.next());
    }
    for (    DomainOwnerInfo doi : d.getAllDomainOwnerInfo()) {
      insertOwnerInfo(connection,d,doi);
    }
    addExtendedFieldValues(d);
    saveExtendedFieldValues(connection,d);
    connection.commit();
    d.setEdition(initialEdition);
  }
 catch (  SQLException e) {
    String message="String_Node_Str" + d + "String_Node_Str"+ "String_Node_Str"+ ExceptionUtils.getSQLExceptionCause(e);
    log.warn(message,e);
    throw new IOFailure(message,e);
  }
 finally {
    DBUtils.rollbackIfNeeded(connection,"String_Node_Str",d);
  }
}

Fixed version (ground truth):
@Override protected void create(Connection connection,Domain d){
  ArgumentNotValid.checkNotNull(d,"String_Node_Str");
  ArgumentNotValid.checkNotNullOrEmpty(d.getName(),"String_Node_Str");
  if (exists(connection,d.getName())) {
    String msg="String_Node_Str" + d;
    log.debug(msg);
    throw new PermissionDenied(msg);
  }
  PreparedStatement s=null;
  log.debug("String_Node_Str" + d.getName());
  try {
    connection.setAutoCommit(false);
    s=connection.prepareStatement("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str",Statement.RETURN_GENERATED_KEYS);
    DBUtils.setName(s,1,d,Constants.MAX_NAME_SIZE);
    DBUtils.setComments(s,2,d,Constants.MAX_COMMENT_SIZE);
    DBUtils.setStringMaxLength(s,3,StringUtils.conjoin("String_Node_Str",d.getCrawlerTraps()),Constants.MAX_CRAWLER_TRAP_SIZE,d,"String_Node_Str");
    long initialEdition=1;
    s.setLong(4,initialEdition);
    AliasInfo aliasInfo=d.getAliasInfo();
    DBUtils.setLongMaybeNull(s,5,aliasInfo == null ? null : DBUtils.selectLongValue(connection,"String_Node_Str",aliasInfo.getAliasOf()));
    DBUtils.setDateMaybeNull(s,6,aliasInfo == null ? null : aliasInfo.getLastChange());
    s.executeUpdate();
    d.setID(DBUtils.getGeneratedID(s));
    s.close();
    Iterator<Password> passwords=d.getAllPasswords();
    while (passwords.hasNext()) {
      Password p=passwords.next();
      insertPassword(connection,d,p);
    }
    Iterator<SeedList> seedlists=d.getAllSeedLists();
    if (!seedlists.hasNext()) {
      String msg="String_Node_Str" + d;
      log.debug(msg);
      throw new ArgumentNotValid(msg);
    }
    while (seedlists.hasNext()) {
      SeedList sl=seedlists.next();
      insertSeedlist(connection,d,sl);
    }
    Iterator<DomainConfiguration> dcs=d.getAllConfigurations();
    if (!dcs.hasNext()) {
      String msg="String_Node_Str" + d;
      log.debug(msg);
      throw new ArgumentNotValid(msg);
    }
    while (dcs.hasNext()) {
      DomainConfiguration dc=dcs.next();
      insertConfiguration(connection,d,dc);
      createConfigSeedlistsEntries(connection,d,dc);
      createConfigPasswordsEntries(connection,d,dc);
    }
    s=connection.prepareStatement("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    DBUtils.setName(s,1,d.getDefaultConfiguration(),Constants.MAX_NAME_SIZE);
    s.setLong(2,d.getID());
    s.setLong(3,d.getID());
    s.executeUpdate();
    s.close();
    for (Iterator<HarvestInfo> hi=d.getHistory().getHarvestInfo(); hi.hasNext(); ) {
      insertHarvestInfo(connection,d,hi.next());
    }
    for (    DomainOwnerInfo doi : d.getAllDomainOwnerInfo()) {
      insertOwnerInfo(connection,d,doi);
    }
    addExtendedFieldValues(d);
    saveExtendedFieldValues(connection,d);
    connection.commit();
    d.setEdition(initialEdition);
  }
 catch (  SQLException e) {
    String message="String_Node_Str" + d + "String_Node_Str"+ "String_Node_Str"+ ExceptionUtils.getSQLExceptionCause(e);
    log.warn(message,e);
    throw new IOFailure(message,e);
  }
 finally {
    DBUtils.rollbackIfNeeded(connection,"String_Node_Str",d);
  }
}