Program: 90126
Project: 90126
Buggy source:
/** 
 * Updates the job status from the current status to that specified in message if it legal to do so. Logs a warning if messages arrive out of order.
 * @param cmsg The CrawlStatusMessage received
 * @throws ArgumentNotValid if the current job status is Job.STATUS_NEW
 */
private void processCrawlStatusMessage(CrawlStatusMessage cmsg) throws ArgumentNotValid {
  long jobID=cmsg.getJobID();
  JobStatus new_status=cmsg.getStatusCode();
  Job job=jobDAO.read(new Long(jobID));
  JobStatus old_status=job.getStatus();
  if (old_status == JobStatus.NEW) {
    String msg="String_Node_Str" + job;
    log.warn(msg);
  }
switch (new_status) {
case RESUBMITTED:
case SUBMITTED:
case NEW:
    String msg="String_Node_Str" + job + "String_Node_Str"+ new_status;
  log.warn(msg);
throw new ArgumentNotValid(msg);
case STARTED:
if (old_status == JobStatus.SUBMITTED || old_status == JobStatus.NEW) {
if (old_status == JobStatus.NEW) {
  log.warn("String_Node_Str" + "String_Node_Str" + old_status + "String_Node_Str"+ new_status+ "String_Node_Str"+ job.toString());
}
job.setStatus(new_status);
log.debug(job + "String_Node_Str");
jobDAO.update(job);
}
 else {
log.warn("String_Node_Str" + "String_Node_Str" + job.getJobID() + "String_Node_Str"+ old_status+ "String_Node_Str"+ new_status+ "String_Node_Str");
}
break;
case DONE:
case FAILED:
if (old_status == JobStatus.STARTED || old_status == JobStatus.SUBMITTED || old_status == JobStatus.RESUBMITTED || old_status == JobStatus.NEW) {
if (old_status != JobStatus.STARTED) {
log.warn("String_Node_Str" + "String_Node_Str" + old_status + "String_Node_Str"+ new_status+ "String_Node_Str"+ job.toString());
}
if (new_status == JobStatus.FAILED) {
log.warn("String_Node_Str" + jobID + "String_Node_Str"+ cmsg.getErrMsg());
}
 else {
log.info("String_Node_Str" + jobID + "String_Node_Str");
}
job.setStatus(new_status);
job.appendHarvestErrors(cmsg.getHarvestErrors());
job.appendHarvestErrorDetails(cmsg.getHarvestErrorDetails());
job.appendUploadErrors(cmsg.getUploadErrors());
job.appendUploadErrorDetails(cmsg.getUploadErrorDetails());
jobDAO.update(job);
}
 else {
String message="String_Node_Str" + "String_Node_Str" + "String_Node_Str" + old_status + "String_Node_Str"+ new_status+ "String_Node_Str";
log.warn(message);
job.setStatus(JobStatus.FAILED);
job.appendHarvestErrors(cmsg.getHarvestErrors());
job.appendHarvestErrors(message);
job.appendHarvestErrorDetails(cmsg.getHarvestErrors());
job.appendHarvestErrorDetails(message);
log.warn("String_Node_Str" + jobID + "String_Node_Str"+ job.getHarvestErrorDetails());
jobDAO.update(job);
}
processCrawlData(job,cmsg.getDomainHarvestReport());
break;
default :
log.warn("String_Node_Str" + "String_Node_Str" + new_status);
break;
}
}

Fixed version (ground truth):
/** 
 * Updates the job status from the current status to that specified in message if it legal to do so. Logs a warning if messages arrive out of order.
 * @param cmsg The CrawlStatusMessage received
 * @throws ArgumentNotValid if the current job status is Job.STATUS_NEW
 */
private void processCrawlStatusMessage(CrawlStatusMessage cmsg) throws ArgumentNotValid {
  long jobID=cmsg.getJobID();
  JobStatus newStatus=cmsg.getStatusCode();
  Job job=jobDAO.read(new Long(jobID));
  JobStatus oldStatus=job.getStatus();
  if (oldStatus == JobStatus.NEW) {
    String msg="String_Node_Str" + job;
    log.warn(msg);
  }
switch (newStatus) {
case RESUBMITTED:
case SUBMITTED:
case NEW:
    String msg="String_Node_Str" + job + "String_Node_Str"+ newStatus;
  log.warn(msg);
throw new ArgumentNotValid(msg);
case STARTED:
if (oldStatus == JobStatus.SUBMITTED || oldStatus == JobStatus.NEW) {
if (oldStatus == JobStatus.NEW) {
  log.warn("String_Node_Str" + "String_Node_Str" + oldStatus + "String_Node_Str"+ newStatus+ "String_Node_Str"+ job.toString());
}
job.setStatus(newStatus);
log.debug(job + "String_Node_Str");
jobDAO.update(job);
}
 else {
log.warn("String_Node_Str" + "String_Node_Str" + job.getJobID() + "String_Node_Str"+ oldStatus+ "String_Node_Str"+ newStatus+ "String_Node_Str");
}
break;
case DONE:
case FAILED:
if (oldStatus == JobStatus.STARTED || oldStatus == JobStatus.SUBMITTED || oldStatus == JobStatus.RESUBMITTED || oldStatus == JobStatus.NEW) {
if (oldStatus != JobStatus.STARTED) {
log.warn("String_Node_Str" + "String_Node_Str" + oldStatus + "String_Node_Str"+ newStatus+ "String_Node_Str"+ job.toString());
}
if (newStatus == JobStatus.FAILED) {
String errors="String_Node_Str" + cmsg.getHarvestErrors() + "String_Node_Str"+ cmsg.getHarvestErrorDetails()+ "String_Node_Str"+ cmsg.getUploadErrors()+ "String_Node_Str"+ cmsg.getUploadErrorDetails();
log.warn("String_Node_Str" + jobID + "String_Node_Str"+ errors);
}
 else {
log.info("String_Node_Str" + jobID + "String_Node_Str");
}
job.setStatus(newStatus);
job.appendHarvestErrors(cmsg.getHarvestErrors());
job.appendHarvestErrorDetails(cmsg.getHarvestErrorDetails());
job.appendUploadErrors(cmsg.getUploadErrors());
job.appendUploadErrorDetails(cmsg.getUploadErrorDetails());
jobDAO.update(job);
}
 else {
String message="String_Node_Str" + "String_Node_Str" + "String_Node_Str" + oldStatus + "String_Node_Str"+ newStatus+ "String_Node_Str";
log.warn(message);
job.setStatus(JobStatus.FAILED);
job.appendHarvestErrors(cmsg.getHarvestErrors());
job.appendHarvestErrors(message);
job.appendHarvestErrorDetails(cmsg.getHarvestErrors());
job.appendHarvestErrorDetails(message);
log.warn("String_Node_Str" + jobID + "String_Node_Str"+ job.getHarvestErrorDetails());
jobDAO.update(job);
}
processCrawlData(job,cmsg.getDomainHarvestReport());
break;
default :
log.warn("String_Node_Str" + "String_Node_Str" + newStatus);
break;
}
}