Program: 89978
Project: 89978
Buggy source:
/** 
 * Gets the best expectation for how many objects a harvest using this configuration will retrieve, given a job with a maximum limit pr. domain
 * @param objectLimit The maximum limit, or 0 for no limit.This limit overrides the limit set on the configuration, unless override is in effect.
 * @param byteLimit The maximum number of bytes that will be used aslimit in the harvest.  This limit overrides the limit set on the configuration, unless override is in effect.  It is used to modify the expected number of objects based on what we know of object sizes. -1 means not limit.
 * @return The expected number.
 */
public long getExpectedNumberOfObjects(long objectLimit,long byteLimit){
  long prevresultfactor=Settings.getLong(HarvesterSettings.ERRORFACTOR_PERMITTED_PREVRESULT);
  long bestguessfactor=Settings.getLong(HarvesterSettings.ERRORFACTOR_PERMITTED_BESTGUESS);
  HarvestInfo best=getBestHarvestInfoExpectation();
  log.trace("String_Node_Str" + best + "String_Node_Str"+ toString()+ "String_Node_Str");
  long expectedObjectSize=getExpectedBytesPerObject(best);
  long maximum;
  if (objectLimit != Constants.HERITRIX_MAXOBJECTS_INFINITY || byteLimit != Constants.HERITRIX_MAXBYTES_INFINITY) {
    maximum=minObjectsBytesLimit(objectLimit,byteLimit,expectedObjectSize);
  }
 else   if (maxObjects != Constants.HERITRIX_MAXOBJECTS_INFINITY || maxBytes != Constants.HERITRIX_MAXBYTES_INFINITY) {
    maximum=minObjectsBytesLimit(maxObjects,maxBytes,expectedObjectSize);
  }
 else {
    maximum=Settings.getLong(HarvesterSettings.MAX_DOMAIN_SIZE);
  }
  long minimum;
  if (best != null) {
    minimum=best.getCountObjectRetrieved();
  }
 else {
    minimum=0;
  }
  long expectation;
  if (best != null && best.getStopReason() == StopReason.DOWNLOAD_COMPLETE) {
    expectation=minimum + ((maximum - minimum) / prevresultfactor);
  }
 else {
    expectation=minimum + ((maximum - minimum) / bestguessfactor);
  }
  if ((maxObjects > Constants.HERITRIX_MAXOBJECTS_INFINITY && maximum > maxObjects) || (maxBytes > Constants.HERITRIX_MAXBYTES_INFINITY && maximum > maxBytes / expectedObjectSize)) {
    maximum=minObjectsBytesLimit(maxObjects,maxBytes,expectedObjectSize);
  }
  expectation=Math.min(expectation,maximum);
  log.trace("String_Node_Str" + toString() + "String_Node_Str"+ expectation);
  return expectation;
}

Fixed version (ground truth):
/** 
 * Gets the best expectation for how many objects a harvest using this configuration will retrieve, given a job with a maximum limit pr. domain
 * @param objectLimit The maximum limit, or 0 for no limit.This limit overrides the limit set on the configuration, unless override is in effect.
 * @param byteLimit The maximum number of bytes that will be used aslimit in the harvest.  This limit overrides the limit set on the configuration, unless override is in effect.  It is used to modify the expected number of objects based on what we know of object sizes. -1 means not limit.
 * @return The expected number of objects.
 */
public long getExpectedNumberOfObjects(long objectLimit,long byteLimit){
  long prevresultfactor=Settings.getLong(HarvesterSettings.ERRORFACTOR_PERMITTED_PREVRESULT);
  HarvestInfo best=getBestHarvestInfoExpectation();
  log.trace("String_Node_Str" + best + "String_Node_Str"+ toString()+ "String_Node_Str");
  long expectedObjectSize=getExpectedBytesPerObject(best);
  long maximum=-1;
  if (objectLimit != Constants.HERITRIX_MAXOBJECTS_INFINITY || byteLimit != Constants.HERITRIX_MAXBYTES_INFINITY) {
    maximum=minObjectsBytesLimit(objectLimit,byteLimit,expectedObjectSize);
  }
 else   if (maxObjects != Constants.HERITRIX_MAXOBJECTS_INFINITY || maxBytes != Constants.HERITRIX_MAXBYTES_INFINITY) {
    maximum=minObjectsBytesLimit(maxObjects,maxBytes,expectedObjectSize);
  }
  long minimum;
  if (best != null) {
    minimum=best.getCountObjectRetrieved();
  }
 else {
    minimum=0;
  }
  long expectation;
  if (best != null && best.getStopReason() == StopReason.DOWNLOAD_COMPLETE && maximum != -1) {
    expectation=minimum + ((maximum - minimum) / prevresultfactor);
  }
 else {
    expectation=Settings.getLong(HarvesterSettings.MAX_DOMAIN_SIZE);
  }
  if ((maxObjects > Constants.HERITRIX_MAXOBJECTS_INFINITY && maximum > maxObjects) || (maxBytes > Constants.HERITRIX_MAXBYTES_INFINITY && maximum > maxBytes / expectedObjectSize)) {
    maximum=minObjectsBytesLimit(maxObjects,maxBytes,expectedObjectSize);
  }
  expectation=Math.min(expectation,maximum);
  log.trace("String_Node_Str" + toString() + "String_Node_Str"+ expectation);
  return expectation;
}