Program: 179584
Project: 179584
Buggy source:
/** 
 * Test doing migrations with a lock override
 * @exception Exception if there is a problem
 */
public void testLockOverride() 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(true);
  patchStore.isPatchStoreLocked();
  mockControl.setReturnValue(true);
  patchStore.isPatchStoreLocked();
  mockControl.setReturnValue(true);
  patchStore.unlockPatchStore();
  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(3);
  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 override
 * @exception Exception if there is a problem
 */
public void testLockOverride() 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(true);
  patchStore.isPatchStoreLocked();
  mockControl.setReturnValue(true);
  patchStore.isPatchStoreLocked();
  mockControl.setReturnValue(true);
  patchStore.unlockPatchStore();
  patchStore.isPatchStoreLocked();
  mockControl.setReturnValue(false);
  patchStore.getPatchLevel();
  mockControl.setReturnValue(2);
  patchStore.lockPatchStore();
  patchStore.getPatchLevel();
  mockControl.setReturnValue(2,MockControl.ONE_OR_MORE);
  patchStore.updatePatchLevel(4);
  patchStore.getPatchLevel();
  mockControl.setReturnValue(4,MockControl.ONE_OR_MORE);
  patchStore.updatePatchLevel(5);
  patchStore.getPatchLevel();
  mockControl.setReturnValue(5,MockControl.ONE_OR_MORE);
  patchStore.updatePatchLevel(6);
  patchStore.getPatchLevel();
  mockControl.setReturnValue(6,MockControl.ONE_OR_MORE);
  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(3);
  testLauncher.setIgnoreMigrationSuccessfulEvents(false);
  testLauncher.setPatchStore(patchStore);
  testLauncher.setPatchPath("String_Node_Str");
  testLauncher.doMigrations();
  mockControl.verify();
}