Program: 89745
Project: 89745
Buggy source:
/** 
 * Test that it correctly finds a changed file.
 * @throws Exception if error.
 */
public void testChangedFiles() throws Exception {
  ReplicaCacheDatabase.getInstance();
  dbabp=DatabaseBasedActiveBitPreservation.getInstance();
  Date date=dbabp.getDateForMissingFiles(THREE);
  assertTrue("String_Node_Str" + (Calendar.getInstance().getTimeInMillis() - date.getTime()),Calendar.getInstance().getTimeInMillis() - date.getTime() < 1000 * 60 * 30);
  dbabp.findMissingFiles(THREE);
  Date beforeUpdate=new Date(Calendar.getInstance().getTimeInMillis());
  dbabp.findChangedFiles(ONE);
  date=dbabp.getDateForChangedFiles(ONE);
  assertTrue("String_Node_Str" + beforeUpdate.getTime() + "String_Node_Str"+ date.getTime(),date.getTime() > beforeUpdate.getTime());
  assertTrue("String_Node_Str" + Calendar.getInstance().getTimeInMillis() + "String_Node_Str"+ date.getTime(),date.getTime() < Calendar.getInstance().getTimeInMillis());
  assertEquals("String_Node_Str" + THREE + "String_Node_Str",2,dbabp.getNumberOfChangedFiles(THREE));
  assertEquals("String_Node_Str" + THREE + "String_Node_Str"+ "String_Node_Str",Arrays.asList("String_Node_Str","String_Node_Str"),dbabp.getChangedFiles(THREE));
  dbabp.replaceChangedFile(ONE,"String_Node_Str","String_Node_Str","String_Node_Str");
  dbabp.replaceChangedFile(THREE,"String_Node_Str","String_Node_Str","String_Node_Str");
  Map<String,PreservationState> presMap=dbabp.getPreservationStateMap(new String[]{"String_Node_Str"});
  assertEquals("String_Node_Str",1,presMap.size());
  PreservationState pres=presMap.get("String_Node_Str");
  assertNotNull("String_Node_Str",pres);
  assertEquals("String_Node_Str",ReplicaStoreState.UPLOAD_FAILED.toString(),pres.getAdminReplicaState(THREE));
  dbabp.findChangedFiles(THREE);
  pres=dbabp.getPreservationState("String_Node_Str");
  assertEquals("String_Node_Str",ReplicaStoreState.UPLOAD_COMPLETED.toString(),pres.getAdminReplicaState(THREE));
  try {
    dbabp.uploadMissingFiles(THREE,"String_Node_Str");
    fail("String_Node_Str");
  }
 catch (  IOFailure e) {
  }
  List<String> filelist=new ArrayList<String>();
  filelist.add("String_Node_Str");
  filelist.add("String_Node_Str");
  filelist.add("String_Node_Str");
  ReplicaCacheDatabase.getInstance().addFileListInformation(filelist,THREE);
  String misFiles=dbabp.getMissingFiles(THREE).toString();
  assertTrue("String_Node_Str",misFiles.contains("String_Node_Str"));
  assertTrue("String_Node_Str",misFiles.contains("String_Node_Str"));
  dbabp.uploadMissingFiles(THREE,"String_Node_Str","String_Node_Str");
  dbabp.findMissingFiles(THREE);
  misFiles=dbabp.getMissingFiles(THREE).toString();
  assertFalse("String_Node_Str",misFiles.contains("String_Node_Str"));
  assertFalse("String_Node_Str",misFiles.contains("String_Node_Str"));
}

Fixed version (ground truth):
/** 
 * Test that it correctly finds a changed file.
 * @throws Exception if error.
 */
public void testChangedFiles() throws Exception {
  ReplicaCacheDatabase.getInstance();
  dbabp=DatabaseBasedActiveBitPreservation.getInstance();
  Date date=dbabp.getDateForMissingFiles(THREE);
  assertTrue("String_Node_Str" + (Calendar.getInstance().getTimeInMillis() - date.getTime()),Calendar.getInstance().getTimeInMillis() - date.getTime() < 1000 * 60 * 30);
  dbabp.findMissingFiles(THREE);
  Date beforeUpdate=new Date(Calendar.getInstance().getTimeInMillis());
  dbabp.findChangedFiles(ONE);
  date=dbabp.getDateForChangedFiles(ONE);
  assertTrue("String_Node_Str" + beforeUpdate.getTime() + "String_Node_Str"+ date.getTime(),date.getTime() > beforeUpdate.getTime());
  assertTrue("String_Node_Str" + Calendar.getInstance().getTimeInMillis() + "String_Node_Str"+ date.getTime(),date.getTime() < Calendar.getInstance().getTimeInMillis());
  assertEquals("String_Node_Str" + THREE + "String_Node_Str",2,dbabp.getNumberOfChangedFiles(THREE));
  assertEquals("String_Node_Str" + THREE + "String_Node_Str"+ "String_Node_Str",Arrays.asList("String_Node_Str","String_Node_Str"),dbabp.getChangedFiles(THREE));
  dbabp.replaceChangedFile(ONE,"String_Node_Str","String_Node_Str","String_Node_Str");
  dbabp.replaceChangedFile(THREE,"String_Node_Str","String_Node_Str","String_Node_Str");
  Map<String,PreservationState> presMap=dbabp.getPreservationStateMap(new String[]{"String_Node_Str"});
  assertEquals("String_Node_Str",1,presMap.size());
  PreservationState pres=presMap.get("String_Node_Str");
  assertNotNull("String_Node_Str",pres);
  assertEquals("String_Node_Str",ReplicaStoreState.UPLOAD_FAILED.toString(),pres.getAdminReplicaState(THREE));
  dbabp.findChangedFiles(THREE);
  pres=dbabp.getPreservationState("String_Node_Str");
  assertEquals("String_Node_Str",ReplicaStoreState.UPLOAD_COMPLETED.toString(),pres.getAdminReplicaState(THREE));
  try {
    dbabp.uploadMissingFiles(THREE,"String_Node_Str");
    fail("String_Node_Str");
  }
 catch (  IOFailure e) {
  }
  List<String> filelist=new ArrayList<String>();
  filelist.add("String_Node_Str");
  filelist.add("String_Node_Str");
  ReplicaCacheDatabase.getInstance().addFileListInformation(filelist,THREE);
  String misFiles=dbabp.getMissingFiles(THREE).toString();
  assertTrue("String_Node_Str",misFiles.contains("String_Node_Str"));
  assertTrue("String_Node_Str",misFiles.contains("String_Node_Str"));
  assertTrue("String_Node_Str",misFiles.contains("String_Node_Str"));
  dbabp.uploadMissingFiles(THREE,"String_Node_Str","String_Node_Str");
  try {
    dbabp.uploadMissingFiles(THREE,"String_Node_Str");
    fail("String_Node_Str" + "String_Node_Str");
  }
 catch (  IOFailure e) {
  }
  dbabp.findMissingFiles(THREE);
  misFiles=dbabp.getMissingFiles(THREE).toString();
  assertFalse("String_Node_Str",misFiles.contains("String_Node_Str"));
  assertFalse("String_Node_Str",misFiles.contains("String_Node_Str"));
}