Program: 3476
Project: 3476
Buggy source:
/** 
 * Get the position of the current start point of the browse in the field of total objects relevant to this browse.  This is integrally related to how results are presented in pages to the User Interface.  The argument tells us whether this is a distinct browse or not, as this has an impact on how results are calculated
 * @param distinct		is this a distinct browse
 * @return				the offset of the first result from the start of the set
 * @throws SQLException
 * @throws BrowseException
 */
private int getPosition(boolean distinct) throws SQLException, BrowseException {
  log.debug(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + distinct));
  if (dao.getJumpToValue() == null) {
    log.debug(LogManager.getHeader(context,"String_Node_Str","String_Node_Str"));
    return 0;
  }
  String tableName=browseIndex.getTableName(distinct,scope.inCommunity(),scope.inCollection());
  String[] select={"String_Node_Str"};
  dao.setCountValues(select);
  boolean isAscending=dao.isAscending();
  boolean useEquals=dao.useEqualsComparator();
  String orderField=dao.getOrderField();
  int limit=dao.getLimit();
  int offset=dao.getOffset();
  dao.setAscending(!isAscending);
  dao.setEqualsComparator(false);
  dao.setOrderField(null);
  dao.setLimit(-1);
  dao.setOffset(-1);
  int count=dao.doCountQuery();
  dao.setAscending(isAscending);
  dao.setEqualsComparator(useEquals);
  dao.setOrderField(orderField);
  dao.setLimit(limit);
  dao.setOffset(offset);
  log.debug(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + count));
  return count;
}

Fixed version (ground truth):
/** 
 * Get the position of the current start point of the browse in the field of total objects relevant to this browse.  This is integrally related to how results are presented in pages to the User Interface.  The argument tells us whether this is a distinct browse or not, as this has an impact on how results are calculated
 * @param distinct      is this a distinct browse
 * @return              the offset of the first result from the start of the set
 * @throws SQLException
 * @throws BrowseException
 */
private int getPosition(boolean distinct) throws SQLException, BrowseException {
  log.debug(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + distinct));
  if (dao.getJumpToValue() == null) {
    log.debug(LogManager.getHeader(context,"String_Node_Str","String_Node_Str"));
    return 0;
  }
  String tableName=browseIndex.getTableName(distinct,scope.inCommunity(),scope.inCollection());
  String[] select={"String_Node_Str"};
  dao.setCountValues(select);
  boolean isAscending=dao.isAscending();
  boolean useEquals=dao.useEqualsComparator();
  String orderField=dao.getOrderField();
  int limit=dao.getLimit();
  int offset=dao.getOffset();
  dao.setAscending(!isAscending);
  dao.setEqualsComparator(false);
  dao.setOrderField(null);
  dao.setLimit(-1);
  dao.setOffset(-1);
  int count=dao.doCountQuery();
  dao.setAscending(isAscending);
  dao.setEqualsComparator(useEquals);
  dao.setOrderField(orderField);
  dao.setLimit(limit);
  dao.setOffset(offset);
  log.debug(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + count));
  return count;
}