nus-yam/ex-repair huggingface dataset:
Program: 50610
Project: 50610
Buggy source:
@Override public HierarchicalConfiguration toConfiguration(){
  HierarchicalConfiguration configuration=super.toConfiguration();
  configuration.setProperty(REPOSITORY_GERRIT_REPOSITORY_HOSTNAME,hostname);
  configuration.setProperty(REPOSITORY_GERRIT_USERNAME,username);
  configuration.setProperty(REPOSITORY_GERRIT_EMAIL,userEmail);
  configuration.setProperty(REPOSITORY_GERRIT_PROJECT,project);
  configuration.setProperty(REPOSITORY_GERRIT_BRANCH,vcsBranch.getName());
  configuration.setProperty(REPOSITORY_GERRIT_SSH_KEY,sshKey);
  configuration.setProperty(REPOSITORY_GERRIT_SSH_PASSPHRASE,encryptionService.encrypt(sshPassphrase));
  configuration.setProperty(REPOSITORY_GERRIT_CONFIG_DIR,relativeConfigPath);
  configuration.setProperty(REPOSITORY_GERRIT_SSH_KEY_FILE,relativeSSHKeyFilePath);
  configuration.setProperty(REPOSITORY_GERRIT_REPOSITORY_PORT,port);
  configuration.setProperty(REPOSITORY_GERRIT_USE_SHALLOW_CLONES,useShallowClones);
  configuration.setProperty(REPOSITORY_GERRIT_USE_SUBMODULES,useSubmodules);
  configuration.setProperty(REPOSITORY_GERRIT_COMMAND_TIMEOUT,commandTimeout);
  configuration.setProperty(REPOSITORY_GERRIT_VERBOSE_LOGS,verboseLogs);
  return configuration;
}

Fixed version (ground truth):
@Override public HierarchicalConfiguration toConfiguration(){
  HierarchicalConfiguration configuration=super.toConfiguration();
  configuration.setProperty(REPOSITORY_GERRIT_REPOSITORY_HOSTNAME,hostname);
  configuration.setProperty(REPOSITORY_GERRIT_USERNAME,username);
  configuration.setProperty(REPOSITORY_GERRIT_EMAIL,userEmail);
  configuration.setProperty(REPOSITORY_GERRIT_PROJECT,project);
  if (!vcsBranch.equals(MASTER_BRANCH) && !vcsBranch.equals(ALL_BRANCH)) {
    configuration.setProperty(REPOSITORY_GERRIT_DEFAULT_BRANCH,CUSTOM_BRANCH_SET);
    configuration.setProperty(REPOSITORY_GERRIT_CUSTOM_BRANCH,vcsBranch.getName());
  }
 else {
    String br=vcsBranch.getName();
    configuration.setProperty(REPOSITORY_GERRIT_DEFAULT_BRANCH,br);
    configuration.setProperty(REPOSITORY_GERRIT_CUSTOM_BRANCH,br);
  }
  configuration.setProperty(REPOSITORY_GERRIT_BRANCH,vcsBranch.getName());
  configuration.setProperty(REPOSITORY_GERRIT_SSH_KEY,sshKey);
  configuration.setProperty(REPOSITORY_GERRIT_SSH_PASSPHRASE,encryptionService.encrypt(sshPassphrase));
  configuration.setProperty(REPOSITORY_GERRIT_CONFIG_DIR,relativeConfigPath);
  configuration.setProperty(REPOSITORY_GERRIT_SSH_KEY_FILE,relativeSSHKeyFilePath);
  configuration.setProperty(REPOSITORY_GERRIT_REPOSITORY_PORT,port);
  configuration.setProperty(REPOSITORY_GERRIT_USE_SHALLOW_CLONES,useShallowClones);
  configuration.setProperty(REPOSITORY_GERRIT_USE_SUBMODULES,useSubmodules);
  configuration.setProperty(REPOSITORY_GERRIT_COMMAND_TIMEOUT,commandTimeout);
  configuration.setProperty(REPOSITORY_GERRIT_VERBOSE_LOGS,verboseLogs);
  return configuration;
}
Program: 50612
Project: 50612
Buggy source:
public GerritService(String strHost,Authentication auth){
  this.strHost=strHost;
  this.auth=auth;
}

Fixed version (ground truth):
public GerritService(String strHost,int port,Authentication auth){
  this.strHost=strHost;
  this.port=port;
  this.auth=auth;
}
Program: 50613
Project: 50613
Buggy source:
private void updateChangeVerification(RepositoryDefinition rd,String buildPlanKey,CurrentBuildResult results) throws RepositoryException {
  final GerritRepositoryAdapter gra=(GerritRepositoryAdapter)rd.getRepository();
  final String revision=buildContext.getBuildChanges().getVcsRevisionKey(rd.getId());
  final GerritService service=new GerritService(gra.getHostname(),gra.getGerritAuthentication());
  final GerritChangeVO change=service.getChangeByRevision(revision);
  if (change == null) {
    logger.error(textProvider.getText("String_Node_Str"));
    return;
  }
 else   if (change.isMerged()) {
    logger.info(textProvider.getText("String_Node_Str",Arrays.asList(change.getId())));
    return;
  }
  if ((results.getBuildReturnCode() == 0) && results.getBuildState().equals(BuildState.SUCCESS)) {
    if (service.verifyChange(true,change.getNumber(),change.getCurrentPatchSet().getNumber(),buildStatusString(results)))     logger.info(textProvider.getText("String_Node_Str"));
 else {
      logger.error(textProvider.getText("String_Node_Str",Arrays.asList(change.getId())));
    }
  }
 else   if (service.verifyChange(false,change.getNumber(),change.getCurrentPatchSet().getNumber(),buildStatusString(results))) {
    logger.info(textProvider.getText("String_Node_Str"));
  }
 else {
    logger.error(textProvider.getText("String_Node_Str",Arrays.asList(change.getId())));
  }
}

Fixed version (ground truth):
private void updateChangeVerification(RepositoryDefinition rd,String buildPlanKey,CurrentBuildResult results) throws RepositoryException {
  final GerritRepositoryAdapter gra=(GerritRepositoryAdapter)rd.getRepository();
  final String revision=buildContext.getBuildChanges().getVcsRevisionKey(rd.getId());
  final GerritService service=new GerritService(gra.getHostname(),gra.getPort(),gra.getGerritAuthentication());
  final GerritChangeVO change=service.getChangeByRevision(revision);
  if (change == null) {
    logger.error(textProvider.getText("String_Node_Str"));
    return;
  }
 else   if (change.isMerged()) {
    logger.info(textProvider.getText("String_Node_Str",Arrays.asList(change.getId())));
    return;
  }
  if ((results.getBuildReturnCode() == 0) && results.getBuildState().equals(BuildState.SUCCESS)) {
    if (service.verifyChange(true,change.getNumber(),change.getCurrentPatchSet().getNumber(),buildStatusString(results)))     logger.info(textProvider.getText("String_Node_Str"));
 else {
      logger.error(textProvider.getText("String_Node_Str",Arrays.asList(change.getId())));
    }
  }
 else   if (service.verifyChange(false,change.getNumber(),change.getCurrentPatchSet().getNumber(),buildStatusString(results))) {
    logger.info(textProvider.getText("String_Node_Str"));
  }
 else {
    logger.error(textProvider.getText("String_Node_Str",Arrays.asList(change.getId())));
  }
}
Program: 50615
Project: 50615
Buggy source:
@Override public void populateFromConfig(HierarchicalConfiguration config){
  super.populateFromConfig(config);
  hostname=StringUtils.trimToEmpty(config.getString(REPOSITORY_GERRIT_REPOSITORY_HOSTNAME));
  username=config.getString(REPOSITORY_GERRIT_USERNAME);
  sshKey=config.getString(REPOSITORY_GERRIT_SSH_KEY,"String_Node_Str");
  sshKeyFile=new File(config.getString(REPOSITORY_GERRIT_SSH_KEY_FILE));
  sshPassphrase=config.getString(REPOSITORY_GERRIT_SSH_PASSPHRASE);
  port=config.getInt(REPOSITORY_GERRIT_REPOSITORY_PORT,29418);
  project=config.getString(REPOSITORY_GERRIT_PROJECT);
  useShallowClones=config.getBoolean(REPOSITORY_GERRIT_USE_SHALLOW_CLONES);
  useSubmodules=config.getBoolean(REPOSITORY_GERRIT_USE_SUBMODULES);
  commandTimeout=config.getInt(REPOSITORY_GERRIT_COMMAND_TIMEOUT,DEFAULT_COMMAND_TIMEOUT_IN_MINUTES);
  verboseLogs=config.getBoolean(REPOSITORY_GERRIT_VERBOSE_LOGS,false);
  String gitRepoUrl="String_Node_Str" + username + "String_Node_Str"+ hostname+ "String_Node_Str"+ port+ "String_Node_Str"+ project;
  GitRepoFactory.configureSSHGitRepository(this.gitRepository,gitRepoUrl,username,"String_Node_Str",GitRepoFactory.MASTER_BRANCH,this.sshKeyFile,sshPassphrase,this.useShallowClones,this.useSubmodules,this.commandTimeout,this.verboseLogs,this.textProvider);
}

Fixed version (ground truth):
@Override public void populateFromConfig(HierarchicalConfiguration config){
  super.populateFromConfig(config);
  hostname=StringUtils.trimToEmpty(config.getString(REPOSITORY_GERRIT_REPOSITORY_HOSTNAME));
  username=config.getString(REPOSITORY_GERRIT_USERNAME);
  sshKey=config.getString(REPOSITORY_GERRIT_SSH_KEY,"String_Node_Str");
  sshPassphrase=config.getString(REPOSITORY_GERRIT_SSH_PASSPHRASE);
  port=config.getInt(REPOSITORY_GERRIT_REPOSITORY_PORT,29418);
  project=config.getString(REPOSITORY_GERRIT_PROJECT);
  useShallowClones=config.getBoolean(REPOSITORY_GERRIT_USE_SHALLOW_CLONES);
  useSubmodules=config.getBoolean(REPOSITORY_GERRIT_USE_SUBMODULES);
  commandTimeout=config.getInt(REPOSITORY_GERRIT_COMMAND_TIMEOUT,DEFAULT_COMMAND_TIMEOUT_IN_MINUTES);
  verboseLogs=config.getBoolean(REPOSITORY_GERRIT_VERBOSE_LOGS,false);
  String gitRepoUrl="String_Node_Str" + username + "String_Node_Str"+ hostname+ "String_Node_Str"+ port+ "String_Node_Str"+ project;
  relativeSSHKeyFilePath=config.getString(REPOSITORY_GERRIT_SSH_KEY_FILE);
  String decryptedKey=encrypterRef.get().decrypt(sshKey);
  sshKeyFile=prepareSSHKeyFile(relativeSSHKeyFilePath,decryptedKey);
  GitRepoFactory.configureSSHGitRepository(this.gitRepository,gitRepoUrl,username,"String_Node_Str",GitRepoFactory.MASTER_BRANCH,this.sshKeyFile,sshPassphrase,this.useShallowClones,this.useSubmodules,this.commandTimeout,this.verboseLogs,this.textProvider);
}
Program: 50616
Project: 50616
Buggy source:
@Override public HierarchicalConfiguration toConfiguration(){
  HierarchicalConfiguration configuration=super.toConfiguration();
  configuration.setProperty(REPOSITORY_GERRIT_REPOSITORY_HOSTNAME,hostname);
  configuration.setProperty(REPOSITORY_GERRIT_USERNAME,username);
  configuration.setProperty(REPOSITORY_GERRIT_PROJECT,project);
  configuration.setProperty(REPOSITORY_GERRIT_SSH_KEY,sshKey);
  configuration.setProperty(REPOSITORY_GERRIT_SSH_PASSPHRASE,sshPassphrase);
  configuration.setProperty(REPOSITORY_GERRIT_SSH_KEY_FILE,sshKeyFile);
  configuration.setProperty(REPOSITORY_GERRIT_REPOSITORY_PORT,port);
  configuration.setProperty(REPOSITORY_GERRIT_USE_SHALLOW_CLONES,useShallowClones);
  configuration.setProperty(REPOSITORY_GERRIT_USE_SUBMODULES,useSubmodules);
  configuration.setProperty(REPOSITORY_GERRIT_COMMAND_TIMEOUT,commandTimeout);
  configuration.setProperty(REPOSITORY_GERRIT_VERBOSE_LOGS,verboseLogs);
  return configuration;
}

Fixed version (ground truth):
@Override public HierarchicalConfiguration toConfiguration(){
  HierarchicalConfiguration configuration=super.toConfiguration();
  configuration.setProperty(REPOSITORY_GERRIT_REPOSITORY_HOSTNAME,hostname);
  configuration.setProperty(REPOSITORY_GERRIT_USERNAME,username);
  configuration.setProperty(REPOSITORY_GERRIT_PROJECT,project);
  configuration.setProperty(REPOSITORY_GERRIT_SSH_KEY,sshKey);
  configuration.setProperty(REPOSITORY_GERRIT_SSH_PASSPHRASE,sshPassphrase);
  configuration.setProperty(REPOSITORY_GERRIT_SSH_KEY_FILE,relativeSSHKeyFilePath);
  configuration.setProperty(REPOSITORY_GERRIT_REPOSITORY_PORT,port);
  configuration.setProperty(REPOSITORY_GERRIT_USE_SHALLOW_CLONES,useShallowClones);
  configuration.setProperty(REPOSITORY_GERRIT_USE_SUBMODULES,useSubmodules);
  configuration.setProperty(REPOSITORY_GERRIT_COMMAND_TIMEOUT,commandTimeout);
  configuration.setProperty(REPOSITORY_GERRIT_VERBOSE_LOGS,verboseLogs);
  return configuration;
}
Program: 50618
Project: 50618
Buggy source:
public File prepareSSHKeyFile(BuildConfiguration buildConfiguration,String sshKey){
  String planKey=buildConfiguration.getString(REPOSITORY_GERRIT_PLAN_KEY);
  String repoDisplayName=buildConfiguration.getString(REPOSITORY_GERRIT_REPO_DISP_NAME);
  File parentDirectoryFile=this.buildDirectoryManager.getBaseBuildWorkingDirectory();
  String parentDirectory=parentDirectoryFile.getAbsolutePath();
  String workingDirectory=parentDirectory + File.separator + this.getShortKey();
  if (planKey != null) {
    workingDirectory=workingDirectory + File.separator + planKey;
  }
  workingDirectory=workingDirectory + File.separator + REPOSITORY_GERRIT_STORAGE;
  if (repoDisplayName != null) {
    workingDirectory=workingDirectory + File.separator + repoDisplayName;
  }
  File f=new File(workingDirectory + "String_Node_Str");
  try {
    FileUtils.writeStringToFile(f,sshKey);
  }
 catch (  IOException e) {
    log.error(e.getMessage());
  }
  return f;
}

Fixed version (ground truth):
public File prepareSSHKeyFile(String strRelativePath,String sshKey){
  String filePath=getBaseBuildWorkingDirectory() + File.separator + strRelativePath;
  File f=new File(filePath);
  try {
    FileUtils.writeStringToFile(f,sshKey);
  }
 catch (  IOException e) {
    log.error(e.getMessage());
    return null;
  }
  return f;
}
Program: 50619
Project: 50619
Buggy source:
public void testGerritConnection(String sshKeyFile,String strHost,int port,String strUsername,String strProject,String phrase) throws RepositoryException {
  SshConnection sshConnection=null;
  File f=new File(sshKeyFile);
  if (!f.isFile()) {
    throw new RepositoryException(textProvider.getText("String_Node_Str"));
  }
  Authentication auth=new Authentication(f,strUsername,phrase);
  try {
    sshConnection=SshConnectionFactory.getConnection(strHost,port,auth);
  }
 catch (  IOException e) {
    throw new RepositoryException(textProvider.getText("String_Node_Str"));
  }
  if (!sshConnection.isConnected()) {
    throw new RepositoryException(textProvider.getText("String_Node_Str"));
  }
 else {
    sshConnection.disconnect();
  }
}

Fixed version (ground truth):
public void testGerritConnection(String sshKeyFile,String key,String strHost,int port,String strUsername,String strProject,String phrase) throws RepositoryException {
  SshConnection sshConnection=null;
  File f=prepareSSHKeyFile(sshKeyFile,key);
  if (!f.isFile()) {
    throw new RepositoryException(textProvider.getText("String_Node_Str"));
  }
  Authentication auth=new Authentication(f,strUsername,phrase);
  try {
    sshConnection=SshConnectionFactory.getConnection(strHost,port,auth);
  }
 catch (  IOException e) {
    throw new RepositoryException(textProvider.getText("String_Node_Str"));
  }
  if (!sshConnection.isConnected()) {
    throw new RepositoryException(textProvider.getText("String_Node_Str"));
  }
 else {
    sshConnection.disconnect();
  }
}
Program: 50620
Project: 50620
Buggy source:
/** 
 * Sets the flag that indicates whether the input field is required or not
 * @author Alec Erasmus<alec.erasmus@a24group.com>
 * @since 08 July 2013
 * @param required - The flag that indicates whether the input field is required or not
 */
@Override public void setRequired(boolean required){
  this.required=required;
}

Fixed version (ground truth):
/** 
 * Sets the flag that indicates whether the input field is required or not
 * @author Ruan Naude <ruan.naude@a24group.com>
 * @since 15 June 2015
 * @param required - The flag that indicates whether the input field is required or not
 */
@Override public void setRequired(boolean required){
  this.required=required;
}
Program: 50621
Project: 50621
Buggy source:
/** 
 * Class constructor
 * @author Ruan Naude <runa.naude@a24group.com>
 * @since 12 June 2015
 * @param minDate - The minimum start date
 * @param maxDate - The maximum start date
 * @param selectedDate - The default selected date
 * @param minShiftTime - The minimum shift length in milliseconds
 * @param maxShiftTime - The maximum shift length in milliseconds
 * @param hoursStep - The step to increase the hours with
 * @param minuteStep - The step to increase the minutes with
 */
public ShiftInputField(SSDate minDate,SSDate maxDate,SSDate selectedDate,long minShiftTime,long maxShiftTime,int hoursStep,int minuteStep){
  super(minDate,maxDate,selectedDate,minShiftTime,maxShiftTime,hoursStep,minuteStep);
}

Fixed version (ground truth):
/** 
 * Class constructor
 * @author Ruan Naude <ruan.naude@a24group.com>
 * @since 12 June 2015
 * @param minDate - The minimum start date
 * @param maxDate - The maximum start date
 * @param selectedDate - The default selected date
 * @param minShiftTime - The minimum shift length in milliseconds
 * @param maxShiftTime - The maximum shift length in milliseconds
 * @param hoursStep - The step to increase the hours with
 * @param minuteStep - The step to increase the minutes with
 */
public ShiftInputField(SSDate minDate,SSDate maxDate,SSDate selectedDate,long minShiftTime,long maxShiftTime,int hoursStep,int minuteStep){
  super(minDate,maxDate,selectedDate,minShiftTime,maxShiftTime,hoursStep,minuteStep);
}
Program: 50622
Project: 50622
Buggy source:
/** 
 * This method will be used to reset the time to 00:00:00
 * @author Michael Barnard <michael.barnard@a24group.com>
 * @since  21 July 2015
 * @return void
 */
public void resetTime(){
  this.setHours(0);
  this.setMinutes(0);
  this.setSeconds(0);
}

Fixed version (ground truth):
/** 
 * This method will be used to reset the time to 00:00:00
 * @author Michael Barnard <michael.barnard@a24group.com>
 * @since  21 July 2015
 * @return void
 */
public void resetTime(){
  this.setDirectTime(0,0,0);
}
Program: 50624
Project: 50624
Buggy source:
/** 
 * Sets the selected display item
 * @author Michael Barnard <michael.barnard@a24group.com>
 * @since  10 Jul 2014
 * @param selectedDisplayItem - The display item the user clicked on in the drop down
 */
public void setSelectedDisplayItem(FilterDropdownRecordWidget<ListType> selectedDisplayItem){
  if (selectedDisplayItem != null) {
    this.selectedDisplayItem=selectedDisplayItem;
    this.selectedObject=this.selectedDisplayItem.getItemValue();
    textBox.setText(this.selectedDisplayItem.getItemSelectionText());
    destroyDropDownPopup();
  }
}

Fixed version (ground truth):
/** 
 * Sets the selected display item
 * @author Michael Barnard <michael.barnard@a24group.com>
 * @since  10 Jul 2014
 * @param selectedDisplayItem - The display item the user clicked on in the drop down
 */
public void setSelectedDisplayItem(FilterDropdownRecordWidget<ListType> selectedDisplayItem){
  if (selectedDisplayItem != null) {
    this.selectedDisplayItem=selectedDisplayItem;
    this.selectedDisplayItem.setSelectedState(false);
    this.selectedObject=this.selectedDisplayItem.getItemValue();
    textBox.setText(this.selectedDisplayItem.getItemSelectionText());
    destroyDropDownPopup();
  }
}
Program: 50625
Project: 50625
Buggy source:
/** 
 * The key up event handler
 * @param event - The key up event that is being handled
 * @author Michael Barnard <michael.barnard@a24group.com>
 * @since  10 Jul 2014
 */
@Override public void onKeyUp(KeyUpEvent event){
  if (event.isLeftArrow() || event.isRightArrow()) {
  }
 else   if (event.isDownArrow()) {
    if (dropDownPopup != null) {
      String itemText=dropDownPopup.selectNextItem();
      if (itemText != null) {
        textBox.setText(itemText);
      }
    }
  }
 else   if (event.isUpArrow()) {
    if (dropDownPopup != null) {
      String itemText=dropDownPopup.selectPreviousItem();
      if (itemText != null) {
        textBox.setText(itemText);
      }
 else {
        textBox.setText(previousSearchString);
      }
    }
  }
 else   if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
    if (dropDownPopup != null) {
      setSelectedDisplayItem(dropDownPopup.getSelectedItem());
    }
  }
 else   if (textBox.getText().length() >= this.minCharCount && !textBox.getText().equals(previousSearchString)) {
    selectedObject=null;
    previousSearchString=textBox.getText();
    this.setValue(textBox.getText());
    createDropDownPopup();
    applyFilter();
  }
 else   if (textBox.getText().length() < this.minCharCount) {
    selectedObject=null;
    previousSearchString=textBox.getText();
    this.setValue(textBox.getText());
    destroyDropDownPopup();
  }
}

Fixed version (ground truth):
/** 
 * The key up event handler
 * @param event - The key up event that is being handled
 * @author Michael Barnard <michael.barnard@a24group.com>
 * @since  10 Jul 2014
 */
@Override public void onKeyUp(KeyUpEvent event){
  if (event.isLeftArrow() || event.isRightArrow()) {
  }
 else   if (event.isDownArrow()) {
    if (dropDownPopup != null) {
      String itemText=dropDownPopup.selectNextItem();
      if (itemText != null) {
        textBox.setText(itemText);
      }
    }
  }
 else   if (event.isUpArrow()) {
    if (dropDownPopup != null) {
      String itemText=dropDownPopup.selectPreviousItem();
      if (itemText != null) {
        textBox.setText(itemText);
      }
 else {
        textBox.setText(previousSearchString);
      }
    }
  }
 else   if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
    if (dropDownPopup != null) {
      setSelectedDisplayItem(dropDownPopup.getSelectedItem());
    }
  }
 else   if (textBox.getText().length() >= this.minCharCount && !textBox.getText().equals(previousSearchString)) {
    selectedObject=null;
    previousSearchString=textBox.getText();
    createDropDownPopup();
    applyFilter();
  }
 else   if (textBox.getText().length() < this.minCharCount) {
    selectedObject=null;
    previousSearchString=textBox.getText();
    destroyDropDownPopup();
  }
}
Program: 50626
Project: 50626
Buggy source:
private void setValue(SSDate oldDate,SSDate date,boolean fireEvents){
  if (date != null) {
    picker.setCurrentMonth(date);
  }
  picker.setValue(date,false);
  format.reset(this,false);
  box.setText(getFormat().format(this,date));
  if (fireEvents) {
    DateChangeEvent.fireIfNotEqualDates(this,oldDate,date);
  }
}

Fixed version (ground truth):
private void setValue(SSDate oldDate,SSDate date,boolean fireEvents){
  SSDate pickerDate=date;
  if (date != null && this.getDatePicker().getMinimumDate().getTime() > date.getTime()) {
    System.out.println("String_Node_Str");
    pickerDate=new SSDate(this.getDatePicker().getMinimumDate().getTime());
    pickerDate.setDate(this.getDatePicker().getMinimumDate().getDate() + 1);
  }
  if (pickerDate != null) {
    picker.setCurrentMonth(pickerDate);
  }
  picker.setValue(date,false);
  format.reset(this,false);
  box.setText(getFormat().format(this,date));
  if (fireEvents) {
    DateChangeEvent.fireIfNotEqualDates(this,oldDate,date);
  }
}
Program: 50627
Project: 50627
Buggy source:
/** 
 * Adds the given number of months to a date.
 * @param date the date
 * @param months number of months
 */
@SuppressWarnings("String_Node_Str") public static void addMonthsToDate(SSDate date,int months){
  if (months != 0) {
    int month=date.getMonth();
    int year=date.getYear();
    int resultMonthCount=year * 12 + month + months;
    int resultYear=resultMonthCount / 12;
    int resultMonth=resultMonthCount - resultYear * 12;
    date.setMonth(resultMonth);
    date.setYear(resultYear);
  }
}

Fixed version (ground truth):
/** 
 * Adds the given number of months to a date. This method will add a number of months onto the current month. If the resultant month has fewer days, we will set the date to max day for that month. If the calculated month has more days than the current date that has been passed into the method, the month is simply incremented by the requested number of months passed into the method.
 * @param date the date
 * @param months number of months
 */
@SuppressWarnings("String_Node_Str") public static void addMonthsToDate(SSDate date,int months){
  if (months != 0) {
    int month=date.getMonth();
    int year=date.getYear();
    int resultMonthCount=year * 12 + month + months;
    int resultYear=resultMonthCount / 12;
    int resultMonth=resultMonthCount - resultYear * 12;
    if (resultMonth == 1 && date.getDate() > 28) {
      if (((resultYear % 4 == 0) && (resultYear % 100 != 0)) || (resultYear % 400 == 0)) {
        date.setDate(29);
      }
 else {
        date.setDate(28);
      }
    }
 else     if (date.getDate() == 31 && (resultMonth == 3 || resultMonth == 5 || resultMonth == 8 || resultMonth == 10)) {
      date.setDate(30);
    }
    date.setMonth(resultMonth);
    date.setYear(resultYear);
  }
}
Program: 50628
Project: 50628
Buggy source:
/** 
 * Selects the previous item in the drop down and change the item to it's selected style
 * @author Johannes Gryffenberg <johannes.gryffenberg@gmail.com>
 * @since  22 January 2013
 * @return The display text for the item
 */
public String selectPreviousItem(){
  if (hasResults && selectedIndex >= 0) {
    resultDisplayItems.get(selectedIndex).setSelectedState(false);
    selectedIndex--;
    if (selectedIndex >= 0) {
      resultDisplayItems.get(selectedIndex).setSelectedState(true);
      resultDisplayItems.get(selectedIndex).getElement().scrollIntoView();
    }
  }
  if (selectedIndex >= 0) {
    return resultDisplayItems.get(selectedIndex).getItemSelectionText();
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Selects the previous item in the drop down and change the item to it's selected style
 * @author Johannes Gryffenberg <johannes.gryffenberg@gmail.com>
 * @author Saurabh Chawla <saurabh.chawla@a24group.com>
 * @since  22 January 2013
 * @return The display text for the item
 */
public String selectPreviousItem(){
  if (hasResults && selectedIndex >= 0) {
    resultDisplayItems.get(selectedIndex).setSelectedState(false);
    selectedIndex--;
    if (selectedIndex >= 0) {
      resultDisplayItems.get(selectedIndex).setSelectedState(true);
      resultDisplayItems.get(selectedIndex).getElement().scrollIntoView();
    }
  }
  if (selectedIndex >= 0 && resultDisplayItems.size() > selectedIndex) {
    return resultDisplayItems.get(selectedIndex).getItemSelectionText();
  }
 else {
    return null;
  }
}
Program: 50629
Project: 50629
Buggy source:
/** 
 * This function will set the popup into a loading state to indicate that data is being loaded for popup
 * @author Ruan Naude <naudeuran777@gmail.com>
 * @since 15 July 2013
 * @param loading - Whether to set popup into loading state
 */
public void setLoadingState(boolean loading){
  this.loadingState=loading;
  setLoaderStateSize();
  loaderFlowPanel.setVisible(loading);
  popupContent.setVisible(!loading);
}

Fixed version (ground truth):
/** 
 * This function will set the popup into a loading state to indicate that data is being loaded for popup
 * @author Ruan Naude <naudeuran777@gmail.com>
 * @since 15 July 2013
 * @param loading - Whether to set popup into loading state
 */
public void setLoadingState(boolean loading){
  if (useArrow == false) {
    this.center();
  }
  this.loadingState=loading;
  setLoaderStateSize();
  loaderFlowPanel.setVisible(loading);
  popupContent.setVisible(!loading);
  if (useArrow == false) {
    this.center();
  }
}
Program: 50630
Project: 50630
Buggy source:
/** 
 * This will create a image with the url passed in by the constructor
 * @author Alec Erasmus <alec.erasmus@a24group.com>
 * @since 03 June 2013
 * @param context -The context the cell is in
 * @param value - The value to be added in the cell but not the image thats going to be displayed
 * @param sb -The safe html builder.
 */
@Override public void render(Context context,T value,SafeHtmlBuilder sb){
  actionList=column.getActions(value);
  boolean firstItem=true;
  for (  String action : actionList) {
    if (firstItem) {
      sb.append(template.firstAction(action));
      firstItem=false;
    }
 else {
      sb.append(template.actionSeparator(this.spacerSize));
      sb.append(template.action(action,this.spacerSize));
    }
  }
}

Fixed version (ground truth):
/** 
 * This will create a image with the url passed in by the constructor
 * @author Alec Erasmus <alec.erasmus@a24group.com>
 * @since 03 June 2013
 * @param context -The context the cell is in
 * @param value - The value to be added in the cell but not the image thats going to be displayed
 * @param sb -The safe html builder.
 */
@Override public void render(Context context,T value,SafeHtmlBuilder sb){
  displayActionList=column.getActions(value);
  boolean firstItem=true;
  for (  String action : displayActionList) {
    if (!actionList.contains(action)) {
      actionList.add(action);
    }
    if (firstItem) {
      sb.append(template.firstAction(action));
      firstItem=false;
    }
 else {
      sb.append(template.actionSeparator(this.spacerSize));
      sb.append(template.action(action,this.spacerSize));
    }
  }
}
Program: 50631
Project: 50631
Buggy source:
/** 
 * Set the complete list of values to display on one page
 * @param startRow - The start row the data is for
 * @param data - The data the should be displayed on the data grid
 * @author Lodewyk Duminy
 * @since 29 June 2012
 */
public void setRowData(int startRow,List<T> data){
  if (!firstDataSetGiven) {
    firstDataSetGiven=true;
    firstDataSet=true;
  }
  previousRange=dataGrid.getVisibleRange();
  if (data != null) {
    noContentLabel.setVisible(false);
    dataGrid.setRowData(startRow,data);
    refresh();
  }
 else {
    noContentLabel.setVisible(true);
  }
  if (previousRange.equals(dataGrid.getVisibleRange())) {
    doRangeChange=true;
    firstDataSet=false;
  }
}

Fixed version (ground truth):
/** 
 * Set the complete list of values to display on one page
 * @param startRow - The start row the data is for
 * @param data - The data the should be displayed on the data grid
 * @param rowsPerPage - The amount of records to display per page
 * @author Lodewyk Duminy
 * @since 29 June 2012
 */
public void setRowData(int startRow,List<T> data,int rowsPerPage){
  if (!firstDataSetGiven) {
    firstDataSetGiven=true;
    firstDataSet=true;
  }
  previousRange=dataGrid.getVisibleRange();
  if (data != null) {
    doRangeChange=false;
    noContentLabel.setVisible(false);
    if (rowsPerPage != 0) {
      Range range=new Range(startRow,rowsPerPage);
      dataGrid.setVisibleRangeAndClearData(range,true);
    }
    dataGrid.setRowData(startRow,data);
    refresh();
  }
 else {
    noContentLabel.setVisible(true);
  }
  if (previousRange.equals(dataGrid.getVisibleRange())) {
    doRangeChange=true;
    firstDataSet=false;
  }
}
Program: 50632
Project: 50632
Buggy source:
/** 
 * This function will check if there is already a default resource to use for the generic popup and if not one will be create a default resource
 * @author Ruan Naude <naudeuran777@gmail.com>
 * @since 15 July 2013
 * @return The default resource for the LeftMenuItem
 */
private static GenericPopupResource getDefaultResources(){
  if (DEFAULT_RESOURCE == null) {
    DEFAULT_RESOURCE=GWT.create(GenericPopupResource.class);
  }
  return DEFAULT_RESOURCE;
}

Fixed version (ground truth):
/** 
 * This function will check if there is already a default resource to use for the generic popup and if not one will be created
 * @author Ruan Naude <naudeuran777@gmail.com>
 * @since 15 July 2013
 * @return The default resource for the LeftMenuItem
 */
private static GenericPopupResource getDefaultResources(){
  if (DEFAULT_RESOURCE == null) {
    DEFAULT_RESOURCE=GWT.create(GenericPopupResource.class);
  }
  return DEFAULT_RESOURCE;
}
Program: 50634
Project: 50634
Buggy source:
/** 
 * Function used to update the input fields
 * @author Michael Barnard <michael.barnard@a24group.com>
 * @since  11 January 2012
 */
@Override protected void updateFieldData(){
  checkBox.setValue(getCriteria().isFindEmptyEntriesOnly());
  int index=0;
  if (bIsAdvancedMap) {
    index=findAdvancedIndexValue(getCriteria().getCriteria());
  }
 else {
    index=findIndexOf(getCriteria().getCriteria());
  }
  if (index != -1) {
    listBox.setSelectedIndex(index);
  }
 else {
    listBox.setSelectedIndex(0);
  }
  listBox.setEnabled(!checkBox.getValue());
}

Fixed version (ground truth):
/** 
 * Function used to update the input fields
 * @author Michael Barnard <michael.barnard@a24group.com>
 * @since  11 January 2012
 */
@Override protected void updateFieldData(){
  checkBox.setValue(getCriteria().isFindEmptyEntriesOnly());
  if (isMultiSelect()) {
    setMultiSelectListBoxValues();
  }
 else {
    setSingleSelectListBoxValue();
  }
  listBox.setEnabled(!checkBox.getValue());
}
Program: 50635
Project: 50635
Buggy source:
/** 
 * Class constructor
 * @param value - The initial value
 * @param min - The minimum value
 * @param max - The maximum value
 * @param minStep - The minimum value for stepping
 * @param maxStep - The maximum value for stepping
 * @param constrained - If set to false min and max value will not have any effect
 * @param valueBoxLabelText - The text to display on the value box label
 * @param resources - The styles and images used by this widget
 * @param images - The images used by the spinner
 */
public HourSpinner(long value,double min,double max,int minStep,int maxStep,boolean constrained,String valueBoxLabelText,ValueSpinnerResources resources,SpinnerResources images){
  super();
  setStylePrimaryName(STYLENAME_DEFAULT);
  long spinnerMin=(long)(min * 100);
  long spinnerMax=(long)(max * 100);
  if (images == null) {
    spinner=new Spinner(spinnerListener,value,spinnerMin,spinnerMax,minStep,maxStep,constrained);
  }
 else {
    spinner=new Spinner(spinnerListener,value,spinnerMin,spinnerMax,minStep,maxStep,constrained,images);
  }
  valueBox.setStyleName(TEXTBOX_STYLE);
  valueBox.addKeyPressHandler(keyPressHandler);
  spinnerContainer.add(valueBox);
  FlowPanel arrowsPanel=new FlowPanel();
  arrowsPanel.setStylePrimaryName(ARROW_STYLE);
  arrowsPanel.add(spinner.getIncrementArrow());
  arrowsPanel.add(spinner.getDecrementArrow());
  spinnerContainer.add(arrowsPanel);
  valueBoxLabel=new Label(valueBoxLabelText);
  add(spinnerContainer);
  add(valueBoxLabel);
}

Fixed version (ground truth):
/** 
 * Class constructor
 * @param value - The initial value
 * @param min - The minimum value
 * @param max - The maximum value
 * @param minStep - The minimum value for stepping
 * @param maxStep - The maximum value for stepping
 * @param constrained - If set to false min and max value will not have any effect
 * @param valueBoxLabelText - The text to display on the value box label
 * @param resources - The styles and images used by this widget
 * @param images - The images used by the spinner
 */
public HourSpinner(long value,double min,double max,int minStep,int maxStep,boolean constrained,String valueBoxLabelText,ValueSpinnerResources resources,SpinnerResources images){
  super();
  setStylePrimaryName(STYLENAME_DEFAULT);
  if (resources != null) {
    defaultResources=resources;
  }
  long spinnerMin=(long)(min * 100);
  long spinnerMax=(long)(max * 100);
  if (images == null) {
    spinner=new Spinner(spinnerListener,value,spinnerMin,spinnerMax,minStep,maxStep,constrained);
  }
 else {
    spinner=new Spinner(spinnerListener,value,spinnerMin,spinnerMax,minStep,maxStep,constrained,images);
  }
  valueBox.setStyleName(TEXTBOX_STYLE);
  valueBox.addKeyPressHandler(keyPressHandler);
  spinnerContainer.add(valueBox);
  FlowPanel arrowsPanel=new FlowPanel();
  arrowsPanel.setStylePrimaryName(ARROW_STYLE);
  arrowsPanel.add(spinner.getIncrementArrow());
  arrowsPanel.add(spinner.getDecrementArrow());
  spinnerContainer.add(arrowsPanel);
  valueBoxLabel=new Label(valueBoxLabelText);
  add(spinnerContainer);
  add(valueBoxLabel);
}
Program: 50636
Project: 50636
Buggy source:
/** 
 * Sets whether this widget is enabled.
 * @author Alec Erasmus <alec.erasmus@a24group.com>
 * @since  08 July 2013
 * @param enabled - true to enable the widget, false to disable it
 */
public void setTextBoxReadOnly(boolean enabled){
  valueBox.setReadOnly(enabled);
}

Fixed version (ground truth):
/** 
 * Sets the text box to ready only or not.
 * @author Alec Erasmus <alec.erasmus@a24group.com>
 * @since  08 July 2013
 * @param enabled - true to set the textbox to read only, false to enable it
 */
public void setTextBoxReadOnly(boolean enabled){
  valueBox.setReadOnly(enabled);
}
Program: 50637
Project: 50637
Buggy source:
/** 
 * On the value change of the spinner
 * @author Alec Erasmus <alec.erasmus@a24group.com>
 * @since  08 July 2013
 */
@Override public void onSpinning(long value){
  if (getSpinner() != null) {
    getSpinner().setValue(value,false);
  }
  valueBox.setText(formatValue(value));
}

Fixed version (ground truth):
/** 
 * On the value change of the spinner
 * @author Alec Erasmus <alec.erasmus@a24group.com>
 * @since  08 July 2013
 * @param value - The new value to set on the spinner
 */
@Override public void onSpinning(long value){
  if (getSpinner() != null) {
    getSpinner().setValue(value,false);
  }
  valueBox.setText(formatValue(value));
}
Program: 50638
Project: 50638
Buggy source:
/** 
 * Displays the popup relative to the cell
 * @author Alec Erasmus <alec.erasmus@a24group.com>
 * @since  17 June 2013
 * @param data - The data that will be set in the popup
 */
private void displayPopup(){
  this.popup.center();
  this.popup.setData(column.getRowData());
  this.popup.setPopupPosition(this.parent.getAbsoluteLeft(),(this.parent.getAbsoluteTop() + this.parent.getOffsetHeight() + 10));
}

Fixed version (ground truth):
/** 
 * Displays the popup relative to the cell
 * @author Alec Erasmus <alec.erasmus@a24group.com>
 * @since  17 June 2013
 */
private void displayPopup(){
  this.popup.center();
  this.popup.setData(column.getRowData());
  this.popup.setPopupPosition(this.parent.getAbsoluteLeft(),(this.parent.getAbsoluteTop() + this.parent.getOffsetHeight() + 10));
}
Program: 50639
Project: 50639
Buggy source:
/** 
 * This function return the data represented by the row. If you use a custom popup fir the tool tip you need to override this function
 * @author Alec Erasmus <alec.erasmus@a24group.com>
 * @since  17 June 2013
 * @return the data in the row
 */
public T getRowData(){
  System.out.println("String_Node_Str");
  return null;
}

Fixed version (ground truth):
/** 
 * This function return the data represented by the row. If you use a custom popup fir the tool tip you need to override this function
 * @author Alec Erasmus <alec.erasmus@a24group.com>
 * @since  17 June 2013
 * @return the data in the row
 */
public T getRowData(){
  return null;
}
Program: 50640
Project: 50640
Buggy source:
/** 
 * Get the filters added to the datagrid and if the column is a sort able column, the field name
 * @author Alec Erasmus <alec.erasmus@a24group.com>
 * @since  05 June 2013
 * @return HashMap - Key is the filter and the value(if column is a sort able column else empty) is field name
 */
public HashMap<AbstractHeaderFilter,String> getFilters(){
  return filterColumns;
}

Fixed version (ground truth):
/** 
 * Get the filters added to the datagrid and if the column is a sortable column, the field name
 * @author Alec Erasmus <alec.erasmus@a24group.com>
 * @since  05 June 2013
 * @return HashMap - Key is the filter and the value(if column is a sortable column else empty) is field name
 */
public HashMap<AbstractHeaderFilter,String> getFilters(){
  return filterColumns;
}
Program: 50641
Project: 50641
Buggy source:
/** 
 * The function that is called on the value change of the startTimePicker Reset the start time picker date(not time) if the time picker have made a loop. Set the new max and end date, selectable by the end date date picker. Reset the end date fields to the same as the start date fields
 * @author Alec Erasmus <alec.erasmus@a24group.com>
 * @since 15 May 2013
 * @param date - The new date selected
 */
private void onStartTimePickerValueChange(Date date){
  if (date.getMinutes() % 15 != 0) {
    startTimePicker.setDateTime(getRestDate(date));
  }
  if (date.getHours() % 24 == 0) {
    startTimePicker.setDate(startDateBox.getValue());
  }
  if (startTimePicker.getDateTime().getDay() != startDateBox.getValue().getDay()) {
    startTimePicker.setDate(startDateBox.getValue());
  }
  endTimePicker.setMinDate(getShiftMinDate());
  endTimePicker.setMaxDate(getShiftMaxDate());
  endTimePicker.setDateTime(getShiftMinDate());
  endDateBox.setValue(startDateBox.getValue());
  totalTime.setText(getShiftTimeDiff(startTimePicker.getDateTime(),endTimePicker.getDateTime()));
}

Fixed version (ground truth):
/** 
 * The function that is called on the value change of the startTimePicker Reset the start time picker date(not time) if the time picker have made a loop. Set the new max and end date, selectable by the end date date picker. Reset the end date fields to the same as the start date fields
 * @author Alec Erasmus <alec.erasmus@a24group.com>
 * @since 15 May 2013
 * @param date - The new date selected
 */
private void onStartTimePickerValueChange(Date date){
  if (date.getMinutes() % 15 != 0) {
    startTimePicker.setDateTime(getRestDate(date));
  }
  if (date.getHours() % 24 == 0) {
    startTimePicker.setDate(startDateBox.getValue());
  }
  if (startTimePicker.getDateTime().getDay() != startDateBox.getValue().getDay()) {
    startTimePicker.setDate(startDateBox.getValue());
  }
  endTimePicker.setMinDate(getShiftMinDate());
  endTimePicker.setMaxDate(getShiftMaxDate());
  endTimePicker.setDateTime(getShiftMinDate());
  endDateBox.setValue(startDateBox.getValue());
  onEndDateBoxValueChange(startDateBox.getValue());
  totalTime.setText(getShiftTimeDiff(startTimePicker.getDateTime(),endTimePicker.getDateTime()));
}
Program: 50642
Project: 50642
Buggy source:
/** 
 * Get the total number min and hours of a shift. Note the max date time is 24 hours. If the the diff is 0 is seen as a 24h shift
 * @author Alec Erasmus <alec.erasmus@a24group.com>
 * @since 15 May 2013
 * @param startDate - The shift start date
 * @param endDate - The shift end date
 * @return the shift is format "(H.M)"
 */
public String getShiftTimeDiff(Date startDate,Date endDate){
  boolean reversed=false;
  if (endDate.getTime() < startDate.getTime()) {
    reversed=true;
  }
  int shiftTotalHours=(int)(((endDate.getTime() - startDate.getTime()) / (1000 * 60 * 60)));
  int shiftTotalMin=(int)(((endDate.getTime() - startDate.getTime()) / (1000 * 60)) % 60);
  if (shiftTotalMin == 59) {
    shiftTotalMin=0;
    shiftTotalHours++;
  }
 else   if (shiftTotalMin % 15 == 14) {
    shiftTotalMin++;
  }
  int totalMinAndHours=(shiftTotalHours * 60) + shiftTotalMin;
  if (totalMinAndHours >= 1441 || totalMinAndHours <= 1439) {
    if (endDate.getTime() - startDate.getTime() > 86399000) {
      shiftTotalHours=24;
      totalMinAndHours=1440;
      shiftTotalMin=0;
    }
  }
  if (((15 - (shiftTotalMin % 15) < 1)) || (totalMinAndHours > 1440) || reversed == true) {
    return "String_Node_Str";
  }
  if (shiftTotalMin == 0) {
    return "String_Node_Str" + shiftTotalHours + "String_Node_Str";
  }
  String displayedMinutes=String.valueOf((int)((Math.ceil(shiftTotalMin) / 60) * 100)).replaceAll("String_Node_Str","String_Node_Str");
  return "String_Node_Str" + shiftTotalHours + "String_Node_Str"+ displayedMinutes+ "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * Get the total number min and hours of a shift. Note the max date time is 24 hours. If the the diff is 0 is seen as a 24h shift
 * @author Alec Erasmus <alec.erasmus@a24group.com>
 * @since 15 May 2013
 * @param startDate - The shift start date
 * @param endDate - The shift end date
 * @return the shift is format "(H.M)"
 */
public String getShiftTimeDiff(Date startDate,Date endDate){
  boolean reversed=false;
  if (endDate.getTime() < startDate.getTime() - 1000) {
    reversed=true;
  }
  int shiftTotalHours=(int)(((endDate.getTime() - startDate.getTime()) / (1000 * 60 * 60)));
  int shiftTotalMin=(int)(((endDate.getTime() - startDate.getTime()) / (1000 * 60)) % 60);
  if (shiftTotalMin == 59) {
    shiftTotalMin=0;
    shiftTotalHours++;
  }
 else   if (shiftTotalMin % 15 == 14) {
    shiftTotalMin++;
  }
  int totalMinAndHours=(shiftTotalHours * 60) + shiftTotalMin;
  if (totalMinAndHours >= 1441 || totalMinAndHours <= 1439) {
    if (endDate.getTime() - startDate.getTime() > 86399000) {
      shiftTotalHours=24;
      totalMinAndHours=1440;
      shiftTotalMin=0;
    }
  }
  if (((15 - (shiftTotalMin % 15) < 1)) || (totalMinAndHours > 1440) || reversed) {
    return "String_Node_Str";
  }
  if (shiftTotalMin == 0) {
    return "String_Node_Str" + shiftTotalHours + "String_Node_Str";
  }
  String displayedMinutes=String.valueOf((int)((Math.ceil(shiftTotalMin) / 60) * 100)).replaceAll("String_Node_Str","String_Node_Str");
  return "String_Node_Str" + shiftTotalHours + "String_Node_Str"+ displayedMinutes+ "String_Node_Str";
}
Program: 50643
Project: 50643
Buggy source:
/** 
 * Setter that updates the state of the filter
 * @param filterActive - Flag indicating if the filter is active
 */
public void setFilterActive(boolean filterActive){
  this.filterActive=filterActive;
  if (parent != null) {
    Element filterImageElement=getImageElement(parent);
    Element filterImageParentElement=filterImageElement.getParentElement();
    if (filterActive) {
      replaceImageElement(resources.filterIconActive(),filterImageElement,filterImageParentElement);
    }
 else {
      replaceImageElement(resources.filterIconInactive(),filterImageElement,filterImageParentElement);
    }
    FilterChangeEvent.fire(this);
  }
}

Fixed version (ground truth):
/** 
 * Setter that updates the state of the filter
 * @param filterActive - Flag indicating if the filter is active
 * @author Ruan Naude <ruan.naude@a24group.com>
 * @since 04 April 2013
 */
public void setFilterActive(boolean filterActive){
  this.filterActive=filterActive;
  setFilterActiveUpdateOnParent(true);
}
Program: 50644
Project: 50644
Buggy source:
/** 
 * Adds a column to the data grid with a FilterSortHeader as a header
 * @param col - The column that should be added to the data grid
 * @param label - The label that should be displayed in the header
 * @param filterWidget - The filter widget that should be displayed if the user clicks on the filter icon
 */
public void addFilterColumn(Column<T,?> col,String label,AbstractHeaderFilter filterWidget){
  FilterSortHeader header=new FilterSortHeader(label,filterWidget);
  this.addColumn(col,header);
}

Fixed version (ground truth):
/** 
 * Adds a column to the data grid with a FilterSortHeader as a header
 * @param col - The column that should be added to the data grid
 * @param label - The label that should be displayed in the header
 * @param filterWidget - The filter widget that should be displayed if the user clicks on the filter icon
 */
public void addFilterColumn(Column<T,?> col,String label,AbstractHeaderFilter filterWidget){
  filterWidgets.put(label,filterWidget);
  FilterSortHeader header=new FilterSortHeader(label,filterWidget);
  this.addColumn(col,header);
}
Program: 50645
Project: 50645
Buggy source:
/** 
 * This function will determin whether the DataGridRangeChangeEvent should be fired.
 * @param event The range change event being handled
 * @author Ruan Naude <nauderuan777@gmail.com>
 * @since 04 March 2013
 */
@Override public void onRangeChange(RangeChangeEvent event){
  if (doRangeChange && !firstDataSet) {
    DataGridRangeChangeEvent.fire(this,event.getNewRange());
  }
 else {
    doRangeChange=true;
    firstDataSet=false;
  }
}

Fixed version (ground truth):
/** 
 * This function will determine whether the DataGridRangeChangeEvent should be fired.
 * @param event The range change event being handled
 * @author Ruan Naude <nauderuan777@gmail.com>
 * @since 04 March 2013
 */
@Override public void onRangeChange(RangeChangeEvent event){
  if (doRangeChange && !firstDataSet) {
    DataGridRangeChangeEvent.fire(this,event.getNewRange());
  }
 else {
    doRangeChange=true;
    firstDataSet=false;
  }
}
Program: 50646
Project: 50646
Buggy source:
/** 
 * This will set the organisation record to the selected state by updating style accordingly
 * @author Michael Barnard <michael.barnard@a24group.com>
 * @since  19 March 2013
 */
@Override public void setSelectedState(boolean selected){
  if (selected) {
    searchBoxClientRecord.addStyleName(resources.searchBoxClientRecordStyle().searchBoxClientRecordSelected());
    siteLabel.addStyleName(resources.searchBoxClientRecordStyle().organisationLabelSelected());
    avatarImage.addStyleName(resources.searchBoxClientRecordStyle().avatarImageSelected());
  }
 else {
    searchBoxClientRecord.removeStyleName(resources.searchBoxClientRecordStyle().searchBoxClientRecordSelected());
    siteLabel.removeStyleName(resources.searchBoxClientRecordStyle().organisationLabelSelected());
    avatarImage.removeStyleName(resources.searchBoxClientRecordStyle().avatarImageSelected());
  }
}

Fixed version (ground truth):
/** 
 * This will set the organisation record to the selected state by updating style accordingly
 * @author Michael Barnard <michael.barnard@a24group.com>
 * @since  19 March 2013
 */
@Override public void setSelectedState(boolean selected){
  if (selected) {
    searchBoxClientRecord.addStyleName(resources.searchBoxClientRecordStyle().searchBoxClientRecordSelected());
    siteLabel.addStyleName(resources.searchBoxClientRecordStyle().siteLabelSelected());
    avatarImage.addStyleName(resources.searchBoxClientRecordStyle().avatarImageSelected());
  }
 else {
    searchBoxClientRecord.removeStyleName(resources.searchBoxClientRecordStyle().searchBoxClientRecordSelected());
    siteLabel.removeStyleName(resources.searchBoxClientRecordStyle().siteLabelSelected());
    avatarImage.removeStyleName(resources.searchBoxClientRecordStyle().avatarImageSelected());
  }
}