nus-yam/ex-repair huggingface dataset:
Program: 52410
Project: 52410
Buggy source:
/** 
 * Build the query that will be used for a full browse.
 * @return      the query to be executed
 * @throws BrowseException
 */
private String buildQuery(List params) throws BrowseException {
  StringBuffer queryBuf=new StringBuffer();
  if (!buildSelectListCount(queryBuf)) {
    if (!buildSelectListValues(queryBuf)) {
      throw new BrowseException("String_Node_Str");
    }
  }
  buildSelectStatement(queryBuf,params);
  buildWhereClauseOpReset();
  buildWhereClauseJumpTo(queryBuf,params);
  buildWhereClauseFilterValue(queryBuf,params);
  buildWhereClauseFullConstraints(queryBuf,params);
  buildOrderBy(queryBuf);
  buildRowLimit(queryBuf,params);
  buildRowOffset(queryBuf,params);
  return queryBuf.toString();
}

Fixed version (ground truth):
/** 
 * Build the query that will be used for a full browse.
 * @return      the query to be executed
 * @throws BrowseException
 */
private String buildQuery(List params) throws BrowseException {
  StringBuffer queryBuf=new StringBuffer();
  if (!buildSelectListCount(queryBuf)) {
    if (!buildSelectListValues(queryBuf)) {
      throw new BrowseException("String_Node_Str");
    }
  }
  buildSelectStatement(queryBuf,params);
  buildWhereClauseOpReset();
  buildWhereClauseJumpTo(queryBuf,params);
  buildWhereClauseFilterValue(queryBuf,params);
  buildWhereClauseFullConstraints(queryBuf,params);
  buildOrderBy(queryBuf);
  buildRowLimitAndOffset(queryBuf,params);
  return queryBuf.toString();
}
Program: 52411
Project: 52411
Buggy source:
/** 
 * Build the query that will be used for a distinct select.  This incorporates only the parts of the parameters that are actually useful for this type of browse
 * @return      the query to be executed
 * @throws BrowseException
 */
private String buildDistinctQuery(List params) throws BrowseException {
  StringBuffer queryBuf=new StringBuffer();
  if (!buildSelectListCount(queryBuf)) {
    if (!buildSelectListValues(queryBuf)) {
      throw new BrowseException("String_Node_Str");
    }
  }
  buildSelectStatementDistinct(queryBuf,params);
  buildWhereClauseOpReset();
  buildWhereClauseJumpTo(queryBuf,params);
  buildWhereClauseDistinctConstraints(queryBuf,params);
  buildOrderBy(queryBuf);
  buildRowLimit(queryBuf,params);
  return queryBuf.toString();
}

Fixed version (ground truth):
/** 
 * Build the query that will be used for a distinct select.  This incorporates only the parts of the parameters that are actually useful for this type of browse
 * @return      the query to be executed
 * @throws BrowseException
 */
private String buildDistinctQuery(List params) throws BrowseException {
  StringBuffer queryBuf=new StringBuffer();
  if (!buildSelectListCount(queryBuf)) {
    if (!buildSelectListValues(queryBuf)) {
      throw new BrowseException("String_Node_Str");
    }
  }
  buildSelectStatementDistinct(queryBuf,params);
  buildWhereClauseOpReset();
  buildWhereClauseJumpTo(queryBuf,params);
  buildWhereClauseDistinctConstraints(queryBuf,params);
  buildOrderBy(queryBuf);
  buildRowLimitAndOffset(queryBuf,params);
  return queryBuf.toString();
}
Program: 52412
Project: 52412
Buggy source:
/** 
 * Build the query that will be used for a full browse.
 * @return      the query to be executed
 * @throws BrowseException
 */
private String buildQuery(List params) throws BrowseException {
  StringBuffer queryBuf=new StringBuffer();
  if (!buildSelectListCount(queryBuf)) {
    if (!buildSelectListValues(queryBuf)) {
      throw new BrowseException("String_Node_Str");
    }
  }
  buildSelectStatement(queryBuf,params);
  buildWhereClauseOpReset();
  buildWhereClauseJumpTo(queryBuf,params);
  buildWhereClauseFilterValue(queryBuf,params);
  buildWhereClauseFullConstraints(queryBuf,params);
  buildOrderBy(queryBuf);
  buildRowLimit(queryBuf,params);
  buildRowOffset(queryBuf,params);
  return queryBuf.toString();
}

Fixed version (ground truth):
/** 
 * Build the query that will be used for a full browse.
 * @return      the query to be executed
 * @throws BrowseException
 */
private String buildQuery(List params) throws BrowseException {
  StringBuffer queryBuf=new StringBuffer();
  if (!buildSelectListCount(queryBuf)) {
    if (!buildSelectListValues(queryBuf)) {
      throw new BrowseException("String_Node_Str");
    }
  }
  buildSelectStatement(queryBuf,params);
  buildWhereClauseOpReset();
  buildWhereClauseJumpTo(queryBuf,params);
  buildWhereClauseFilterValue(queryBuf,params);
  buildWhereClauseFullConstraints(queryBuf,params);
  buildOrderBy(queryBuf);
  buildRowLimitAndOffset(queryBuf,params);
  return queryBuf.toString();
}
Program: 52413
Project: 52413
Buggy source:
/** 
 * Required constructor for use by BrowseDAOFactory 
 * @param context   DSpace context
 */
public BrowseDAOPostgres(Context context) throws BrowseException {
  this.context=context;
  utils=BrowseDAOFactory.getUtils(context);
}

Fixed version (ground truth):
/** 
 * Required constructor for use by BrowseDAOFactory
 * @param context   DSpace context
 */
public BrowseDAOPostgres(Context context) throws BrowseException {
  this.context=context;
  utils=BrowseDAOFactory.getUtils(context);
}
Program: 52414
Project: 52414
Buggy source:
/** 
 * Build the query that will be used for a distinct select.  This incorporates only the parts of the parameters that are actually useful for this type of browse
 * @return      the query to be executed
 * @throws BrowseException
 */
private String buildDistinctQuery(List params) throws BrowseException {
  StringBuffer queryBuf=new StringBuffer();
  if (!buildSelectListCount(queryBuf)) {
    if (!buildSelectListValues(queryBuf)) {
      throw new BrowseException("String_Node_Str");
    }
  }
  buildSelectStatementDistinct(queryBuf,params);
  buildWhereClauseOpReset();
  buildWhereClauseJumpTo(queryBuf,params);
  buildWhereClauseDistinctConstraints(queryBuf,params);
  buildOrderBy(queryBuf);
  buildRowLimit(queryBuf,params);
  return queryBuf.toString();
}

Fixed version (ground truth):
/** 
 * Build the query that will be used for a distinct select.  This incorporates only the parts of the parameters that are actually useful for this type of browse
 * @return      the query to be executed
 * @throws BrowseException
 */
private String buildDistinctQuery(List params) throws BrowseException {
  StringBuffer queryBuf=new StringBuffer();
  if (!buildSelectListCount(queryBuf)) {
    if (!buildSelectListValues(queryBuf)) {
      throw new BrowseException("String_Node_Str");
    }
  }
  buildSelectStatementDistinct(queryBuf,params);
  buildWhereClauseOpReset();
  buildWhereClauseJumpTo(queryBuf,params);
  buildWhereClauseDistinctConstraints(queryBuf,params);
  buildOrderBy(queryBuf);
  buildRowLimitAndOffset(queryBuf,params);
  return queryBuf.toString();
}
Program: 52415
Project: 52415
Buggy source:
/** 
 * Return a normalized focus value. If there is no normalization that can be performed, return the focus value that is passed in.
 * @param value a focus value to normalize
 * @return  the normalized focus value
 * @throws BrowseException
 */
private String normalizeJumpToValue(String value) throws BrowseException {
  if (scope.hasJumpToValue()) {
    return OrderFormat.makeSortString(scope.getJumpToValue(),scope.setJumpToValueLang(),scope.getBrowseIndex().getDataType());
  }
 else   if (scope.hasStartsWith()) {
    return OrderFormat.makeSortString(scope.getStartsWith(),null,scope.getBrowseIndex().getDataType());
  }
  return value;
}

Fixed version (ground truth):
/** 
 * Return a normalized focus value. If there is no normalization that can be performed, return the focus value that is passed in.
 * @param value a focus value to normalize
 * @return  the normalized focus value
 * @throws BrowseException
 */
private String normalizeJumpToValue(String value) throws BrowseException {
  if (scope.hasJumpToValue()) {
    return OrderFormat.makeSortString(scope.getJumpToValue(),scope.getJumpToValueLang(),scope.getBrowseIndex().getDataType());
  }
 else   if (scope.hasStartsWith()) {
    return OrderFormat.makeSortString(scope.getStartsWith(),null,scope.getBrowseIndex().getDataType());
  }
  return value;
}
Program: 52420
Project: 52420
Buggy source:
/** 
 * Create a new instance of the Browse engine, using the given DSpace Context object.  This will automatically assign a Data Access Object for the Browse Engine, based on the dspace.cfg setting for db.name
 * @param context		the DSpace context
 * @throws BrowseException
 */
public BrowseEngine(Context context) throws BrowseException {
  this.context=context;
  dao=BrowseDAOFactory.getInstance(context);
}

Fixed version (ground truth):
/** 
 * Create a new instance of the Browse engine, using the given DSpace Context object.  This will automatically assign a Data Access Object for the Browse Engine, based on the dspace.cfg setting for db.name
 * @param context       the DSpace context
 * @throws BrowseException
 */
public BrowseEngine(Context context) throws BrowseException {
  this.context=context;
  dao=BrowseDAOFactory.getInstance(context);
}
Program: 52421
Project: 52421
Buggy source:
/** 
 * Get the total number of results.  The argument determines whether this is a distinct browse or not as this has an impact on how results are counted
 * @param distinct	is this a distinct browse or not
 * @return			the total number of results available in this type of browse
 * @throws SQLException
 * @throws BrowseException
 */
private int getTotalResults(boolean distinct) throws SQLException, BrowseException {
  log.debug(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + distinct));
  String tableName=browseIndex.getTableName(distinct,scope.inCommunity(),scope.inCollection());
  dao.setDistinct(distinct);
  String[] select={"String_Node_Str"};
  dao.setCountValues(select);
  String focusField=dao.getJumpToField();
  String focusValue=dao.getJumpToValue();
  String orderField=dao.getOrderField();
  int limit=dao.getLimit();
  int offset=dao.getOffset();
  dao.setJumpToField(null);
  dao.setJumpToValue(null);
  dao.setOrderField(null);
  dao.setLimit(-1);
  dao.setOffset(-1);
  int count=dao.doCountQuery();
  dao.setJumpToField(focusField);
  dao.setJumpToValue(focusValue);
  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 total number of results.  The argument determines whether this is a distinct browse or not as this has an impact on how results are counted
 * @param distinct  is this a distinct browse or not
 * @return          the total number of results available in this type of browse
 * @throws SQLException
 * @throws BrowseException
 */
private int getTotalResults(boolean distinct) throws SQLException, BrowseException {
  log.debug(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + distinct));
  dao.setDistinct(distinct);
  String[] select={"String_Node_Str"};
  dao.setCountValues(select);
  String focusField=dao.getJumpToField();
  String focusValue=dao.getJumpToValue();
  String orderField=dao.getOrderField();
  int limit=dao.getLimit();
  int offset=dao.getOffset();
  dao.setJumpToField(null);
  dao.setJumpToValue(null);
  dao.setOrderField(null);
  dao.setLimit(-1);
  dao.setOffset(-1);
  int count=dao.doCountQuery();
  dao.setJumpToField(focusField);
  dao.setJumpToValue(focusValue);
  dao.setOrderField(orderField);
  dao.setLimit(limit);
  dao.setOffset(offset);
  log.debug(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + count));
  return count;
}
Program: 52423
Project: 52423
Buggy source:
/** 
 * Return the focus value.
 * @return	the focus value to use
 * @throws BrowseException
 */
private String getJumpToValue() throws BrowseException {
  log.debug(LogManager.getHeader(context,"String_Node_Str","String_Node_Str"));
  if (scope.hasJumpToValue()) {
    log.debug(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + scope.getJumpToValue()));
    return scope.getJumpToValue();
  }
  if (scope.hasStartsWith()) {
    log.debug(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + scope.getStartsWith()));
    return scope.getStartsWith();
  }
  int id=scope.getJumpToItem();
  String tableName=browseIndex.getTableName();
  SortOption so=scope.getSortOption();
  if (so == null || so.getNumber() == 0) {
    if (browseIndex.getSortOption() != null)     so=browseIndex.getSortOption();
  }
  String col="String_Node_Str";
  if (so.getNumber() > 0) {
    col="String_Node_Str" + Integer.toString(so.getNumber());
  }
  String max=dao.doMaxQuery(col,tableName,id);
  log.debug(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + max));
  return max;
}

Fixed version (ground truth):
/** 
 * Return the focus value.
 * @return  the focus value to use
 * @throws BrowseException
 */
private String getJumpToValue() throws BrowseException {
  log.debug(LogManager.getHeader(context,"String_Node_Str","String_Node_Str"));
  if (scope.hasJumpToValue()) {
    log.debug(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + scope.getJumpToValue()));
    return scope.getJumpToValue();
  }
  if (scope.hasStartsWith()) {
    log.debug(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + scope.getStartsWith()));
    return scope.getStartsWith();
  }
  int id=scope.getJumpToItem();
  String tableName=browseIndex.getTableName();
  SortOption so=scope.getSortOption();
  if (so == null || so.getNumber() == 0) {
    if (browseIndex.getSortOption() != null)     so=browseIndex.getSortOption();
  }
  String col="String_Node_Str";
  if (so.getNumber() > 0) {
    col="String_Node_Str" + Integer.toString(so.getNumber());
  }
  String max=dao.doMaxQuery(col,tableName,id);
  log.debug(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + max));
  return max;
}
Program: 52425
Project: 52425
Buggy source:
/** 
 * Perform a standard browse, which will return a BrowseInfo object that represents the results for the current page, the total number of results, the range, and information to construct previous and next links on any web page
 * @param bs	the scope of the browse
 * @return		the results of the browse
 * @throws BrowseException
 */
public BrowseInfo browse(BrowserScope bs) throws BrowseException {
  log.debug(LogManager.getHeader(context,"String_Node_Str","String_Node_Str"));
  this.scope=bs;
  browseIndex=scope.getBrowseIndex();
  if (browseIndex.isMetadataIndex() && !scope.isSecondLevel()) {
    return browseByValue(scope);
  }
 else {
    return browseByItem(scope);
  }
}

Fixed version (ground truth):
/** 
 * Perform a standard browse, which will return a BrowseInfo object that represents the results for the current page, the total number of results, the range, and information to construct previous and next links on any web page
 * @param bs    the scope of the browse
 * @return      the results of the browse
 * @throws BrowseException
 */
public BrowseInfo browse(BrowserScope bs) throws BrowseException {
  log.debug(LogManager.getHeader(context,"String_Node_Str","String_Node_Str"));
  this.scope=bs;
  browseIndex=scope.getBrowseIndex();
  if (browseIndex.isMetadataIndex() && !scope.isSecondLevel()) {
    return browseByValue(scope);
  }
 else {
    return browseByItem(scope);
  }
}
Program: 52426
Project: 52426
Buggy source:
/** 
 * Are there results prior to these that haven't been returned here?
 * @return	true if previous page, false if not
 */
public boolean hasPrevPage(){
  if (!"String_Node_Str".equals(prevValue) && (prevValue != null)) {
    return true;
  }
  if (prevItem != -1) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Are there results prior to these that haven't been returned here?
 * @return	true if previous page, false if not
 */
public boolean hasPrevPage(){
  if (offset > 0) {
    return true;
  }
  return false;
}
Program: 52427
Project: 52427
Buggy source:
/** 
 * Does this browse have an item focus (as opposed to one of: no focus,  a value focus)
 * @return	true if item focus, false if not
 */
public boolean hasItemFocus(){
  if (focusItem == -1) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Does this browse have an item focus (as opposed to one of: no focus, a value focus)
 * @return	true if item focus, false if not
 */
public boolean hasItemFocus(){
  if (focusItem == -1) {
    return false;
  }
  return true;
}
Program: 52428
Project: 52428
Buggy source:
/** 
 * Are there further results for the browse that haven't been returned yet?
 * @return	true if next page, false if not
 */
public boolean hasNextPage(){
  if (!"String_Node_Str".equals(nextValue) && (nextValue != null)) {
    return true;
  }
  if (nextItem != -1) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Are there further results for the browse that haven't been returned yet?
 * @return	true if next page, false if not
 */
public boolean hasNextPage(){
  if (nextOffset > -1) {
    return true;
  }
  return false;
}
Program: 52430
Project: 52430
Buggy source:
/** 
 * @return	true if in collection, false if not
 */
public boolean inCollection(){
  if (this.collection != null) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * @return  true if in collection, false if not
 */
public boolean inCollection(){
  if (this.collection != null) {
    return true;
  }
  return false;
}
Program: 52431
Project: 52431
Buggy source:
/** 
 * @return	true if has item focus, false if not
 */
public boolean hasJumpToItem(){
  if (jumpItemId == -1) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * @return  true if has item focus, false if not
 */
public boolean hasJumpToItem(){
  if (jumpItemId == -1) {
    return false;
  }
  return true;
}
Program: 52432
Project: 52432
Buggy source:
/** 
 * Obtain a DSpaceObject that represents the container object.  This will be a Community or a Collection
 * @return	A DSpaceObject representing a Community or a Collection
 */
public DSpaceObject getBrowseContainer(){
  if (this.collection != null) {
    return this.collection;
  }
  if (this.community != null) {
    return this.community;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Obtain a DSpaceObject that represents the container object.  This will be a Community or a Collection
 * @return  A DSpaceObject representing a Community or a Collection
 */
public DSpaceObject getBrowseContainer(){
  if (this.collection != null) {
    return this.collection;
  }
  if (this.community != null) {
    return this.community;
  }
  return null;
}
Program: 52433
Project: 52433
Buggy source:
/** 
 * @return	true if has value focus, false if not
 */
public boolean hasJumpToValue(){
  if (this.jumpValue != null) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * @return  true if has value focus, false if not
 */
public boolean hasJumpToValue(){
  if (this.jumpValue != null) {
    return true;
  }
  return false;
}
Program: 52434
Project: 52434
Buggy source:
/** 
 * @return	true if has starts with value, false if not
 */
public boolean hasStartsWith(){
  if (this.startsWith != null) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * @return  true if has starts with value, false if not
 */
public boolean hasStartsWith(){
  if (this.startsWith != null) {
    return true;
  }
  return false;
}
Program: 52435
Project: 52435
Buggy source:
/** 
 * Set the DSpaceObject that is the container for this browse.  If this is not of type Collection or Community, this method will throw an exception
 * @param dso		the container object; a Community or Collection
 * @throws BrowseException
 */
public void setBrowseContainer(DSpaceObject dso) throws BrowseException {
  if (dso instanceof Collection) {
    this.collection=(Collection)dso;
  }
 else   if (dso instanceof Community) {
    this.community=(Community)dso;
  }
 else {
    throw new BrowseException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Set the DSpaceObject that is the container for this browse.  If this is not of type Collection or Community, this method will throw an exception
 * @param dso       the container object; a Community or Collection
 * @throws BrowseException
 */
public void setBrowseContainer(DSpaceObject dso) throws BrowseException {
  if (dso instanceof Collection) {
    this.collection=(Collection)dso;
  }
 else   if (dso instanceof Community) {
    this.community=(Community)dso;
  }
 else {
    throw new BrowseException("String_Node_Str");
  }
}
Program: 52436
Project: 52436
Buggy source:
/** 
 * @return	true if second level browse, false if not
 */
public boolean isSecondLevel(){
  if (this.level == 1) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * @return  true if second level browse, false if not
 */
public boolean isSecondLevel(){
  if (this.level == 1) {
    return true;
  }
  return false;
}
Program: 52437
Project: 52437
Buggy source:
/** 
 * @return	true if in community, false if not
 */
public boolean inCommunity(){
  if (this.community != null) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * @return  true if in community, false if not
 */
public boolean inCommunity(){
  if (this.community != null) {
    return true;
  }
  return false;
}
Program: 52438
Project: 52438
Buggy source:
/** 
 * Obtain the sort option
 * @return	the sort option
 * @throws BrowseException
 */
public SortOption getSortOption() throws BrowseException {
  try {
    if (sortOption == null) {
      if (browseIndex != null) {
        if (sortBy <= 0 && browseIndex.isMetadataIndex()) {
          String dataType=browseIndex.getDataType();
          String type=("String_Node_Str".equals(dataType) ? "String_Node_Str" : "String_Node_Str");
          sortOption=new SortOption(0,browseIndex.getName(),browseIndex.getMetadata(0),type);
        }
 else {
          if (sortBy <= 0) {
            sortOption=browseIndex.getSortOption();
            if (sortOption == null) {
              for (              SortOption so : SortOption.getSortOptions()) {
                sortOption=so;
                break;
              }
            }
          }
 else {
            for (            SortOption so : SortOption.getSortOptions()) {
              if (so.getNumber() == sortBy)               sortOption=so;
            }
          }
        }
      }
    }
    return sortOption;
  }
 catch (  SortException se) {
    throw new BrowseException("String_Node_Str",se);
  }
}

Fixed version (ground truth):
/** 
 * Obtain the sort option
 * @return  the sort option
 * @throws BrowseException
 */
public SortOption getSortOption() throws BrowseException {
  try {
    if (sortOption == null) {
      if (browseIndex != null) {
        if (sortBy <= 0 && browseIndex.isMetadataIndex()) {
          String dataType=browseIndex.getDataType();
          String type=("String_Node_Str".equals(dataType) ? "String_Node_Str" : "String_Node_Str");
          sortOption=new SortOption(0,browseIndex.getName(),browseIndex.getMetadata(0),type);
        }
 else {
          if (sortBy <= 0) {
            sortOption=browseIndex.getSortOption();
            if (sortOption == null) {
              for (              SortOption so : SortOption.getSortOptions()) {
                sortOption=so;
                break;
              }
            }
          }
 else {
            for (            SortOption so : SortOption.getSortOptions()) {
              if (so.getNumber() == sortBy)               sortOption=so;
            }
          }
        }
      }
    }
    return sortOption;
  }
 catch (  SortException se) {
    throw new BrowseException("String_Node_Str",se);
  }
}
Program: 52439
Project: 52439
Buggy source:
/** 
 * Used for second-level item browses, to only display items that match the value 
 * @return Returns the value.
 */
public String getFilterValue(){
  return filterValue;
}

Fixed version (ground truth):
/** 
 * Used for second-level item browses, to only display items that match the value
 * @return Returns the value.
 */
public String getFilterValue(){
  return filterValue;
}
Program: 52440
Project: 52440
Buggy source:
/** 
 * @param level		the browse level
 */
public void setBrowseLevel(int level){
  this.level=level;
}

Fixed version (ground truth):
/** 
 * @param level     the browse level
 */
public void setBrowseLevel(int level){
  this.level=level;
}
Program: 52441
Project: 52441
Buggy source:
/** 
 * @param value		the value to focus on
 */
public void setJumpToValue(String value){
  this.jumpValue=value;
}

Fixed version (ground truth):
/** 
 * @param value     the value to focus on
 */
public void setJumpToValue(String value){
  this.jumpValue=value;
}
Program: 52442
Project: 52442
Buggy source:
/** 
 * @return	the value to focus on
 */
public String getJumpToValue(){
  return jumpValue;
}

Fixed version (ground truth):
/** 
 * @return  the value to focus on
 */
public String getJumpToValue(){
  return jumpValue;
}
Program: 52443
Project: 52443
Buggy source:
/** 
 * @return	the browse level
 */
public int getBrowseLevel(){
  return this.level;
}

Fixed version (ground truth):
/** 
 * @return  the browse level
 */
public int getBrowseLevel(){
  return this.level;
}
Program: 52444
Project: 52444
Buggy source:
/** 
 * @return	true if ascending, false if not - or not set
 */
public boolean isAscending(){
  if (SortOption.ASCENDING.equalsIgnoreCase(order)) {
    return true;
  }
  if (SortOption.DESCENDING.equalsIgnoreCase(order)) {
    return false;
  }
  BrowseIndex bi=getBrowseIndex();
  if (bi != null && SortOption.DESCENDING.equalsIgnoreCase(bi.getDefaultOrder()))   return false;
  return true;
}

Fixed version (ground truth):
/** 
 * @return  true if ascending, false if not - or not set
 */
public boolean isAscending(){
  if (SortOption.ASCENDING.equalsIgnoreCase(order)) {
    return true;
  }
  if (SortOption.DESCENDING.equalsIgnoreCase(order)) {
    return false;
  }
  BrowseIndex bi=getBrowseIndex();
  if (bi != null && SortOption.DESCENDING.equalsIgnoreCase(bi.getDefaultOrder()))   return false;
  return true;
}
Program: 52445
Project: 52445
Buggy source:
/** 
 * @return	true if has value, false if not
 */
public boolean hasFilterValue(){
  if (filterValue == null || "String_Node_Str".equals(filterValue)) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * @return  true if has value, false if not
 */
public boolean hasFilterValue(){
  if (filterValue == null || "String_Node_Str".equals(filterValue)) {
    return false;
  }
  return true;
}
Program: 52446
Project: 52446
Buggy source:
/** 
 * Construct a new BrowserScope using the given Context 
 * @param context	the DSpace Context
 */
public BrowserScope(Context context){
  this.context=context;
}

Fixed version (ground truth):
/** 
 * Construct a new BrowserScope using the given Context
 * @param context   the DSpace Context
 */
public BrowserScope(Context context){
  this.context=context;
}
Program: 52447
Project: 52447
Buggy source:
/** 
 * Used for second-level item browses, to only display items that match the value 
 * @param value The value to set.
 */
public void setFilterValue(String value){
  this.filterValue=value;
}

Fixed version (ground truth):
/** 
 * Used for second-level item browses, to only display items that match the value
 * @param value The value to set.
 */
public void setFilterValue(String value){
  this.filterValue=value;
}
Program: 52449
Project: 52449
Buggy source:
/** 
 * Display the single page.  This is the page which lists just the single values of a  metadata browse, not individual items.  Single values are links through to all the items that match that metadata value
 * @param context
 * @param request
 * @param response
 * @throws ServletException
 * @throws IOException
 * @throws SQLException
 * @throws AuthorizeException
 */
protected abstract void showSinglePage(Context context,HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException, SQLException, AuthorizeException ;

Fixed version (ground truth):
/** 
 * Display the single page.  This is the page which lists just the single values of a metadata browse, not individual items.  Single values are links through to all the items that match that metadata value
 * @param context
 * @param request
 * @param response
 * @throws ServletException
 * @throws IOException
 * @throws SQLException
 * @throws AuthorizeException
 */
protected abstract void showSinglePage(Context context,HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException, SQLException, AuthorizeException ;
Program: 52452
Project: 52452
Buggy source:
/** 
 * Return the focus value.
 * @return	the focus value to use
 * @throws BrowseException
 */
private String getJumpToValue() throws BrowseException {
  log.debug(LogManager.getHeader(context,"String_Node_Str","String_Node_Str"));
  if (scope.hasJumpToValue()) {
    log.debug(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + scope.getJumpToValue()));
    return scope.getJumpToValue();
  }
  if (scope.hasStartsWith()) {
    log.debug(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + scope.getStartsWith()));
    return scope.getStartsWith();
  }
  int id=scope.getJumpToItem();
  String tableName=browseIndex.getTableName();
  SortOption so=scope.getSortOption();
  String col="String_Node_Str";
  if (so.getNumber() > 0) {
    col="String_Node_Str" + Integer.toString(so.getNumber());
  }
  String max=dao.doMaxQuery(col,tableName,id);
  log.debug(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + max));
  return max;
}

Fixed version (ground truth):
/** 
 * Return the focus value.
 * @return	the focus value to use
 * @throws BrowseException
 */
private String getJumpToValue() throws BrowseException {
  log.debug(LogManager.getHeader(context,"String_Node_Str","String_Node_Str"));
  if (scope.hasJumpToValue()) {
    log.debug(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + scope.getJumpToValue()));
    return scope.getJumpToValue();
  }
  if (scope.hasStartsWith()) {
    log.debug(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + scope.getStartsWith()));
    return scope.getStartsWith();
  }
  int id=scope.getJumpToItem();
  String tableName=browseIndex.getTableName();
  SortOption so=scope.getSortOption();
  if (so == null || so.getNumber() == 0) {
    if (browseIndex.getSortOption() != null)     so=browseIndex.getSortOption();
  }
  String col="String_Node_Str";
  if (so.getNumber() > 0) {
    col="String_Node_Str" + Integer.toString(so.getNumber());
  }
  String max=dao.doMaxQuery(col,tableName,id);
  log.debug(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + max));
  return max;
}
Program: 52458
Project: 52458
Buggy source:
/** 
 * Return the focus value.
 * @return	the focus value to use
 * @throws BrowseException
 */
private String getJumpToValue() throws BrowseException {
  log.debug(LogManager.getHeader(context,"String_Node_Str","String_Node_Str"));
  if (scope.hasJumpToValue()) {
    log.debug(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + scope.getJumpToValue()));
    return scope.getJumpToValue();
  }
  if (scope.hasStartsWith()) {
    log.debug(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + scope.getStartsWith()));
    return scope.getStartsWith();
  }
  int id=scope.getJumpToItem();
  String tableName=browseIndex.getTableName();
  SortOption so=scope.getSortOption();
  String col="String_Node_Str";
  if (so.getNumber() > 0) {
    col="String_Node_Str" + Integer.toString(so.getNumber());
  }
  String max=dao.doMaxQuery(col,tableName,id);
  log.debug(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + max));
  return max;
}

Fixed version (ground truth):
/** 
 * Return the focus value.
 * @return	the focus value to use
 * @throws BrowseException
 */
private String getJumpToValue() throws BrowseException {
  log.debug(LogManager.getHeader(context,"String_Node_Str","String_Node_Str"));
  if (scope.hasJumpToValue()) {
    log.debug(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + scope.getJumpToValue()));
    return scope.getJumpToValue();
  }
  if (scope.hasStartsWith()) {
    log.debug(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + scope.getStartsWith()));
    return scope.getStartsWith();
  }
  int id=scope.getJumpToItem();
  String tableName=browseIndex.getTableName();
  SortOption so=scope.getSortOption();
  if (so == null || so.getNumber() == 0) {
    if (browseIndex.getSortOption() != null)     so=browseIndex.getSortOption();
  }
  String col="String_Node_Str";
  if (so.getNumber() > 0) {
    col="String_Node_Str" + Integer.toString(so.getNumber());
  }
  String max=dao.doMaxQuery(col,tableName,id);
  log.debug(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + max));
  return max;
}
Program: 52465
Project: 52465
Buggy source:
/** 
 * Get the field for sorting associated with this index
 * @return
 * @throws BrowseException
 */
public String getSortField() throws BrowseException {
  String focusField;
  if (isMetadataIndex()) {
    focusField="String_Node_Str";
  }
 else {
    if (sortOption != null)     focusField="String_Node_Str" + sortOption.getNumber();
 else     focusField="String_Node_Str";
  }
  return focusField;
}

Fixed version (ground truth):
/** 
 * Get the field for sorting associated with this index
 * @return
 * @throws BrowseException
 */
public String getSortField(boolean isSecondLevel) throws BrowseException {
  String focusField;
  if (isMetadataIndex() && !isSecondLevel) {
    focusField="String_Node_Str";
  }
 else {
    if (sortOption != null)     focusField="String_Node_Str" + sortOption.getNumber();
 else     focusField="String_Node_Str";
  }
  return focusField;
}
Program: 52469
Project: 52469
Buggy source:
/** 
 * Get the field for sorting associated with this index
 * @return
 * @throws BrowseException
 */
public String getSortField() throws BrowseException {
  String focusField;
  if (isMetadataIndex()) {
    focusField="String_Node_Str";
  }
 else {
    if (sortOption != null)     focusField="String_Node_Str" + sortOption.getNumber();
 else     focusField="String_Node_Str";
  }
  return focusField;
}

Fixed version (ground truth):
/** 
 * Get the field for sorting associated with this index
 * @return
 * @throws BrowseException
 */
public String getSortField(boolean isSecondLevel) throws BrowseException {
  String focusField;
  if (isMetadataIndex() && !isSecondLevel) {
    focusField="String_Node_Str";
  }
 else {
    if (sortOption != null)     focusField="String_Node_Str" + sortOption.getNumber();
 else     focusField="String_Node_Str";
  }
  return focusField;
}
Program: 52471
Project: 52471
Buggy source:
/** 
 * Get a sub-query to obtain the ids for a distinct browse within a given constraint.  This will produce something of the form: <code> id IN (SELECT distinct_id FROM [container table] WHERE [container field] = [container id]) </code> This is for use inside the overall WHERE clause only
 * @return  the sub-query
 */
private void buildWhereClauseDistinctConstraints(StringBuffer queryBuf,List params){
  if (containerIDField != null && containerID != -1 && containerTable != null) {
    buildWhereClauseOpInsert(queryBuf);
    queryBuf.append("String_Node_Str");
    queryBuf.append(containerTable);
    queryBuf.append("String_Node_Str");
    queryBuf.append(containerIDField);
    queryBuf.append("String_Node_Str" + table + "String_Node_Str");
    params.add(new Integer(containerID));
  }
}

Fixed version (ground truth):
/** 
 * Get a sub-query to obtain the ids for a distinct browse within a given constraint.  This will produce something of the form: <code> id IN (SELECT distinct_id FROM [container table] WHERE [container field] = [container id]) </code> This is for use inside the overall WHERE clause only
 * @return  the sub-query
 */
private void buildWhereClauseDistinctConstraints(StringBuffer queryBuf,List params){
  if (containerIDField != null && containerID != -1 && containerTable != null) {
    buildWhereClauseOpInsert(queryBuf);
    queryBuf.append("String_Node_Str");
    buildFocusedSelectTables(queryBuf);
    queryBuf.append("String_Node_Str");
    buildFocusedSelectClauses(queryBuf,params);
    queryBuf.append("String_Node_Str" + table + "String_Node_Str");
  }
}
Program: 52472
Project: 52472
Buggy source:
/** 
 * Get the count of the items in the given container.  If the configuration value webui.strengths.cache is equal to 'true' this will return the cached value if it exists.  If it is equal to 'false' it will count the number of items in the container in real time
 * @param dso
 * @return
 * @throws ItemCountException
 * @throws SQLException 
 */
public int getCount(DSpaceObject dso) throws ItemCountException {
  boolean useCache=ConfigurationManager.getBooleanProperty("String_Node_Str");
  if (useCache) {
    return dao.getCount(dso);
  }
  if (dso instanceof Collection) {
    return ((Collection)dso).countItems();
  }
  if (dso instanceof Community) {
    return ((Collection)dso).countItems();
  }
  return 0;
}

Fixed version (ground truth):
/** 
 * Get the count of the items in the given container.  If the configuration value webui.strengths.cache is equal to 'true' this will return the cached value if it exists.  If it is equal to 'false' it will count the number of items in the container in real time
 * @param dso
 * @return
 * @throws ItemCountException
 * @throws SQLException 
 */
public int getCount(DSpaceObject dso) throws ItemCountException {
  boolean useCache=ConfigurationManager.getBooleanProperty("String_Node_Str");
  if (useCache) {
    return dao.getCount(dso);
  }
  if (dso instanceof Collection) {
    return ((Collection)dso).countItems();
  }
  if (dso instanceof Community) {
    return ((Community)dso).countItems();
  }
  return 0;
}
Program: 52473
Project: 52473
Buggy source:
/** 
 * Create Lucene document with all the shared fields initialized.
 * @param type Type of DSpace Object
 * @param id
 * @param uri
 * @param location
 * @return
 */
private static Document buildDocument(int type,int id,String uri,String location){
  Document doc=new Document();
  doc.add(new Field(LAST_INDEXED_FIELD,Long.toString(System.currentTimeMillis()),Field.Store.YES,Field.Index.UN_TOKENIZED));
  doc.add(new Field("String_Node_Str",Integer.toString(type),Field.Store.YES,Field.Index.NO));
  doc.add(new Field("String_Node_Str",Integer.toString(type),Field.Store.YES,Field.Index.NO));
  doc.add(new Field("String_Node_Str",Integer.toString(id),Field.Store.YES,Field.Index.NO));
  if (uri != null) {
    doc.add(new Field("String_Node_Str",uri,Field.Store.YES,Field.Index.TOKENIZED));
    doc.add(new Field("String_Node_Str",uri,Field.Store.YES,Field.Index.UN_TOKENIZED));
    doc.add(new Field("String_Node_Str",uri,Field.Store.NO,Field.Index.TOKENIZED));
  }
  if (location != null) {
    doc.add(new Field("String_Node_Str",location,Field.Store.NO,Field.Index.TOKENIZED));
    doc.add(new Field("String_Node_Str",location,Field.Store.NO,Field.Index.TOKENIZED));
  }
  return doc;
}

Fixed version (ground truth):
/** 
 * Create Lucene document with all the shared fields initialized.
 * @param type Type of DSpace Object
 * @param id
 * @param uri
 * @param location
 * @return
 */
private static Document buildDocument(int type,int id,String uri,String location){
  Document doc=new Document();
  doc.add(new Field(LAST_INDEXED_FIELD,Long.toString(System.currentTimeMillis()),Field.Store.YES,Field.Index.UN_TOKENIZED));
  doc.add(new Field("String_Node_Str",Integer.toString(type),Field.Store.YES,Field.Index.NO));
  doc.add(new Field("String_Node_Str",Integer.toString(type),Field.Store.YES,Field.Index.UN_TOKENIZED));
  doc.add(new Field("String_Node_Str",Integer.toString(id),Field.Store.YES,Field.Index.NO));
  if (uri != null) {
    doc.add(new Field("String_Node_Str",uri,Field.Store.YES,Field.Index.TOKENIZED));
    doc.add(new Field("String_Node_Str",uri,Field.Store.YES,Field.Index.UN_TOKENIZED));
    doc.add(new Field("String_Node_Str",uri,Field.Store.NO,Field.Index.TOKENIZED));
  }
  if (location != null) {
    doc.add(new Field("String_Node_Str",location,Field.Store.NO,Field.Index.TOKENIZED));
    doc.add(new Field("String_Node_Str",location,Field.Store.NO,Field.Index.TOKENIZED));
  }
  return doc;
}
Program: 52474
Project: 52474
Buggy source:
/** 
 * Read metadata about a table from the database.
 * @param table The RDBMS table.
 * @return A map of information about the columns. The key is the name ofthe column, a String; the value is a ColumnInfo object.
 * @exception SQLException If there is a problem retrieving information from the RDBMS.
 */
private static Map retrieveColumnInfo(String table) throws SQLException {
  Connection connection=null;
  try {
    connection=getConnection();
    DatabaseMetaData metadata=connection.getMetaData();
    HashMap results=new HashMap();
    int max=metadata.getMaxTableNameLength();
    String tname=(table.length() >= max) ? table.substring(0,max - 1) : table;
    ResultSet pkcolumns=metadata.getPrimaryKeys(null,null,tname);
    Set pks=new HashSet();
    while (pkcolumns.next())     pks.add(pkcolumns.getString(4));
    ResultSet columns=metadata.getColumns(null,null,tname,null);
    while (columns.next()) {
      String column=columns.getString(4);
      ColumnInfo cinfo=new ColumnInfo();
      cinfo.setName(column);
      cinfo.setType((int)columns.getShort(5));
      if (pks.contains(column)) {
        cinfo.setIsPrimaryKey(true);
      }
      results.put(column,cinfo);
    }
    return results;
  }
  finally {
    if (connection != null) {
      connection.close();
    }
  }
}

Fixed version (ground truth):
/** 
 * Read metadata about a table from the database.
 * @param table The RDBMS table.
 * @return A map of information about the columns. The key is the name ofthe column, a String; the value is a ColumnInfo object.
 * @exception SQLException If there is a problem retrieving information from the RDBMS.
 */
private static Map retrieveColumnInfo(String table) throws SQLException {
  Connection connection=null;
  try {
    String schema=ConfigurationManager.getProperty("String_Node_Str");
    connection=getConnection();
    DatabaseMetaData metadata=connection.getMetaData();
    HashMap results=new HashMap();
    int max=metadata.getMaxTableNameLength();
    String tname=(table.length() >= max) ? table.substring(0,max - 1) : table;
    ResultSet pkcolumns=metadata.getPrimaryKeys(null,schema,tname);
    Set pks=new HashSet();
    while (pkcolumns.next())     pks.add(pkcolumns.getString(4));
    ResultSet columns=metadata.getColumns(null,schema,tname,null);
    while (columns.next()) {
      String column=columns.getString(4);
      ColumnInfo cinfo=new ColumnInfo();
      cinfo.setName(column);
      cinfo.setType((int)columns.getShort(5));
      if (pks.contains(column)) {
        cinfo.setIsPrimaryKey(true);
      }
      results.put(column,cinfo);
    }
    return results;
  }
  finally {
    if (connection != null) {
      connection.close();
    }
  }
}
Program: 52475
Project: 52475
Buggy source:
/** 
 * Read metadata about a table from the database.
 * @param table The RDBMS table.
 * @return A map of information about the columns. The key is the name ofthe column, a String; the value is a ColumnInfo object.
 * @exception SQLException If there is a problem retrieving information from the RDBMS.
 */
private static Map retrieveColumnInfo(String table) throws SQLException {
  Connection connection=null;
  try {
    connection=getConnection();
    DatabaseMetaData metadata=connection.getMetaData();
    HashMap results=new HashMap();
    int max=metadata.getMaxTableNameLength();
    String tname=(table.length() >= max) ? table.substring(0,max - 1) : table;
    ResultSet pkcolumns=metadata.getPrimaryKeys(null,null,tname);
    Set pks=new HashSet();
    while (pkcolumns.next())     pks.add(pkcolumns.getString(4));
    ResultSet columns=metadata.getColumns(null,null,tname,null);
    while (columns.next()) {
      String column=columns.getString(4);
      ColumnInfo cinfo=new ColumnInfo();
      cinfo.setName(column);
      cinfo.setType((int)columns.getShort(5));
      if (pks.contains(column)) {
        cinfo.setIsPrimaryKey(true);
      }
      results.put(column,cinfo);
    }
    return results;
  }
  finally {
    if (connection != null) {
      connection.close();
    }
  }
}

Fixed version (ground truth):
/** 
 * Read metadata about a table from the database.
 * @param table The RDBMS table.
 * @return A map of information about the columns. The key is the name ofthe column, a String; the value is a ColumnInfo object.
 * @exception SQLException If there is a problem retrieving information from the RDBMS.
 */
private static Map retrieveColumnInfo(String table) throws SQLException {
  Connection connection=null;
  try {
    String schema=ConfigurationManager.getProperty("String_Node_Str");
    connection=getConnection();
    DatabaseMetaData metadata=connection.getMetaData();
    HashMap results=new HashMap();
    int max=metadata.getMaxTableNameLength();
    String tname=(table.length() >= max) ? table.substring(0,max - 1) : table;
    ResultSet pkcolumns=metadata.getPrimaryKeys(null,schema,tname);
    Set pks=new HashSet();
    while (pkcolumns.next())     pks.add(pkcolumns.getString(4));
    ResultSet columns=metadata.getColumns(null,schema,tname,null);
    while (columns.next()) {
      String column=columns.getString(4);
      ColumnInfo cinfo=new ColumnInfo();
      cinfo.setName(column);
      cinfo.setType((int)columns.getShort(5));
      if (pks.contains(column)) {
        cinfo.setIsPrimaryKey(true);
      }
      results.put(column,cinfo);
    }
    return results;
  }
  finally {
    if (connection != null) {
      connection.close();
    }
  }
}
Program: 52476
Project: 52476
Buggy source:
/** 
 * Create Lucene document with all the shared fields initialized.
 * @param type Type of DSpace Object
 * @param id
 * @param handle
 * @param location @return
 */
private static Document buildDocument(int type,int id,String handle,String location){
  Document doc=new Document();
  doc.add(new Field(LAST_INDEXED_FIELD,Long.toString(System.currentTimeMillis()),Field.Store.YES,Field.Index.UN_TOKENIZED));
  doc.add(new Field("String_Node_Str",Integer.toString(type),Field.Store.YES,Field.Index.NO));
  doc.add(new Field("String_Node_Str",Integer.toString(type),Field.Store.YES,Field.Index.NO));
  doc.add(new Field("String_Node_Str",Integer.toString(id),Field.Store.YES,Field.Index.NO));
  if (handle != null) {
    doc.add(new Field("String_Node_Str",handle,Field.Store.YES,Field.Index.TOKENIZED));
    doc.add(new Field("String_Node_Str",handle,Field.Store.YES,Field.Index.UN_TOKENIZED));
    doc.add(new Field("String_Node_Str",handle,Field.Store.NO,Field.Index.TOKENIZED));
  }
  if (location != null) {
    doc.add(new Field("String_Node_Str",location,Field.Store.NO,Field.Index.TOKENIZED));
    doc.add(new Field("String_Node_Str",location,Field.Store.NO,Field.Index.TOKENIZED));
  }
  return doc;
}

Fixed version (ground truth):
/** 
 * Create Lucene document with all the shared fields initialized.
 * @param type Type of DSpace Object
 * @param id
 * @param handle
 * @param location @return
 */
private static Document buildDocument(int type,int id,String handle,String location){
  Document doc=new Document();
  doc.add(new Field(LAST_INDEXED_FIELD,Long.toString(System.currentTimeMillis()),Field.Store.YES,Field.Index.UN_TOKENIZED));
  doc.add(new Field("String_Node_Str",Integer.toString(type),Field.Store.YES,Field.Index.NO));
  doc.add(new Field("String_Node_Str",Integer.toString(type),Field.Store.YES,Field.Index.UN_TOKENIZED));
  doc.add(new Field("String_Node_Str",Integer.toString(id),Field.Store.YES,Field.Index.NO));
  if (handle != null) {
    doc.add(new Field("String_Node_Str",handle,Field.Store.YES,Field.Index.TOKENIZED));
    doc.add(new Field("String_Node_Str",handle,Field.Store.YES,Field.Index.UN_TOKENIZED));
    doc.add(new Field("String_Node_Str",handle,Field.Store.NO,Field.Index.TOKENIZED));
  }
  if (location != null) {
    doc.add(new Field("String_Node_Str",location,Field.Store.NO,Field.Index.TOKENIZED));
    doc.add(new Field("String_Node_Str",location,Field.Store.NO,Field.Index.TOKENIZED));
  }
  return doc;
}