nus-yam/ex-repair huggingface dataset:
Program: 3427
Project: 3427
Buggy source:
/** 
 * figures out if the date is valid for the policy
 * @return true if policy has begun and hasn't expired yet (or no dates areset)
 */
public boolean isDateValid(){
  Date sd=getStartDate();
  Date ed=getEndDate();
  if ((sd == null) && (ed == null)) {
    return true;
  }
  Date now=new Date();
  if (sd != null) {
    if (now.before(sd)) {
      return false;
    }
  }
  if (ed != null) {
    if (now.after(sd)) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * figures out if the date is valid for the policy
 * @return true if policy has begun and hasn't expired yet (or no dates areset)
 */
public boolean isDateValid(){
  Date sd=getStartDate();
  Date ed=getEndDate();
  if ((sd == null) && (ed == null)) {
    return true;
  }
  Date now=new Date();
  if (sd != null) {
    if (now.before(sd)) {
      return false;
    }
  }
  if (ed != null) {
    if (now.after(ed)) {
      return false;
    }
  }
  return true;
}
Program: 3428
Project: 3428
Buggy source:
/** 
 */
public static Properties getProperties(){
  return (Properties)properties.clone();
}

Fixed version (ground truth):
/** 
 */
public static Properties getProperties(){
  if (properties == null) {
    loadConfig(null);
  }
  return (Properties)properties.clone();
}
Program: 3429
Project: 3429
Buggy source:
public void addBody(Body body) throws SAXException, WingException, UIException, SQLException, IOException, AuthorizeException {
  Division feedback=body.addInteractiveDivision("String_Node_Str",contextPath + "String_Node_Str",Division.METHOD_POST,"String_Node_Str");
  feedback.setHead(T_head);
  feedback.addPara(T_para1);
  List form=feedback.addList("String_Node_Str",List.TYPE_FORM);
  Text email=form.addItem().addText("String_Node_Str");
  email.setLabel(T_email);
  email.setHelp(T_email_help);
  email.setValue(parameters.getParameter("String_Node_Str","String_Node_Str"));
  TextArea comments=form.addItem().addTextArea("String_Node_Str");
  comments.setLabel(T_comments);
  comments.setSize(5,60);
  comments.setValue(parameters.getParameter("String_Node_Str","String_Node_Str"));
  form.addItem().addButton("String_Node_Str").setValue(T_submit);
  feedback.addHidden("String_Node_Str").setValue(parameters.getParameter("String_Node_Str","String_Node_Str"));
}

Fixed version (ground truth):
public void addBody(Body body) throws SAXException, WingException, UIException, SQLException, IOException, AuthorizeException {
  Division feedback=body.addInteractiveDivision("String_Node_Str",contextPath + "String_Node_Str",Division.METHOD_POST,"String_Node_Str");
  feedback.setHead(T_head);
  feedback.addPara(T_para1);
  List form=feedback.addList("String_Node_Str",List.TYPE_FORM);
  Text email=form.addItem().addText("String_Node_Str");
  email.setLabel(T_email);
  email.setHelp(T_email_help);
  email.setValue(parameters.getParameter("String_Node_Str","String_Node_Str"));
  TextArea comments=form.addItem().addTextArea("String_Node_Str");
  comments.setLabel(T_comments);
  comments.setValue(parameters.getParameter("String_Node_Str","String_Node_Str"));
  form.addItem().addButton("String_Node_Str").setValue(T_submit);
  feedback.addHidden("String_Node_Str").setValue(parameters.getParameter("String_Node_Str","String_Node_Str"));
}
Program: 3430
Project: 3430
Buggy source:
/** 
 * Set the database id of the container object.  This should be the id of a  Community or Collection.  This will constrain the results of the browse to only items or values within items that appear in the given container.
 * @param containerID
 */
public void setContainerID(int containerID);

Fixed version (ground truth):
/** 
 * Set the database id of the container object.  This should be the id of a Community or Collection.  This will constrain the results of the browse to only items or values within items that appear in the given container.
 * @param containerID
 */
public void setContainerID(int containerID);
Program: 3431
Project: 3431
Buggy source:
/** 
 * get the integer number which is the limit of the results that will be returned by any query.  The default is -1, which means unlimited results.
 * @return	the maximum possible number of results allowed to be returned
 */
public int getLimit();

Fixed version (ground truth):
/** 
 * get the integer number which is the limit of the results that will be returned by any query.  The default is -1, which means unlimited results.
 * @return  the maximum possible number of results allowed to be returned
 */
public int getLimit();
Program: 3432
Project: 3432
Buggy source:
/** 
 * Get the offset from the first result from which to return results.  This  functionality is present for backwards compatibility, but is ill advised.  All normal browse operations can be completed without it.  The default is -1, which means do not offset.
 * @return		the offset
 */
public int getOffset();

Fixed version (ground truth):
/** 
 * Get the offset from the first result from which to return results.  This functionality is present for backwards compatibility, but is ill advised.  All normal browse operations can be completed without it.  The default is -1, which means do not offset.
 * @return      the offset
 */
public int getOffset();
Program: 3433
Project: 3433
Buggy source:
/** 
 * get the name of the field in which to look for the container id.  This is principally for use internal to the DAO.
 * @return	the name of the container id field.  For example "collection_id" or"community_id"
 */
public String getContainerIDField();

Fixed version (ground truth):
/** 
 * get the name of the field in which to look for the container id.  This is principally for use internal to the DAO.
 * @return  the name of the container id field.  For example "collection_id" or"community_id"
 */
public String getContainerIDField();
Program: 3434
Project: 3434
Buggy source:
/** 
 * Set the focus field upon which we will match a value from which to start the browse.  This will either be the "sort_value" field or one of the additional sort fields defined by configuration param focusField		the name of the focus field
 */
public void setJumpToField(String focusField);

Fixed version (ground truth):
/** 
 * Set the focus field upon which we will match a value from which to start the browse.  This will either be the "sort_value" field or one of the additional sort fields defined by configuration param focusField     the name of the focus field
 */
public void setJumpToField(String focusField);
Program: 3435
Project: 3435
Buggy source:
/** 
 * This executes a query which will count the number of results for the parameters you set.
 * @return		the integer value of the number of results found
 * @throws BrowseException
 */
public int doCountQuery() throws BrowseException ;

Fixed version (ground truth):
/** 
 * This executes a query which will count the number of results for the parameters you set.
 * @return      the integer value of the number of results found
 * @throws BrowseException
 */
public int doCountQuery() throws BrowseException ;
Program: 3436
Project: 3436
Buggy source:
/** 
 * Get the database ID of the container object.  The container object will be a Community or a Collection.
 * @return	the database id of the container, or -1 if none is set
 */
public int getContainerID();

Fixed version (ground truth):
/** 
 * Get the database ID of the container object.  The container object will be a Community or a Collection.
 * @return  the database id of the container, or -1 if none is set
 */
public int getContainerID();
Program: 3437
Project: 3437
Buggy source:
/** 
 * Set whether the query should use an equals comparator when doing less than or  greater than comparisons.  That is, if true then comparisons will be made  using the equivalent of "<=" and ">=", while if false it will use the  equivalent of "<" and ">"
 * @param equalsComparator	true to use, false to not.
 */
public void setEqualsComparator(boolean equalsComparator);

Fixed version (ground truth):
/** 
 * Set whether the query should use an equals comparator when doing less than or greater than comparisons.  That is, if true then comparisons will be made using the equivalent of "<=" and ">=", while if false it will use the equivalent of "<" and ">"
 * @param equalsComparator  true to use, false to not.
 */
public void setEqualsComparator(boolean equalsComparator);
Program: 3438
Project: 3438
Buggy source:
/** 
 * Get the array of values that we will be selecting on.  The default is to select all of the values from a given table
 * @return	an array of values to select on
 */
public String[] getSelectValues();

Fixed version (ground truth):
/** 
 * Get the array of values that we will be selecting on.  The default is to select all of the values from a given table
 * @return  an array of values to select on
 */
public String[] getSelectValues();
Program: 3439
Project: 3439
Buggy source:
/** 
 * Get the offset from the first result from which to return results.  This  functionality is present for backwards compatibility, but is ill advised.  All normal browse operations can be completed without it.  The default is -1, which means do not offset.
 * @param offset
 */
public void setOffset(int offset);

Fixed version (ground truth):
/** 
 * Get the offset from the first result from which to return results.  This functionality is present for backwards compatibility, but is ill advised.  All normal browse operations can be completed without it.  The default is -1, which means do not offset.
 * @param offset
 */
public void setOffset(int offset);
Program: 3440
Project: 3440
Buggy source:
/** 
 * Set the database field which will be used to sort result sets on
 * @param orderField	the field by which results will be sorted
 */
public void setOrderField(String orderField);

Fixed version (ground truth):
/** 
 * Set the database field which will be used to sort result sets on
 * @param orderField    the field by which results will be sorted
 */
public void setOrderField(String orderField);
Program: 3441
Project: 3441
Buggy source:
/** 
 * Does the query use the equals comparator when doing less than or greater than comparisons.  @see setEqualsComparator Default value is true
 * @return	true if using it, false if not
 */
public boolean useEqualsComparator();

Fixed version (ground truth):
/** 
 * Does the query use the equals comparator when doing less than or greater than comparisons.  @see setEqualsComparator Default value is true
 * @return  true if using it, false if not
 */
public boolean useEqualsComparator();
Program: 3442
Project: 3442
Buggy source:
/** 
 * Get the name of the field in which the value to constrain results is contained
 * @return	the name of the field
 */
public String getFilterValueField();

Fixed version (ground truth):
/** 
 * Get the name of the field in which the value to constrain results is contained
 * @return  the name of the field
 */
public String getFilterValueField();
Program: 3443
Project: 3443
Buggy source:
/** 
 * Get the array of fields that we will be counting on.
 * @return	an array of fields to be counted over
 */
public String[] getCountValues();

Fixed version (ground truth):
/** 
 * Get the array of fields that we will be counting on.
 * @return  an array of fields to be counted over
 */
public String[] getCountValues();
Program: 3444
Project: 3444
Buggy source:
/** 
 * Get the value which we are constraining all our browse results to contain.
 * @return	the value to which to constrain results
 */
public String getFilterValue();

Fixed version (ground truth):
/** 
 * Get the value which we are constraining all our browse results to contain.
 * @return  the value to which to constrain results
 */
public String getFilterValue();
Program: 3445
Project: 3445
Buggy source:
/** 
 * Set the value upon which to start the browse from.  The value supplied here will be the top result on the page of results
 * @param focusValue	the value in the focus field on which to start browsing
 */
public void setJumpToValue(String focusValue);

Fixed version (ground truth):
/** 
 * Set the value upon which to start the browse from.  The value supplied here will be the top result on the page of results
 * @param focusValue    the value in the focus field on which to start browsing
 */
public void setJumpToValue(String focusValue);
Program: 3446
Project: 3446
Buggy source:
/** 
 * Set whether the results should be sorted in ascending order (on the given sort column) or descending order.
 * @param ascending		true to ascend, false to descend
 */
public void setAscending(boolean ascending);

Fixed version (ground truth):
/** 
 * Set whether the results should be sorted in ascending order (on the given sort column) or descending order.
 * @param ascending     true to ascend, false to descend
 */
public void setAscending(boolean ascending);
Program: 3447
Project: 3447
Buggy source:
/** 
 * Set he name of the field in which the value to constrain results is  contained
 * @param valueField 	the name of the field
 */
public void setFilterValueField(String valueField);

Fixed version (ground truth):
/** 
 * Set he name of the field in which the value to constrain results is contained
 * @param valueField    the name of the field
 */
public void setFilterValueField(String valueField);
Program: 3448
Project: 3448
Buggy source:
/** 
 * Set the array of columns that we will be counting over.  In general, the wildcard (*) will suffice
 * @param fields	an array of fields to be counted over
 */
public void setCountValues(String[] fields);

Fixed version (ground truth):
/** 
 * Set the array of columns that we will be counting over.  In general, the wildcard (*) will suffice
 * @param fields    an array of fields to be counted over
 */
public void setCountValues(String[] fields);
Program: 3449
Project: 3449
Buggy source:
/** 
 * If we have specified a container id and container field, we must also specify a container table.  This is the name of the table that maps the item onto the distinct value.  Since we are in a container, this value will actually be the view which allows us to select only items which are within a given container
 * @param containerTable	the name of the container table mapping
 */
public void setContainerTable(String containerTable);

Fixed version (ground truth):
/** 
 * If we have specified a container id and container field, we must also specify a container table.  This is the name of the table that maps the item onto the distinct value.  Since we are in a container, this value will actually be the view which allows us to select only items which are within a given container
 * @param containerTable    the name of the container table mapping
 */
public void setContainerTable(String containerTable);
Program: 3450
Project: 3450
Buggy source:
/** 
 * This executes a query which returns a List object containing String values which represent the results of a single value browse (for example, the list of all subject headings).  This is most commonly used with a Distinct browse type.
 * @return	List of Strings representing the single value query results
 * @throws BrowseException
 */
public List doValueQuery() throws BrowseException ;

Fixed version (ground truth):
/** 
 * This executes a query which returns a List object containing String values which represent the results of a single value browse (for example, the list of all subject headings).  This is most commonly used with a Distinct browse type.
 * @return  List of Strings representing the single value query results
 * @throws BrowseException
 */
public List doValueQuery() throws BrowseException ;
Program: 3451
Project: 3451
Buggy source:
/** 
 * Is this a distinct value browse?
 * @return	true if distinct, false if not
 */
public boolean isDistinct();

Fixed version (ground truth):
/** 
 * Is this a distinct value browse?
 * @return  true if distinct, false if not
 */
public boolean isDistinct();
Program: 3452
Project: 3452
Buggy source:
/** 
 * This executes a query which returns the value of the "highest" (max) value in the given table's column for the given item id.
 * @param column	the column to interrogate
 * @param table		the table to query
 * @param itemID	the item id
 * @return			String representing the max value in the given column
 * @throws BrowseException
 */
public String doMaxQuery(String column,String table,int itemID) throws BrowseException ;

Fixed version (ground truth):
/** 
 * This executes a query which returns the value of the "highest" (max) value in the given table's column for the given item id.
 * @param column    the column to interrogate
 * @param table     the table to query
 * @param itemID    the item id
 * @return          String representing the max value in the given column
 * @throws BrowseException
 */
public String doMaxQuery(String column,String table,int itemID) throws BrowseException ;
Program: 3453
Project: 3453
Buggy source:
/** 
 * Get the value at which the browse will start.  The value supplied here will be the top result on the page of results.
 * @return		the value to start browsing on
 */
public String getJumpToValue();

Fixed version (ground truth):
/** 
 * Get the value at which the browse will start.  The value supplied here will be the top result on the page of results.
 * @return      the value to start browsing on
 */
public String getJumpToValue();
Program: 3454
Project: 3454
Buggy source:
/** 
 * Set the array of values to select on.  This should be a list of the columns available in the target table, or the SQL wildcards.  The default is  single element array with the standard wildcard (*)
 * @param selectValues	the values to select on
 */
public void setSelectValues(String[] selectValues);

Fixed version (ground truth):
/** 
 * Set the array of values to select on.  This should be a list of the columns available in the target table, or the SQL wildcards.  The default is single element array with the standard wildcard (*)
 * @param selectValues  the values to select on
 */
public void setSelectValues(String[] selectValues);
Program: 3455
Project: 3455
Buggy source:
/** 
 * Get the database field which will be used to do the sorting of result sets on.
 * @return		the field by which results will be sorted
 */
public String getOrderField();

Fixed version (ground truth):
/** 
 * Get the database field which will be used to do the sorting of result sets on.
 * @return      the field by which results will be sorted
 */
public String getOrderField();
Program: 3456
Project: 3456
Buggy source:
/** 
 * get the name of the table that we are querying
 * @return	the name of the table
 */
public String getTable();

Fixed version (ground truth):
/** 
 * get the name of the table that we are querying
 * @return  the name of the table
 */
public String getTable();
Program: 3457
Project: 3457
Buggy source:
/** 
 * Set the limit for how many results should be returned.  This is generally for use in paging or limiting the number of items be be displayed.  The default is -1, meaning unlimited results.  Note that if the number of results of the query is less than this number, the size of the result set will be smaller than this limit.
 * @param limit		the maximum number of results to return.
 */
public void setLimit(int limit);

Fixed version (ground truth):
/** 
 * Set the limit for how many results should be returned.  This is generally for use in paging or limiting the number of items be be displayed.  The default is -1, meaning unlimited results.  Note that if the number of results of the query is less than this number, the size of the result set will be smaller than this limit.
 * @param limit     the maximum number of results to return.
 */
public void setLimit(int limit);
Program: 3458
Project: 3458
Buggy source:
/** 
 * Set the name of the table to query
 * @param table		the name of the table
 */
public void setTable(String table);

Fixed version (ground truth):
/** 
 * Set the name of the table to query
 * @param table     the name of the table
 */
public void setTable(String table);
Program: 3459
Project: 3459
Buggy source:
/** 
 * Get the name of the container table that is being used to map items to distinct values when in a container constrained browse
 * @return	the name of the table
 */
public String getContainerTable();

Fixed version (ground truth):
/** 
 * Get the name of the container table that is being used to map items to distinct values when in a container constrained browse
 * @return  the name of the table
 */
public String getContainerTable();
Program: 3460
Project: 3460
Buggy source:
/** 
 * set the name of the field in which to look for the container id.
 * @param containerIDField	the name of the container id field.  For example "collection_id" or "community_id"
 */
public void setContainerIDField(String containerIDField);

Fixed version (ground truth):
/** 
 * set the name of the field in which to look for the container id.
 * @param containerIDField  the name of the container id field.For example "collection_id" or "community_id"
 */
public void setContainerIDField(String containerIDField);
Program: 3461
Project: 3461
Buggy source:
/** 
 * Set whether this is a distinct value browse or not
 * @param bool	true if distinct value, false if not
 */
public void setDistinct(boolean bool);

Fixed version (ground truth):
/** 
 * Set whether this is a distinct value browse or not
 * @param bool  true if distinct value, false if not
 */
public void setDistinct(boolean bool);
Program: 3462
Project: 3462
Buggy source:
/** 
 * Get the field in which we will match a focus value from which to start the browse.  This will either be the "sort_value" field or one of the additional sort fields defined by configuration
 * @return	the name of the focus field
 */
public String getJumpToField();

Fixed version (ground truth):
/** 
 * Get the field in which we will match a focus value from which to start the browse.  This will either be the "sort_value" field or one of the additional sort fields defined by configuration
 * @return  the name of the focus field
 */
public String getJumpToField();
Program: 3463
Project: 3463
Buggy source:
/** 
 * Is the sort order ascending or descending? Default value is true
 * @return	true for ascending, false for descending
 */
public boolean isAscending();

Fixed version (ground truth):
/** 
 * Is the sort order ascending or descending? Default value is true
 * @return  true for ascending, false for descending
 */
public boolean isAscending();
Program: 3464
Project: 3464
Buggy source:
/** 
 * Set the value to which all our browse results should be constrained.  For example, if you are listing all of the publications by a single author your value would be the author name.
 * @param value	the value to which to constrain results
 */
public void setFilterValue(String value);

Fixed version (ground truth):
/** 
 * Set the value to which all our browse results should be constrained.  For example, if you are listing all of the publications by a single author your value would be the author name.
 * @param value the value to which to constrain results
 */
public void setFilterValue(String value);
Program: 3465
Project: 3465
Buggy source:
/** 
 * assemble a WHERE clause with the given constraints.  This will return something of the form: <code> WHERE [focus clause] [AND] [value clause] [AND] [container constraint] </code> The container constraint is described in one of either getFullConstraint or  getDistinctConstraint, and the form of that section of the query can be found in their documentation. If either of focusClause or valueClause is null, they will be duly omitted from the WHERE clause.
 */
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");
  }
}

Fixed version (ground truth):
/** 
 * assemble a WHERE clause with the given constraints.  This will return something of the form: <code> WHERE [focus clause] [AND] [value clause] [AND] [container constraint] </code> The container constraint is described in one of either getFullConstraint or getDistinctConstraint, and the form of that section of the query can be found in their documentation. If either of focusClause or valueClause is null, they will be duly omitted from the WHERE clause.
 */
private void buildWhereClauseDistinctConstraints(StringBuffer queryBuf,List params){
  if (containerIDField != null && containerID != -1 && containerTable != null) {
    buildWhereClauseOpInsert(queryBuf);
    queryBuf.append("String_Node_Str").append(table).append("String_Node_Str");
  }
}
Program: 3466
Project: 3466
Buggy source:
/** 
 * assemble a WHERE clause with the given constraints.  This will return something of the form: <code> WHERE [focus clause] [AND] [value clause] [AND] [container constraint] </code> The container constraint is described in one of either getFullConstraint or  getDistinctConstraint, and the form of that section of the query can be found in their documentation. If either of focusClause or valueClause is null, they will be duly omitted from the WHERE clause.
 */
private void buildWhereClauseFullConstraints(StringBuffer queryBuf,List params){
  if (tableDis == null || tableMap == null) {
    if (containerIDField != null && containerID != -1) {
      buildWhereClauseOpInsert(queryBuf);
      queryBuf.append("String_Node_Str").append(table).append("String_Node_Str");
    }
  }
}

Fixed version (ground truth):
/** 
 * assemble a WHERE clause with the given constraints.  This will return something of the form: <code> WHERE [focus clause] [AND] [value clause] [AND] [container constraint] </code> The container constraint is described in one of either getFullConstraint or getDistinctConstraint, and the form of that section of the query can be found in their documentation. If either of focusClause or valueClause is null, they will be duly omitted from the WHERE clause.
 */
private void buildWhereClauseFullConstraints(StringBuffer queryBuf,List params){
  if (tableDis == null || tableMap == null) {
    if (containerIDField != null && containerID != -1) {
      buildWhereClauseOpInsert(queryBuf);
      queryBuf.append("String_Node_Str").append(table).append("String_Node_Str");
    }
  }
}
Program: 3467
Project: 3467
Buggy source:
/** 
 * Prepare the select clause using the pre-prepared arguments.  This will produce something of the form: <code> SELECT [arguments] FROM [table] </code>
 * @param queryBuf  the string value obtained from distinctClause, countClause or selectValues
 * @return  the SELECT part of the query
 */
private void buildSelectStatementDistinct(StringBuffer queryBuf,List params) throws BrowseException {
  if (queryBuf.length() == 0) {
    throw new BrowseException("String_Node_Str");
  }
  if (table == null || "String_Node_Str".equals(table)) {
    throw new BrowseException("String_Node_Str");
  }
  queryBuf.insert(0,"String_Node_Str");
  queryBuf.append("String_Node_Str");
  queryBuf.append(table);
  queryBuf.append("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Prepare the select clause using the pre-prepared arguments.  This will produce something of the form: <code> SELECT [arguments] FROM [table] </code>
 * @param queryBuf  the string value obtained from distinctClause, countClause or selectValues
 * @return  the SELECT part of the query
 */
private void buildSelectStatementDistinct(StringBuffer queryBuf,List params) throws BrowseException {
  if (queryBuf.length() == 0) {
    throw new BrowseException("String_Node_Str");
  }
  if (table == null || "String_Node_Str".equals(table)) {
    throw new BrowseException("String_Node_Str");
  }
  queryBuf.insert(0,"String_Node_Str");
  queryBuf.append("String_Node_Str");
  queryBuf.append(table);
  if (containerTable != null && tableMap != null) {
    queryBuf.append("String_Node_Str").append(tableMap).append("String_Node_Str");
    queryBuf.append("String_Node_Str");
    buildFocusedSelectTables(queryBuf);
    queryBuf.append("String_Node_Str");
    buildFocusedSelectClauses(queryBuf,params);
    queryBuf.append("String_Node_Str");
  }
  queryBuf.append("String_Node_Str");
}
Program: 3468
Project: 3468
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: 3469
Project: 3469
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: 3470
Project: 3470
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: 3471
Project: 3471
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: 3472
Project: 3472
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: 3473
Project: 3473
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: 3478
Project: 3478
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: 3479
Project: 3479
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: 3481
Project: 3481
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: 3483
Project: 3483
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: 3484
Project: 3484
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: 3485
Project: 3485
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: 3486
Project: 3486
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: 3488
Project: 3488
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: 3489
Project: 3489
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: 3490
Project: 3490
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: 3491
Project: 3491
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: 3492
Project: 3492
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;
}