Program: 89696
Project: 89696
Buggy source:
/** 
 * Activates or deactivates a partial harvest definition. This method is actually to be used not to have to read from the DB big harvest definitions and optimize the activation / deactivation, it is sort of a lightweight version of update.
 * @param harvestDefinition the harvest definition object.
 */
public synchronized void flipActive(SparsePartialHarvest hd){
  ArgumentNotValid.checkNotNull(hd,"String_Node_Str");
  Connection c=HarvestDBConnection.get();
  PreparedStatement s=null;
  try {
    if (hd.getOid() == null || !exists(c,hd.getOid())) {
      final String message="String_Node_Str" + "String_Node_Str" + hd.getName() + "String_Node_Str";
      log.debug(message);
      throw new PermissionDenied(message);
    }
    c.setAutoCommit(false);
    s=c.prepareStatement("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    DBUtils.setName(s,1,hd,Constants.MAX_NAME_SIZE);
    DBUtils.setComments(s,2,hd,Constants.MAX_COMMENT_SIZE);
    s.setInt(3,hd.getNumEvents());
    s.setTimestamp(4,new Timestamp(hd.getSubmissionDate().getTime()));
    s.setBoolean(5,!hd.isActive());
    long nextEdition=hd.getEdition() + 1;
    s.setLong(6,nextEdition);
    s.setLong(7,hd.getOid());
    s.setLong(8,hd.getEdition());
    int rows=s.executeUpdate();
    if (rows == 0) {
      String message="String_Node_Str" + hd + "String_Node_Str"+ hd.getEdition()+ "String_Node_Str";
      log.debug(message);
      throw new PermissionDenied(message);
    }
    s.close();
    s=c.prepareStatement("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    s.setString(1,hd.getScheduleName());
    DBUtils.setDateMaybeNull(s,2,hd.getNextDate());
    s.setLong(3,hd.getOid());
    rows=s.executeUpdate();
    log.debug(rows + "String_Node_Str");
    s.close();
    c.commit();
  }
 catch (  SQLException e) {
    throw new IOFailure("String_Node_Str" + hd + "String_Node_Str"+ ExceptionUtils.getSQLExceptionCause(e),e);
  }
 finally {
    DBUtils.rollbackIfNeeded(c,"String_Node_Str",hd);
    HarvestDBConnection.release(c);
  }
}

Fixed version (ground truth):
/** 
 * Activates or deactivates a partial harvest definition. This method is actually to be used not to have to read from the DB big harvest definitions and optimize the activation / deactivation, it is sort of a lightweight version of update.
 * @param harvestDefinition the harvest definition object.
 */
@Override public synchronized void flipActive(SparsePartialHarvest harvestDefinition){
  ArgumentNotValid.checkNotNull(harvestDefinition,"String_Node_Str");
  Connection c=HarvestDBConnection.get();
  PreparedStatement s=null;
  try {
    if (harvestDefinition.getOid() == null || !exists(c,harvestDefinition.getOid())) {
      final String message="String_Node_Str" + "String_Node_Str" + harvestDefinition.getName() + "String_Node_Str";
      log.debug(message);
      throw new PermissionDenied(message);
    }
    c.setAutoCommit(false);
    s=c.prepareStatement("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    DBUtils.setName(s,1,harvestDefinition,Constants.MAX_NAME_SIZE);
    DBUtils.setComments(s,2,harvestDefinition,Constants.MAX_COMMENT_SIZE);
    s.setInt(3,harvestDefinition.getNumEvents());
    s.setTimestamp(4,new Timestamp(harvestDefinition.getSubmissionDate().getTime()));
    s.setBoolean(5,!harvestDefinition.isActive());
    long nextEdition=harvestDefinition.getEdition() + 1;
    s.setLong(6,nextEdition);
    s.setLong(7,harvestDefinition.getOid());
    s.setLong(8,harvestDefinition.getEdition());
    int rows=s.executeUpdate();
    if (rows == 0) {
      String message="String_Node_Str" + harvestDefinition + "String_Node_Str"+ harvestDefinition.getEdition()+ "String_Node_Str";
      log.debug(message);
      throw new PermissionDenied(message);
    }
    s.close();
    s=c.prepareStatement("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    s.setString(1,harvestDefinition.getScheduleName());
    DBUtils.setDateMaybeNull(s,2,harvestDefinition.getNextDate());
    s.setLong(3,harvestDefinition.getOid());
    rows=s.executeUpdate();
    log.debug(rows + "String_Node_Str");
    s.close();
    c.commit();
  }
 catch (  SQLException e) {
    throw new IOFailure("String_Node_Str" + harvestDefinition + "String_Node_Str"+ ExceptionUtils.getSQLExceptionCause(e),e);
  }
 finally {
    DBUtils.rollbackIfNeeded(c,"String_Node_Str",harvestDefinition);
    HarvestDBConnection.release(c);
  }
}