Program: 179585
Project: 179585
Buggy source:
/** 
 * Test doing migrations with a lock race from a quick cluster
 * @exception Exception if there is a problem
 */
public void testDoMigrationsWithLockRace() throws Exception {
  PreparedStatementResultSetHandler h=conn.getPreparedStatementResultSetHandler();
  MockResultSet rs=h.createResultSet();
  rs.addRow(new Integer[]{new Integer(0)});
  h.prepareGlobalResultSet(rs);
  MockControl mockControl=MockControl.createStrictControl(PatchInfoStore.class);
  PatchInfoStore patchStore=(PatchInfoStore)mockControl.getMock();
  patchStore.isPatchStoreLocked();
  mockControl.setReturnValue(true);
  patchStore.isPatchStoreLocked();
  mockControl.setReturnValue(false);
  patchStore.getPatchLevel();
  mockControl.setReturnValue(0);
  patchStore.lockPatchStore();
  mockControl.setThrowable(new IllegalStateException("String_Node_Str"));
  patchStore.isPatchStoreLocked();
  mockControl.setReturnValue(false);
  patchStore.getPatchLevel();
  mockControl.setReturnValue(2);
  patchStore.lockPatchStore();
  patchStore.getPatchLevel();
  mockControl.setReturnValue(2);
  patchStore.updatePatchLevel(4);
  patchStore.updatePatchLevel(5);
  patchStore.updatePatchLevel(6);
  patchStore.updatePatchLevel(7);
  patchStore.unlockPatchStore();
  mockControl.replay();
  TestJdbcMigrationLauncher testLauncher=new TestJdbcMigrationLauncher(context);
  testLauncher.setLockPollMillis(0);
  testLauncher.setLockPollRetries(4);
  testLauncher.setIgnoreMigrationSuccessfulEvents(false);
  testLauncher.setPatchStore(patchStore);
  testLauncher.setPatchPath("String_Node_Str");
  testLauncher.doMigrations();
  mockControl.verify();
}

Fixed version (ground truth):
/** 
 * Test doing migrations with a lock race from a quick cluster
 * @exception Exception if there is a problem
 */
public void testDoMigrationsWithLockRace() throws Exception {
  PreparedStatementResultSetHandler h=conn.getPreparedStatementResultSetHandler();
  MockResultSet rs=h.createResultSet();
  rs.addRow(new Integer[]{new Integer(0)});
  h.prepareGlobalResultSet(rs);
  MockControl mockControl=MockControl.createStrictControl(PatchInfoStore.class);
  PatchInfoStore patchStore=(PatchInfoStore)mockControl.getMock();
  patchStore.isPatchStoreLocked();
  mockControl.setReturnValue(true);
  patchStore.isPatchStoreLocked();
  mockControl.setReturnValue(false);
  patchStore.getPatchLevel();
  mockControl.setReturnValue(0);
  patchStore.lockPatchStore();
  mockControl.setThrowable(new IllegalStateException("String_Node_Str"));
  patchStore.isPatchStoreLocked();
  mockControl.setReturnValue(false);
  patchStore.getPatchLevel();
  mockControl.setReturnValue(2,MockControl.ONE_OR_MORE);
  patchStore.lockPatchStore();
  patchStore.getPatchLevel();
  mockControl.setReturnValue(2,MockControl.ONE_OR_MORE);
  patchStore.updatePatchLevel(4);
  patchStore.getPatchLevel();
  mockControl.setReturnValue(4);
  patchStore.updatePatchLevel(5);
  patchStore.getPatchLevel();
  mockControl.setReturnValue(5);
  patchStore.updatePatchLevel(6);
  patchStore.getPatchLevel();
  mockControl.setReturnValue(6);
  patchStore.updatePatchLevel(7);
  patchStore.getPatchLevel();
  mockControl.setReturnValue(7,MockControl.ZERO_OR_MORE);
  patchStore.unlockPatchStore();
  mockControl.replay();
  TestJdbcMigrationLauncher testLauncher=new TestJdbcMigrationLauncher(context);
  testLauncher.setLockPollMillis(0);
  testLauncher.setLockPollRetries(4);
  testLauncher.setIgnoreMigrationSuccessfulEvents(false);
  testLauncher.setPatchStore(patchStore);
  testLauncher.setPatchPath("String_Node_Str");
  testLauncher.doMigrations();
  mockControl.verify();
}