Program: 16177
Project: 16177
Buggy source:
/** 
 * Set or reset the pending change flag in the .lock.db file.
 * @param pending the new value of the flag
 * @return true if the call was successful,false if another connection was faster
 */
synchronized boolean reconnectModified(boolean pending){
  if (readOnly || lock == null || fileLockMethod != FileLock.LOCK_SERIALIZED) {
    return true;
  }
  try {
    if (pending == reconnectChangePending) {
      long now=System.currentTimeMillis();
      if (now > reconnectCheckNext) {
        if (pending) {
          String pos=log == null ? null : log.getWritePos();
          lock.setProperty("String_Node_Str",pos);
          lock.save();
        }
        reconnectCheckNext=now + SysProperties.RECONNECT_CHECK_DELAY;
      }
      return true;
    }
    Properties old=lock.load();
    if (pending) {
      getTrace().debug("String_Node_Str");
      Thread.sleep((int)(SysProperties.RECONNECT_CHECK_DELAY * 1.1));
      Properties now=lock.load();
      if (!now.equals(old)) {
        return false;
      }
    }
    String pos=log == null ? null : log.getWritePos();
    lock.setProperty("String_Node_Str",pos);
    lock.setProperty("String_Node_Str",pending ? "String_Node_Str" : null);
    reconnectCheckNext=System.currentTimeMillis() + 2 * SysProperties.RECONNECT_CHECK_DELAY;
    old=lock.save();
    if (pending) {
      getTrace().debug("String_Node_Str");
      Thread.sleep((int)(SysProperties.RECONNECT_CHECK_DELAY * 1.1));
      Properties now=lock.load();
      if (!now.equals(old)) {
        return false;
      }
    }
    reconnectLastLock=old;
    reconnectChangePending=pending;
    reconnectCheckNext=System.currentTimeMillis() + SysProperties.RECONNECT_CHECK_DELAY;
    return true;
  }
 catch (  Exception e) {
    getTrace().error("String_Node_Str" + pending,e);
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Set or reset the pending change flag in the .lock.db file.
 * @param pending the new value of the flag
 * @return true if the call was successful,false if another connection was faster
 */
synchronized boolean reconnectModified(boolean pending){
  if (readOnly || lock == null || fileLockMethod != FileLock.LOCK_SERIALIZED) {
    return true;
  }
  try {
    if (pending == reconnectChangePending) {
      long now=System.currentTimeMillis();
      if (now > reconnectCheckNext) {
        if (pending) {
          String pos=log == null ? null : log.getWritePos();
          lock.setProperty("String_Node_Str",pos);
          lock.save();
        }
        reconnectCheckNext=now + SysProperties.RECONNECT_CHECK_DELAY;
      }
      return true;
    }
    Properties old=lock.load();
    if (pending) {
      if (old.getProperty("String_Node_Str") != null) {
        return false;
      }
      getTrace().debug("String_Node_Str");
      Thread.sleep((int)(SysProperties.RECONNECT_CHECK_DELAY * 1.1));
      Properties now=lock.load();
      if (!now.equals(old)) {
        return false;
      }
    }
    String pos=log == null ? null : log.getWritePos();
    lock.setProperty("String_Node_Str",pos);
    lock.setProperty("String_Node_Str",pending ? "String_Node_Str" : null);
    reconnectCheckNext=System.currentTimeMillis() + 2 * SysProperties.RECONNECT_CHECK_DELAY;
    old=lock.save();
    if (pending) {
      getTrace().debug("String_Node_Str");
      Thread.sleep((int)(SysProperties.RECONNECT_CHECK_DELAY * 1.1));
      Properties now=lock.load();
      if (!now.equals(old)) {
        return false;
      }
    }
 else {
      Thread.sleep(1);
    }
    reconnectLastLock=old;
    reconnectChangePending=pending;
    reconnectCheckNext=System.currentTimeMillis() + SysProperties.RECONNECT_CHECK_DELAY;
    return true;
  }
 catch (  Exception e) {
    getTrace().error("String_Node_Str" + pending,e);
    return false;
  }
}