Program: 90155
Project: 90155
Buggy source:
/** 
 * If FAILED arrives after DONE, the jobis marked as FAILED.
 */
public void testFailedAfterDone(){
  JMSConnectionTestMQ con=(JMSConnectionTestMQ)JMSConnectionFactory.getInstance();
  Job j1=TestInfo.getJob();
  the_dao.create(j1);
  j1.setStatus(JobStatus.NEW);
  the_dao.update(j1);
  HarvestSchedulerMonitorServer hsms=HarvestSchedulerMonitorServer.getInstance();
  long j1ID=j1.getJobID().longValue();
  j1.setStatus(JobStatus.SUBMITTED);
  the_dao.update(j1);
  CrawlStatusMessage csm_start=new CrawlStatusMessage(j1ID,JobStatus.STARTED);
  hsms.onMessage(con.getObjectMessage(csm_start));
  DomainHarvestReport hhr=new HeritrixDomainHarvestReport(CRAWL_REPORT,DEFAULT_STOPREASON);
  CrawlStatusMessage csm_done=new CrawlStatusMessage(j1ID,JobStatus.DONE,hhr);
  hsms.onMessage(con.getObjectMessage(csm_done));
  CrawlStatusMessage csm_failed=new CrawlStatusMessage(j1ID,JobStatus.FAILED,null);
  csm_failed.setNotOk("String_Node_Str");
  hsms.onMessage(con.getObjectMessage(csm_failed));
  j1=the_dao.read(new Long(j1ID));
  assertEquals("String_Node_Str",JobStatus.FAILED,j1.getStatus());
  Domain nk_domain=DomainDAO.getInstance().read("String_Node_Str");
  Iterator hist=nk_domain.getHistory().getHarvestInfo();
  assertTrue("String_Node_Str",hist.hasNext());
  HarvestInfo dh=(HarvestInfo)hist.next();
  assertFalse("String_Node_Str",hist.hasNext());
  assertEquals("String_Node_Str",22,dh.getCountObjectRetrieved());
  assertEquals("String_Node_Str",270,dh.getSizeDataRetrieved());
  LogUtils.flushLogs(hsms.getClass().getName());
  FileAsserts.assertFileContains("String_Node_Str","String_Node_Str",LOG_FILE);
}

Fixed version (ground truth):
/** 
 * If FAILED arrives after DONE, the job is marked as FAILED.
 */
public void testFailedAfterDone(){
  JMSConnectionTestMQ con=(JMSConnectionTestMQ)JMSConnectionFactory.getInstance();
  Job j1=TestInfo.getJob();
  the_dao.create(j1);
  j1.setStatus(JobStatus.NEW);
  the_dao.update(j1);
  HarvestSchedulerMonitorServer hsms=HarvestSchedulerMonitorServer.getInstance();
  long j1ID=j1.getJobID().longValue();
  j1.setStatus(JobStatus.SUBMITTED);
  the_dao.update(j1);
  CrawlStatusMessage csm_start=new CrawlStatusMessage(j1ID,JobStatus.STARTED);
  hsms.onMessage(con.getObjectMessage(csm_start));
  DomainHarvestReport hhr=new HeritrixDomainHarvestReport(CRAWL_REPORT,DEFAULT_STOPREASON);
  CrawlStatusMessage csm_done=new CrawlStatusMessage(j1ID,JobStatus.DONE,hhr);
  hsms.onMessage(con.getObjectMessage(csm_done));
  CrawlStatusMessage csm_failed=new CrawlStatusMessage(j1ID,JobStatus.FAILED,null);
  csm_failed.setNotOk("String_Node_Str");
  hsms.onMessage(con.getObjectMessage(csm_failed));
  j1=the_dao.read(new Long(j1ID));
  assertEquals("String_Node_Str",JobStatus.FAILED,j1.getStatus());
  Domain nk_domain=DomainDAO.getInstance().read("String_Node_Str");
  Iterator<HarvestInfo> hist=nk_domain.getHistory().getHarvestInfo();
  assertTrue("String_Node_Str",hist.hasNext());
  HarvestInfo dh=(HarvestInfo)hist.next();
  assertFalse("String_Node_Str",hist.hasNext());
  assertEquals("String_Node_Str",22,dh.getCountObjectRetrieved());
  assertEquals("String_Node_Str",270,dh.getSizeDataRetrieved());
  LogUtils.flushLogs(hsms.getClass().getName());
  FileAsserts.assertFileContains("String_Node_Str","String_Node_Str",LOG_FILE);
}