Program: 89638
Project: 89638
Buggy source:
/** 
 * Change an existing domain in the DB.
 * @see DomainDAO#update(Domain)
 */
public synchronized void update(Domain d){
  ArgumentNotValid.checkNotNull(d,"String_Node_Str");
  if (!exists(d.getName())) {
    throw new UnknownID("String_Node_Str" + d.getName() + "String_Node_Str");
  }
  Connection connection=HarvestDBConnection.get();
  PreparedStatement s=null;
  try {
    connection.setAutoCommit(false);
    long domainID=DBUtils.selectLongValue(connection,"String_Node_Str",d.getName());
    if (d.hasID() && d.getID() != domainID) {
      String message="String_Node_Str" + d + "String_Node_Str"+ d.getID()+ "String_Node_Str"+ domainID;
      log.warn(message);
      throw new ArgumentNotValid(message);
    }
    d.setID(domainID);
    s=connection.prepareStatement("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
    DBUtils.setComments(s,1,d,Constants.MAX_COMMENT_SIZE);
    DBUtils.setStringMaxLength(s,2,StringUtils.conjoin("String_Node_Str",d.getCrawlerTraps()),Constants.MAX_CRAWLER_TRAP_SIZE,d,"String_Node_Str");
    final long newEdition=d.getEdition() + 1;
    s.setLong(3,newEdition);
    AliasInfo aliasInfo=d.getAliasInfo();
    DBUtils.setLongMaybeNull(s,4,aliasInfo == null ? null : DBUtils.selectLongValue(connection,"String_Node_Str",aliasInfo.getAliasOf()));
    DBUtils.setDateMaybeNull(s,5,aliasInfo == null ? null : aliasInfo.getLastChange());
    s.setLong(6,d.getID());
    s.setLong(7,d.getEdition());
    int rows=s.executeUpdate();
    if (rows == 0) {
      String message="String_Node_Str" + d.getEdition() + "String_Node_Str"+ d;
      log.debug(message);
      throw new PermissionDenied(message);
    }
    s.close();
    updatePasswords(connection,d);
    updateSeedlists(connection,d);
    updateConfigurations(connection,d);
    updateOwnerInfo(connection,d);
    updateHarvestInfo(connection,d);
    saveExtendedFieldValues(connection,d);
    s=connection.prepareStatement("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    s.setLong(1,d.getID());
    s.setString(2,d.getDefaultConfiguration().getName());
    s.setLong(3,d.getID());
    s.executeUpdate();
    connection.commit();
    d.setEdition(newEdition);
  }
 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);
    HarvestDBConnection.release(connection);
  }
}

Fixed version (ground truth):
@Override public synchronized void update(Domain d){
  ArgumentNotValid.checkNotNull(d,"String_Node_Str");
  if (!exists(d.getName())) {
    throw new UnknownID("String_Node_Str" + d.getName() + "String_Node_Str");
  }
  Connection connection=HarvestDBConnection.get();
  PreparedStatement s=null;
  try {
    connection.setAutoCommit(false);
    long domainID=DBUtils.selectLongValue(connection,"String_Node_Str",d.getName());
    if (d.hasID() && d.getID() != domainID) {
      String message="String_Node_Str" + d + "String_Node_Str"+ d.getID()+ "String_Node_Str"+ domainID;
      log.warn(message);
      throw new ArgumentNotValid(message);
    }
    d.setID(domainID);
    s=connection.prepareStatement("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
    DBUtils.setComments(s,1,d,Constants.MAX_COMMENT_SIZE);
    DBUtils.setStringMaxLength(s,2,StringUtils.conjoin("String_Node_Str",d.getCrawlerTraps()),Constants.MAX_CRAWLER_TRAP_SIZE,d,"String_Node_Str");
    final long newEdition=d.getEdition() + 1;
    s.setLong(3,newEdition);
    AliasInfo aliasInfo=d.getAliasInfo();
    DBUtils.setLongMaybeNull(s,4,aliasInfo == null ? null : DBUtils.selectLongValue(connection,"String_Node_Str",aliasInfo.getAliasOf()));
    DBUtils.setDateMaybeNull(s,5,aliasInfo == null ? null : aliasInfo.getLastChange());
    s.setLong(6,d.getID());
    s.setLong(7,d.getEdition());
    int rows=s.executeUpdate();
    if (rows == 0) {
      String message="String_Node_Str" + d.getEdition() + "String_Node_Str"+ d;
      log.debug(message);
      throw new PermissionDenied(message);
    }
    s.close();
    updatePasswords(connection,d);
    updateSeedlists(connection,d);
    updateConfigurations(connection,d);
    updateOwnerInfo(connection,d);
    updateHarvestInfo(connection,d);
    saveExtendedFieldValues(connection,d);
    s=connection.prepareStatement("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    s.setLong(1,d.getID());
    s.setString(2,d.getDefaultConfiguration().getName());
    s.setLong(3,d.getID());
    s.executeUpdate();
    connection.commit();
    d.setEdition(newEdition);
  }
 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);
    HarvestDBConnection.release(connection);
  }
}