Program: 84160
Project: 84160
Buggy source:
public void testRerunDiffChangeLog() throws Exception {
  if (connection == null) {
    return;
  }
  runCompleteChangeLog();
  DatabaseSnapshot originalSnapshot=new DatabaseSnapshot(DatabaseFactory.getInstance().findCorrectDatabaseImplementation(connection));
  Diff diff=new Diff(connection);
  DiffResult diffResult=diff.compare();
  File tempFile=File.createTempFile("String_Node_Str","String_Node_Str");
  FileOutputStream output=new FileOutputStream(tempFile);
  try {
    diffResult.printChangeLog(new PrintStream(output),DatabaseFactory.getInstance().findCorrectDatabaseImplementation(connection));
    output.flush();
  }
  finally {
    output.close();
  }
  Migrator migrator=createMigrator(tempFile.getName());
  migrator.dropAll(getSchemasToDrop());
  migrator=createMigrator(tempFile.getName());
  try {
    migrator.migrate();
  }
 catch (  ValidationFailedException e) {
    e.printDescriptiveError(System.out);
    throw e;
  }
  tempFile.deleteOnExit();
  DatabaseSnapshot finalSnapshot=new DatabaseSnapshot(DatabaseFactory.getInstance().findCorrectDatabaseImplementation(connection));
  DiffResult finalDiffResult=new Diff(originalSnapshot,finalSnapshot).compare();
  assertEquals(0,finalDiffResult.getMissingColumns().size());
  assertEquals(0,finalDiffResult.getMissingForeignKeys().size());
  assertEquals(0,finalDiffResult.getMissingIndexes().size());
  assertEquals(0,finalDiffResult.getMissingPrimaryKeys().size());
  assertEquals(0,finalDiffResult.getMissingSequences().size());
  assertEquals(0,finalDiffResult.getMissingTables().size());
  assertEquals(0,finalDiffResult.getMissingViews().size());
  assertEquals(0,finalDiffResult.getUnexpectedColumns().size());
  assertEquals(0,finalDiffResult.getUnexpectedForeignKeys().size());
  assertEquals(0,finalDiffResult.getUnexpectedIndexes().size());
  assertEquals(0,finalDiffResult.getUnexpectedPrimaryKeys().size());
  assertEquals(0,finalDiffResult.getUnexpectedSequences().size());
  assertEquals(0,finalDiffResult.getUnexpectedTables().size());
  assertEquals(0,finalDiffResult.getUnexpectedViews().size());
}

Fixed version (ground truth):
public void testRerunDiffChangeLog() throws Exception {
  if (database == null) {
    return;
  }
  runCompleteChangeLog();
  DatabaseSnapshot originalSnapshot=new DatabaseSnapshot(database);
  Diff diff=new Diff(database.getConnection());
  DiffResult diffResult=diff.compare();
  File tempFile=File.createTempFile("String_Node_Str","String_Node_Str");
  FileOutputStream output=new FileOutputStream(tempFile);
  try {
    diffResult.printChangeLog(new PrintStream(output),database);
    output.flush();
  }
  finally {
    output.close();
  }
  Migrator migrator=createMigrator(tempFile.getName());
  migrator.dropAll(getSchemasToDrop());
  migrator=createMigrator(tempFile.getName());
  try {
    migrator.update(this.contexts);
  }
 catch (  ValidationFailedException e) {
    e.printDescriptiveError(System.out);
    throw e;
  }
  tempFile.deleteOnExit();
  DatabaseSnapshot finalSnapshot=new DatabaseSnapshot(database);
  DiffResult finalDiffResult=new Diff(originalSnapshot,finalSnapshot).compare();
  assertEquals(0,finalDiffResult.getMissingColumns().size());
  assertEquals(0,finalDiffResult.getMissingForeignKeys().size());
  assertEquals(0,finalDiffResult.getMissingIndexes().size());
  assertEquals(0,finalDiffResult.getMissingPrimaryKeys().size());
  assertEquals(0,finalDiffResult.getMissingSequences().size());
  assertEquals(0,finalDiffResult.getMissingTables().size());
  assertEquals(0,finalDiffResult.getMissingViews().size());
  assertEquals(0,finalDiffResult.getUnexpectedColumns().size());
  assertEquals(0,finalDiffResult.getUnexpectedForeignKeys().size());
  assertEquals(0,finalDiffResult.getUnexpectedIndexes().size());
  assertEquals(0,finalDiffResult.getUnexpectedPrimaryKeys().size());
  assertEquals(0,finalDiffResult.getUnexpectedSequences().size());
  assertEquals(0,finalDiffResult.getUnexpectedTables().size());
  assertEquals(0,finalDiffResult.getUnexpectedViews().size());
}