nus-yam/ex-repair huggingface dataset:
Program: 167272
Project: 167272
Buggy source:
/** 
 * This translates all autoBEChain, autoE2EChain, and autoDFOChain into low level sinks taking the failover chain mangers info into account.
 */
@Override public String translateSink(String lnode,String sink) throws FlumeSpecException {
  Preconditions.checkArgument(lnode != null);
  Preconditions.checkArgument(sink != null);
  String xsink;
  try {
    List<String> failovers=failchainMan.getFailovers(lnode);
    xsink=FlumeSpecGen.genEventSink(substBEChains(sink,failovers));
    xsink=FlumeSpecGen.genEventSink(substDFOChainsNoLet(xsink,failovers));
    xsink=FlumeSpecGen.genEventSink(substE2EChains(xsink,failovers));
    return xsink;
  }
 catch (  RecognitionException e) {
    throw new FlumeSpecException(e.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * This translates all autoBEChain, autoE2EChain, and autoDFOChain into low level sinks taking the failover chain mangers info into account.
 */
@Override public String translateSink(String lnode,String sink) throws FlumeSpecException {
  Preconditions.checkArgument(lnode != null);
  Preconditions.checkArgument(sink != null);
  String xsink;
  try {
    List<String> failovers=failchainMan.getFailovers(lnode);
    xsink=FlumeSpecGen.genEventSink(substBEChains(sink,failovers));
    xsink=FlumeSpecGen.genEventSink(substDFOChainsNoLet(xsink,failovers));
    xsink=FlumeSpecGen.genEventSink(substE2EChainsSimple(xsink,failovers));
    return xsink;
  }
 catch (  RecognitionException e) {
    throw new FlumeSpecException(e.getMessage());
  }
}
Program: 167274
Project: 167274
Buggy source:
public AuthenticationStatus authenticate(String userName,String password,ApplicationContext context){
  ISecurityService securityService=context.getSecurityService();
  IOperationsService operationsService=context.getOperationsSerivce();
  User user=operationsService.findUserByLoginId(userName);
  String passwordHash=securityService.hash(user.getSalt(),password);
  if (user.getPassword() != null && user.getPassword().equals(passwordHash)) {
    GlobalSetting expireSetting=context.getOperationsSerivce().findGlobalSetting(GlobalSetting.PASSWORD_EXPIRE_DAYS,Integer.toString(GlobalSetting.PASSWORD_EXPIRE_DAYS_DEFAULT));
    int passwordExpiresInDays=Integer.parseInt(expireSetting.getValue());
    Date expireTime=DateUtils.addDays(new Date(),-passwordExpiresInDays);
    if (passwordExpiresInDays > 0 && (user.getLastPasswordTime() == null || user.getLastPasswordTime().before(expireTime))) {
      return AuthenticationStatus.EXPIRED;
    }
    return AuthenticationStatus.VALID;
  }
  return AuthenticationStatus.INVALID;
}

Fixed version (ground truth):
public AuthenticationStatus authenticate(String userName,String password,ApplicationContext context){
  ISecurityService securityService=context.getSecurityService();
  IOperationsService operationsService=context.getOperationsService();
  User user=operationsService.findUserByLoginId(userName);
  String passwordHash=securityService.hash(user.getSalt(),password);
  if (user.getPassword() != null && user.getPassword().equals(passwordHash)) {
    GlobalSetting expireSetting=context.getOperationsService().findGlobalSetting(GlobalSetting.PASSWORD_EXPIRE_DAYS,Integer.toString(GlobalSetting.PASSWORD_EXPIRE_DAYS_DEFAULT));
    int passwordExpiresInDays=Integer.parseInt(expireSetting.getValue());
    Date expireTime=DateUtils.addDays(new Date(),-passwordExpiresInDays);
    if (passwordExpiresInDays > 0 && (user.getLastPasswordTime() == null || user.getLastPasswordTime().before(expireTime))) {
      return AuthenticationStatus.EXPIRED;
    }
    return AuthenticationStatus.VALID;
  }
  return AuthenticationStatus.INVALID;
}
Program: 167275
Project: 167275
Buggy source:
protected GlobalSetting getGlobalSetting(String name,String defaultValue){
  GlobalSetting setting=context.getOperationsSerivce().findGlobalSetting(name);
  if (setting == null) {
    setting=new GlobalSetting();
    setting.setName(name);
    setting.setValue(defaultValue);
  }
  return setting;
}

Fixed version (ground truth):
protected GlobalSetting getGlobalSetting(String name,String defaultValue){
  GlobalSetting setting=context.getOperationsService().findGlobalSetting(name);
  if (setting == null) {
    setting=new GlobalSetting();
    setting.setName(name);
    setting.setValue(defaultValue);
  }
  return setting;
}
Program: 167277
Project: 167277
Buggy source:
protected void changePassword(){
  ISecurityService securityService=context.getSecurityService();
  IOperationsService operationsService=context.getOperationsSerivce();
  User user=context.getUser();
  String password=securityService.hash(user.getSalt(),currentPasswordField.getValue());
  if (user != null && user.getPassword() != null && user.getPassword().equals(password)) {
    if (testNewPassword()) {
      operationsService.savePassword(user,newPasswordField.getValue());
      close();
    }
  }
 else {
    String address=Page.getCurrent().getWebBrowser().getAddress();
    log.warn("String_Node_Str" + user.getLoginId() + "String_Node_Str"+ address);
    notify("String_Node_Str","String_Node_Str");
    currentPasswordField.selectAll();
  }
}

Fixed version (ground truth):
protected void changePassword(){
  ISecurityService securityService=context.getSecurityService();
  IOperationsService operationsService=context.getOperationsService();
  User user=context.getUser();
  String password=securityService.hash(user.getSalt(),currentPasswordField.getValue());
  if (user != null && user.getPassword() != null && user.getPassword().equals(password)) {
    if (testNewPassword()) {
      operationsService.savePassword(user,newPasswordField.getValue());
      close();
    }
  }
 else {
    String address=Page.getCurrent().getWebBrowser().getAddress();
    log.warn("String_Node_Str" + user.getLoginId() + "String_Node_Str"+ address);
    notify("String_Node_Str","String_Node_Str");
    currentPasswordField.selectAll();
  }
}
Program: 167280
Project: 167280
Buggy source:
@Override public void selected(){
  if (grid != null) {
    removeComponent(grid);
  }
  grid=new Grid();
  BeanContainer<AuditEvent,AuditEvent> container=new BeanContainer<>(AuditEvent.class);
  grid.setContainerDataSource(container);
  grid.setColumnOrder("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  grid.getColumn("String_Node_Str").setHeaderCaption("String_Node_Str");
  grid.getColumn("String_Node_Str").setHeaderCaption("String_Node_Str");
  grid.getColumn("String_Node_Str").setHeaderCaption("String_Node_Str");
  grid.removeColumn("String_Node_Str");
  grid.removeColumn("String_Node_Str");
  grid.removeColumn("String_Node_Str");
  grid.removeColumn("String_Node_Str");
  grid.setSizeFull();
  List<AuditEvent> list=context.getOperationsSerivce().findAuditEvents(-1);
  for (  AuditEvent event : list) {
    container.addItem(event,event);
  }
  addComponent(grid);
  setExpandRatio(grid,1);
}

Fixed version (ground truth):
@Override public void selected(){
  if (grid != null) {
    removeComponent(grid);
  }
  grid=new Grid();
  BeanContainer<AuditEvent,AuditEvent> container=new BeanContainer<>(AuditEvent.class);
  grid.setContainerDataSource(container);
  grid.setColumnOrder("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  grid.getColumn("String_Node_Str").setHeaderCaption("String_Node_Str");
  grid.getColumn("String_Node_Str").setHeaderCaption("String_Node_Str");
  grid.getColumn("String_Node_Str").setHeaderCaption("String_Node_Str");
  grid.removeColumn("String_Node_Str");
  grid.removeColumn("String_Node_Str");
  grid.removeColumn("String_Node_Str");
  grid.removeColumn("String_Node_Str");
  grid.setSizeFull();
  List<AuditEvent> list=context.getOperationsService().findAuditEvents(-1);
  for (  AuditEvent event : list) {
    container.addItem(event,event);
  }
  addComponent(grid);
  setExpandRatio(grid,1);
}
Program: 167281
Project: 167281
Buggy source:
private GlobalSetting getGlobalSetting(String name,String defaultValue){
  GlobalSetting setting=context.getOperationsSerivce().findGlobalSetting(name);
  if (setting == null) {
    setting=new GlobalSetting();
    setting.setName(name);
    setting.setValue(defaultValue);
  }
  return setting;
}

Fixed version (ground truth):
private GlobalSetting getGlobalSetting(String name,String defaultValue){
  GlobalSetting setting=context.getOperationsService().findGlobalSetting(name);
  if (setting == null) {
    setting=new GlobalSetting();
    setting.setName(name);
    setting.setValue(defaultValue);
  }
  return setting;
}
Program: 167282
Project: 167282
Buggy source:
public void buttonClick(ClickEvent event){
  List<User> users=new ArrayList<User>();
  for (  Group group : getSelectedItems()) {
    users.addAll(context.getOperationsSerivce().findUsersByGroup(group.getId()));
    if (users.size() > 10) {
      break;
    }
  }
  if (users.size() == 0) {
    for (    Group group : getSelectedItems()) {
      context.getConfigurationService().delete(group);
      container.removeItem(group);
    }
  }
 else {
    String message="String_Node_Str" + users.size() + "String_Node_Str"+ "String_Node_Str";
    if (users.size() < 10) {
      message+=users.toString();
    }
    Notification note=new Notification("String_Node_Str",message);
    note.show(Page.getCurrent());
  }
  table.setValue(null);
  setButtonsEnabled();
}

Fixed version (ground truth):
public void buttonClick(ClickEvent event){
  List<User> users=new ArrayList<User>();
  for (  Group group : getSelectedItems()) {
    users.addAll(context.getOperationsService().findUsersByGroup(group.getId()));
    if (users.size() > 10) {
      break;
    }
  }
  if (users.size() == 0) {
    for (    Group group : getSelectedItems()) {
      context.getConfigurationService().delete(group);
      container.removeItem(group);
    }
  }
 else {
    String message="String_Node_Str" + users.size() + "String_Node_Str"+ "String_Node_Str";
    if (users.size() < 10) {
      message+=users.toString();
    }
    Notification note=new Notification("String_Node_Str",message);
    note.show(Page.getCurrent());
  }
  table.setValue(null);
  setButtonsEnabled();
}
Program: 167283
Project: 167283
Buggy source:
public void refresh(){
  container.removeAllItems();
  container.addAll(context.getOperationsSerivce().findGroups());
  table.sort();
  setButtonsEnabled();
}

Fixed version (ground truth):
public void refresh(){
  container.removeAllItems();
  container.addAll(context.getOperationsService().findGroups());
  table.sort();
  setButtonsEnabled();
}
Program: 167284
Project: 167284
Buggy source:
@Override public boolean closing(){
  if (isChanged) {
    for (    Agent agent : context.getOperationsSerivce().findAgents()) {
      if (!agent.isDeleted() && agent.getStatus().equals(AgentStatus.RUNNING.name())) {
        agent.setStatus(AgentStatus.REQUEST_REFRESH.name());
        context.getConfigurationService().save(agent);
      }
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean closing(){
  if (isChanged) {
    for (    Agent agent : context.getOperationsService().findAgents()) {
      if (!agent.isDeleted() && agent.getStatus().equals(AgentStatus.RUNNING.name())) {
        agent.setStatus(AgentStatus.REQUEST_REFRESH.name());
        context.getConfigurationService().save(agent);
      }
    }
  }
  return true;
}
Program: 167285
Project: 167285
Buggy source:
private GlobalSetting getGlobalSetting(String name,String defaultValue){
  GlobalSetting setting=context.getOperationsSerivce().findGlobalSetting(name);
  if (setting == null) {
    setting=new GlobalSetting();
    setting.setName(name);
    setting.setValue(defaultValue);
  }
  return setting;
}

Fixed version (ground truth):
private GlobalSetting getGlobalSetting(String name,String defaultValue){
  GlobalSetting setting=context.getOperationsService().findGlobalSetting(name);
  if (setting == null) {
    setting=new GlobalSetting();
    setting.setName(name);
    setting.setValue(defaultValue);
  }
  return setting;
}
Program: 167286
Project: 167286
Buggy source:
@Override public boolean closing(){
  if (isChanged) {
    for (    Agent agent : context.getOperationsSerivce().findAgents()) {
      if (!agent.isDeleted() && agent.getStatus().equals(AgentStatus.RUNNING.name())) {
        agent.setStatus(AgentStatus.REQUEST_REFRESH.name());
        context.getConfigurationService().save(agent);
      }
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean closing(){
  if (isChanged) {
    for (    Agent agent : context.getOperationsService().findAgents()) {
      if (!agent.isDeleted() && agent.getStatus().equals(AgentStatus.RUNNING.name())) {
        agent.setStatus(AgentStatus.REQUEST_REFRESH.name());
        context.getConfigurationService().save(agent);
      }
    }
  }
  return true;
}
Program: 167287
Project: 167287
Buggy source:
private GlobalSetting getGlobalSetting(String name,String defaultValue){
  GlobalSetting setting=context.getOperationsSerivce().findGlobalSetting(name);
  if (setting == null) {
    setting=new GlobalSetting();
    setting.setName(name);
    setting.setValue(defaultValue);
  }
  return setting;
}

Fixed version (ground truth):
private GlobalSetting getGlobalSetting(String name,String defaultValue){
  GlobalSetting setting=context.getOperationsService().findGlobalSetting(name);
  if (setting == null) {
    setting=new GlobalSetting();
    setting.setName(name);
    setting.setValue(defaultValue);
  }
  return setting;
}
Program: 167288
Project: 167288
Buggy source:
public void buttonClick(ClickEvent event){
  MailSession mailSession=new MailSession(context.getOperationsSerivce().findGlobalSettingsAsMap());
  try {
    mailSession.getTransport();
    CommonUiUtils.notify("String_Node_Str","String_Node_Str");
  }
 catch (  AuthenticationFailedException e) {
    CommonUiUtils.notify("String_Node_Str","String_Node_Str" + e.getMessage(),Type.ERROR_MESSAGE);
    log.warn("String_Node_Str",e);
  }
catch (  MessagingException e) {
    CommonUiUtils.notify("String_Node_Str","String_Node_Str" + e.getMessage(),Type.ERROR_MESSAGE);
    log.warn("String_Node_Str",e);
  }
 finally {
    mailSession.closeTransport();
  }
}

Fixed version (ground truth):
public void buttonClick(ClickEvent event){
  MailSession mailSession=new MailSession(context.getOperationsService().findGlobalSettingsAsMap());
  try {
    mailSession.getTransport();
    CommonUiUtils.notify("String_Node_Str","String_Node_Str");
  }
 catch (  AuthenticationFailedException e) {
    CommonUiUtils.notify("String_Node_Str","String_Node_Str" + e.getMessage(),Type.ERROR_MESSAGE);
    log.warn("String_Node_Str",e);
  }
catch (  MessagingException e) {
    CommonUiUtils.notify("String_Node_Str","String_Node_Str" + e.getMessage(),Type.ERROR_MESSAGE);
    log.warn("String_Node_Str",e);
  }
 finally {
    mailSession.closeTransport();
  }
}
Program: 167289
Project: 167289
Buggy source:
private void updateLinks(){
  String level=(String)levelField.getValue();
  linkField.removeAllItems();
  if (level.equals(Notification.NotificationLevel.GLOBAL.toString())) {
    linkField.setEnabled(false);
  }
 else   if (level.equals(Notification.NotificationLevel.AGENT.toString())) {
    linkField.setEnabled(true);
    for (    Agent agent : context.getOperationsSerivce().findAgents()) {
      if (agent.isDeleted()) {
        linkField.addItem(agent.getId());
        linkField.setItemCaption(agent.getId(),agent.getName());
      }
    }
  }
 else   if (level.equals(Notification.NotificationLevel.DEPLOYMENT.toString())) {
    linkField.setEnabled(true);
    List<Agent> agents=context.getOperationsSerivce().findAgents();
    for (    Agent agent : agents) {
      if (!agent.isDeleted()) {
        agent=context.getOperationsSerivce().findAgent(agent.getId(),true);
        for (        AgentDeploy deployment : agent.getAgentDeployments()) {
          linkField.addItem(deployment.getId());
          linkField.setItemCaption(deployment.getId(),agent.getName() + "String_Node_Str" + deployment.getName());
        }
      }
    }
  }
}

Fixed version (ground truth):
private void updateLinks(){
  String level=(String)levelField.getValue();
  linkField.removeAllItems();
  if (level.equals(Notification.NotificationLevel.GLOBAL.toString())) {
    linkField.setEnabled(false);
  }
 else   if (level.equals(Notification.NotificationLevel.AGENT.toString())) {
    linkField.setEnabled(true);
    for (    Agent agent : context.getOperationsService().findAgents()) {
      if (agent.isDeleted()) {
        linkField.addItem(agent.getId());
        linkField.setItemCaption(agent.getId(),agent.getName());
      }
    }
  }
 else   if (level.equals(Notification.NotificationLevel.DEPLOYMENT.toString())) {
    linkField.setEnabled(true);
    List<Agent> agents=context.getOperationsService().findAgents();
    for (    Agent agent : agents) {
      if (!agent.isDeleted()) {
        agent=context.getOperationsService().findAgent(agent.getId(),true);
        for (        AgentDeploy deployment : agent.getAgentDeployments()) {
          linkField.addItem(deployment.getId());
          linkField.setItemCaption(deployment.getId(),agent.getName() + "String_Node_Str" + deployment.getName());
        }
      }
    }
  }
}
Program: 167290
Project: 167290
Buggy source:
@Override public boolean closing(){
  if (isChanged) {
    String level=notification.getNotificationLevel();
    if (level.equals(Notification.NotificationLevel.GLOBAL.toString())) {
      for (      Agent agent : context.getOperationsSerivce().findAgents()) {
        refreshAgent(agent);
      }
    }
 else     if (level.equals(Notification.NotificationLevel.AGENT.toString()) && notification.getLinkId() != null) {
      refreshAgent(context.getOperationsSerivce().findAgent(notification.getLinkId(),false));
    }
 else     if (level.equals(Notification.NotificationLevel.DEPLOYMENT.toString()) && notification.getLinkId() != null) {
      AgentDeploy deployment=context.getOperationsSerivce().findAgentDeployment(notification.getLinkId());
      if (deployment != null) {
        refreshAgent(context.getOperationsSerivce().findAgent(deployment.getAgentId(),false));
      }
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean closing(){
  if (isChanged) {
    String level=notification.getNotificationLevel();
    if (level.equals(Notification.NotificationLevel.GLOBAL.toString())) {
      for (      Agent agent : context.getOperationsService().findAgents()) {
        refreshAgent(agent);
      }
    }
 else     if (level.equals(Notification.NotificationLevel.AGENT.toString()) && notification.getLinkId() != null) {
      refreshAgent(context.getOperationsService().findAgent(notification.getLinkId(),false));
    }
 else     if (level.equals(Notification.NotificationLevel.DEPLOYMENT.toString()) && notification.getLinkId() != null) {
      AgentDeploy deployment=context.getOperationsService().findAgentDeployment(notification.getLinkId());
      if (deployment != null) {
        refreshAgent(context.getOperationsService().findAgent(deployment.getAgentId(),false));
      }
    }
  }
  return true;
}
Program: 167291
Project: 167291
Buggy source:
public void refresh(){
  container.removeAllItems();
  if (StringUtils.isEmpty(filterField.getValue())) {
    container.addAll(context.getOperationsSerivce().findNotifications());
  }
 else {
    String filter=filterField.getValue().toUpperCase();
    for (    Notification notification : context.getOperationsSerivce().findNotifications()) {
      if (notification.getNotificationLevel().indexOf(filter) != -1 || notification.getName().indexOf(filter) != -1 || notification.getEventType().indexOf(filter) != -1) {
        container.addItem(notification);
      }
    }
  }
  table.sort();
  setButtonsEnabled();
}

Fixed version (ground truth):
public void refresh(){
  container.removeAllItems();
  if (StringUtils.isEmpty(filterField.getValue())) {
    container.addAll(context.getOperationsService().findNotifications());
  }
 else {
    String filter=filterField.getValue().toUpperCase();
    for (    Notification notification : context.getOperationsService().findNotifications()) {
      if (notification.getNotificationLevel().indexOf(filter) != -1 || notification.getName().indexOf(filter) != -1 || notification.getEventType().indexOf(filter) != -1) {
        container.addItem(notification);
      }
    }
  }
  table.sort();
  setButtonsEnabled();
}
Program: 167293
Project: 167293
Buggy source:
@SuppressWarnings("String_Node_Str") public void valueChange(ValueChangeEvent event){
  Set<String> groups=(Set<String>)event.getProperty().getValue();
  IOperationsService operationsSerivce=context.getOperationsSerivce();
  for (  String id : groups) {
    if (!lastGroups.contains(id)) {
      UserGroup userGroup=new UserGroup(user.getId(),id);
      user.getGroups().add(groupsById.get(id));
      if (operationsSerivce.findUser(user.getId()) != null) {
        context.getConfigurationService().save(userGroup);
      }
    }
  }
  for (  String id : lastGroups) {
    if (!groups.contains(id)) {
      user.getGroups().remove(groupsById.get(id));
      if (operationsSerivce.findUser(user.getId()) != null) {
        context.getConfigurationService().delete(new UserGroup(user.getId(),id));
      }
    }
  }
  lastGroups=new HashSet<String>(groups);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public void valueChange(ValueChangeEvent event){
  Set<String> groups=(Set<String>)event.getProperty().getValue();
  IOperationsService operationsSerivce=context.getOperationsService();
  for (  String id : groups) {
    if (!lastGroups.contains(id)) {
      UserGroup userGroup=new UserGroup(user.getId(),id);
      user.getGroups().add(groupsById.get(id));
      if (operationsSerivce.findUser(user.getId()) != null) {
        context.getConfigurationService().save(userGroup);
      }
    }
  }
  for (  String id : lastGroups) {
    if (!groups.contains(id)) {
      user.getGroups().remove(groupsById.get(id));
      if (operationsSerivce.findUser(user.getId()) != null) {
        context.getConfigurationService().delete(new UserGroup(user.getId(),id));
      }
    }
  }
  lastGroups=new HashSet<String>(groups);
}
Program: 167294
Project: 167294
Buggy source:
public void buttonClick(ClickEvent event){
  for (  User user : getSelectedItems()) {
    context.getOperationsSerivce().delete(user);
    container.removeItem(user);
  }
  table.setValue(null);
  setButtonsEnabled();
}

Fixed version (ground truth):
public void buttonClick(ClickEvent event){
  for (  User user : getSelectedItems()) {
    context.getOperationsService().delete(user);
    container.removeItem(user);
  }
  table.setValue(null);
  setButtonsEnabled();
}
Program: 167295
Project: 167295
Buggy source:
public void refresh(){
  container.removeAllItems();
  container.addAll(context.getOperationsSerivce().findUsers());
  table.sort();
  setButtonsEnabled();
}

Fixed version (ground truth):
public void refresh(){
  container.removeAllItems();
  container.addAll(context.getOperationsService().findUsers());
  table.sort();
  setButtonsEnabled();
}
Program: 167297
Project: 167297
Buggy source:
protected void deleteTreeItems(AbstractObject obj){
  if (obj instanceof AgentName) {
    AgentName agentName=(AgentName)obj;
    ConfirmDialog.show("String_Node_Str","String_Node_Str" + agentName.getName() + "String_Node_Str",() -> {
      Agent agent=context.getOperationsSerivce().findAgent(agentName.getId(),false);
      context.getConfigurationService().delete(agent);
      context.getAgentManager().refresh(agent);
      refresh();
      return true;
    }
);
  }
}

Fixed version (ground truth):
protected void deleteTreeItems(AbstractObject obj){
  if (obj instanceof AgentName) {
    AgentName agentName=(AgentName)obj;
    ConfirmDialog.show("String_Node_Str","String_Node_Str" + agentName.getName() + "String_Node_Str",() -> {
      Agent agent=context.getOperationsService().findAgent(agentName.getId(),false);
      context.getConfigurationService().delete(agent);
      context.getAgentManager().refresh(agent);
      refresh();
      return true;
    }
);
  }
}
Program: 167298
Project: 167298
Buggy source:
protected void addChildren(Folder folder){
  if (folder.getParent() != null) {
    treeTable.setChildrenAllowed(folder.getParent(),true);
  }
  treeTable.addItem(folder);
  treeTable.setItemIcon(folder,FontAwesome.FOLDER);
  treeTable.setCollapsed(folder,true);
  treeTable.setChildrenAllowed(folder,false);
  if (folder.getParent() != null) {
    treeTable.setParent(folder,folder.getParent());
  }
  List<Folder> children=folder.getChildren();
  for (  Folder child : children) {
    addChildren(child);
  }
  List<AgentName> agents=context.getOperationsSerivce().findAgentsInFolder(folder);
  for (  AgentName agent : agents) {
    addAgent(folder,agent);
  }
}

Fixed version (ground truth):
protected void addChildren(Folder folder){
  if (folder.getParent() != null) {
    treeTable.setChildrenAllowed(folder.getParent(),true);
  }
  treeTable.addItem(folder);
  treeTable.setItemIcon(folder,FontAwesome.FOLDER);
  treeTable.setCollapsed(folder,true);
  treeTable.setChildrenAllowed(folder,false);
  if (folder.getParent() != null) {
    treeTable.setParent(folder,folder.getParent());
  }
  List<Folder> children=folder.getChildren();
  for (  Folder child : children) {
    addChildren(child);
  }
  List<AgentName> agents=context.getOperationsService().findAgentsInFolder(folder);
  for (  AgentName agent : agents) {
    addAgent(folder,agent);
  }
}
Program: 167299
Project: 167299
Buggy source:
protected void openItem(Object item){
  if (item instanceof AgentName) {
    AgentName agentName=(AgentName)item;
    Agent agent=context.getOperationsSerivce().findAgent(agentName.getId(),true);
    tabbedPanel.addCloseableTab(agent.getId(),agent.getName(),Icons.AGENT,new EditAgentPanel(context,tabbedPanel,agent));
  }
}

Fixed version (ground truth):
protected void openItem(Object item){
  if (item instanceof AgentName) {
    AgentName agentName=(AgentName)item;
    Agent agent=context.getOperationsService().findAgent(agentName.getId(),true);
    tabbedPanel.addCloseableTab(agent.getId(),agent.getName(),Icons.AGENT,new EditAgentPanel(context,tabbedPanel,agent));
  }
}
Program: 167300
Project: 167300
Buggy source:
public void refresh(){
  Object selected=treeTable.getValue();
  List<Object> expandedItems=new ArrayList<Object>();
  Collection<?> items=treeTable.getItemIds();
  for (  Object object : items) {
    if (!treeTable.isCollapsed(object)) {
      expandedItems.add(object);
    }
  }
  treeTable.removeAllItems();
  List<Folder> folders=context.getConfigurationService().findFolders(null,FolderType.AGENT);
  for (  Folder folder : folders) {
    addChildren(folder);
  }
  List<AgentName> agents=context.getOperationsSerivce().findAgentsInFolder(null);
  for (  AgentName agent : agents) {
    addAgent(null,agent);
  }
  for (  Object object : expandedItems) {
    treeTable.setCollapsed(object,false);
  }
  treeTable.focus();
  if (treeTable.containsId(selected)) {
    treeTable.setValue(selected);
  }
 else {
    if (treeTable.getItemIds().size() > 0) {
      treeTable.setValue(treeTable.getItemIds().iterator().next());
    }
  }
  treeTable.focus();
}

Fixed version (ground truth):
public void refresh(){
  Object selected=treeTable.getValue();
  List<Object> expandedItems=new ArrayList<Object>();
  Collection<?> items=treeTable.getItemIds();
  for (  Object object : items) {
    if (!treeTable.isCollapsed(object)) {
      expandedItems.add(object);
    }
  }
  treeTable.removeAllItems();
  List<Folder> folders=context.getConfigurationService().findFolders(null,FolderType.AGENT);
  for (  Folder folder : folders) {
    addChildren(folder);
  }
  List<AgentName> agents=context.getOperationsService().findAgentsInFolder(null);
  for (  AgentName agent : agents) {
    addAgent(null,agent);
  }
  for (  Object object : expandedItems) {
    treeTable.setCollapsed(object,false);
  }
  treeTable.focus();
  if (treeTable.containsId(selected)) {
    treeTable.setValue(selected);
  }
 else {
    if (treeTable.getItemIds().size() > 0) {
      treeTable.setValue(treeTable.getItemIds().iterator().next());
    }
  }
  treeTable.focus();
}
Program: 167301
Project: 167301
Buggy source:
@SuppressWarnings("String_Node_Str") protected EntityData processEntity(EntityData inData,Message inputMessage,Model inputModel,ArrayList<EntityData> outDatas,boolean isRoot){
  EntityData outData=new EntityData();
  outData.setChangeType(inData.getChangeType());
  if (isRoot) {
    outDatas.add(outData);
  }
  Set<String> attributeIds=new HashSet<String>();
  attributeIds.addAll(inData.keySet());
  attributeIds.addAll(CollectionUtils.intersection(getAllAttributesForIncludedEntities(inData),transformsByAttributeId.keySet()));
  for (  String attributeId : attributeIds) {
    processAttribute(attributeId,inData,outData,inputMessage,inputModel,outDatas);
  }
  getComponentStatistics().incrementNumberEntitiesProcessed(threadNumber);
  return outData;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") protected EntityData processEntity(EntityData inData,Message inputMessage,Model inputModel,boolean isRoot){
  EntityData outData=new EntityData();
  outData.setChangeType(inData.getChangeType());
  Set<String> attributeIds=new HashSet<String>();
  attributeIds.addAll(inData.keySet());
  attributeIds.addAll(CollectionUtils.intersection(getAllAttributesForIncludedEntities(inData),transformsByAttributeId.keySet()));
  for (  String attributeId : attributeIds) {
    processAttribute(attributeId,inData,outData,inputMessage,inputModel);
  }
  getComponentStatistics().incrementNumberEntitiesProcessed(threadNumber);
  return outData;
}
Program: 167302
Project: 167302
Buggy source:
@Override public void handle(Message inputMessage,ISendMessageCallback callback,boolean unitOfWorkBoundaryReached){
  if (scriptEngine == null) {
    scriptEngine=new GroovyScriptEngineImpl();
  }
  totalTime=0;
  if (inputMessage instanceof EntityDataMessage) {
    Model inputModel=getComponent().getInputModel();
    List<EntityData> inDatas=((EntityDataMessage)inputMessage).getPayload();
    ArrayList<EntityData> outDatas=new ArrayList<EntityData>(inDatas != null ? inDatas.size() : 0);
    if (inDatas != null) {
      for (      EntityData inData : inDatas) {
        processEntity(inData,inputMessage,inputModel,outDatas,true);
      }
    }
    callback.sendEntityDataMessage(null,outDatas);
    if (totalCalls > 0) {
      log.debug("String_Node_Str" + (totalTime / totalCalls) + "String_Node_Str");
    }
  }
 else   if (inputMessage instanceof ControlMessage && properties.is(PASS_ALONG_CONTROL_MESSAGES,false)) {
    callback.sendControlMessage();
  }
}

Fixed version (ground truth):
@Override public void handle(Message inputMessage,ISendMessageCallback callback,boolean unitOfWorkBoundaryReached){
  if (scriptEngine == null) {
    scriptEngine=new GroovyScriptEngineImpl();
  }
  totalTime=0;
  if (inputMessage instanceof EntityDataMessage) {
    Model inputModel=getComponent().getInputModel();
    List<EntityData> inDatas=((EntityDataMessage)inputMessage).getPayload();
    ArrayList<EntityData> outDatas=new ArrayList<EntityData>(inDatas != null ? inDatas.size() : 0);
    if (inDatas != null) {
      for (      EntityData inData : inDatas) {
        outDatas.add(processEntity(inData,inputMessage,inputModel,true));
      }
    }
    callback.sendEntityDataMessage(null,outDatas);
    if (totalCalls > 0) {
      log.debug("String_Node_Str" + (totalTime / totalCalls) + "String_Node_Str");
    }
  }
 else   if (inputMessage instanceof ControlMessage && properties.is(PASS_ALONG_CONTROL_MESSAGES,false)) {
    callback.sendControlMessage();
  }
}
Program: 167305
Project: 167305
Buggy source:
private void processTableDeletes(TableData deletes,ISqlTransaction transaction){
  if (deletes != null) {
    Table table=databasePlatform.getTableFromCache(null,null,deletes.getTableName(),false);
    DmlStatement stmt=databasePlatform.createDmlStatement(DmlType.DELETE,table.getCatalog(),table.getSchema(),table.getName(),table.getPrimaryKeyColumns(),getUpdateColumns(table),null,null,true);
    Iterator<String> itr=deletes.getTableData().keySet().iterator();
    while (itr.hasNext()) {
      String key=itr.next();
      LinkedCaseInsensitiveMap<Object> row=deletes.getTableData().get(key);
      transaction.prepareAndExecute(stmt.getSql().toLowerCase(),row);
    }
  }
}

Fixed version (ground truth):
private void processTableDeletes(TableData deletes,ISqlTransaction transaction){
  if (deletes != null) {
    Table table=databasePlatform.getTableFromCache(null,null,deletes.getTableName(),false);
    DmlStatement stmt=databasePlatform.createDmlStatement(DmlType.DELETE,table.getCatalog(),table.getSchema(),table.getName(),table.getPrimaryKeyColumns(),getUpdateColumns(table),null,null,true);
    Iterator<String> itr=deletes.getTableData().keySet().iterator();
    while (itr.hasNext()) {
      String key=itr.next();
      LinkedCaseInsensitiveMap<Object> row=deletes.getTableData().get(key);
      Map<String,Object> rowLower=new HashMap<String,Object>();
      for (      String k : row.keySet()) {
        rowLower.put(k.toLowerCase(),row.get(k));
      }
      transaction.prepareAndExecute(stmt.getSql().toLowerCase(),rowLower);
    }
  }
}
Program: 167307
Project: 167307
Buggy source:
private void addConfigData(List<TableData> tableData,String[][] sqlElements,String projectVersionId,String keyValue){
  ProjectVersion version=configurationService.findProjectVersion(projectVersionId);
  for (int i=0; i <= sqlElements.length - 1; i++) {
    if (!sqlElements[0][0].equalsIgnoreCase("String_Node_Str") || version == null || !projectsExported.contains(version.getProjectId())) {
      String[] entry=sqlElements[i];
      List<Row> rows=getConfigTableData(String.format(entry[SQL],tablePrefix,projectVersionId,keyValue));
      for (      Row row : rows) {
        if (isPassword(row.getString("String_Node_Str",false))) {
          String value=row.getString("String_Node_Str",false);
          if (isNotBlank(value)) {
            if (value.startsWith(SecurityConstants.PREFIX_ENC)) {
              try {
                row.put("String_Node_Str",securityService.decrypt(value.substring(SecurityConstants.PREFIX_ENC.length() - 1)));
              }
 catch (              Exception e) {
              }
            }
          }
        }
        tableData.get(i).rows.put(getPkDataAsString(row,entry[KEY_COLUMNS]),row);
      }
    }
  }
  if (version != null) {
    projectsExported.add(version.getProjectId());
  }
}

Fixed version (ground truth):
private void addConfigData(List<TableData> tableData,String[][] sqlElements,String projectVersionId,String keyValue){
  ProjectVersion version=configurationService.findProjectVersion(projectVersionId);
  for (int i=0; i < sqlElements.length; i++) {
    if (!sqlElements[0][0].equalsIgnoreCase("String_Node_Str") || version == null || !projectsExported.contains(version.getProjectId())) {
      String[] entry=sqlElements[i];
      List<Row> rows=getConfigTableData(String.format(entry[SQL],tablePrefix,projectVersionId,keyValue));
      for (      Row row : rows) {
        if (isPassword(row.getString("String_Node_Str",false))) {
          String value=row.getString("String_Node_Str",false);
          if (isNotBlank(value)) {
            if (value.startsWith(SecurityConstants.PREFIX_ENC)) {
              try {
                row.put("String_Node_Str",securityService.decrypt(value.substring(SecurityConstants.PREFIX_ENC.length() - 1)));
              }
 catch (              Exception e) {
              }
            }
          }
        }
        tableData.get(i).rows.put(getPkDataAsString(row,entry[KEY_COLUMNS]),row);
      }
    }
  }
  if (version != null) {
    projectsExported.add(version.getProjectId());
  }
}
Program: 167308
Project: 167308
Buggy source:
public ImportConfigData(ConfigData configData){
  this.hostName=configData.getHostName();
  this.versionNumber=configData.getVersionNumber();
  this.releasePackageData=configData.releasePackageData;
  this.projectVersionData=configData.projectVersionData;
  this.deletesToProcess=new HashMap<String,TableData>();
}

Fixed version (ground truth):
public ImportConfigData(ConfigData configData){
  this.hostName=configData.getHostName();
  this.versionNumber=configData.getVersionNumber();
  this.releasePackageData=configData.releasePackageData;
  this.projectVersionData=configData.projectVersionData;
  this.deletesToProcess=new LinkedCaseInsensitiveMap<TableData>();
}
Program: 167311
Project: 167311
Buggy source:
@Override public void contextInitialized(ServletContextEvent sce){
  WebApplicationContext ctx=WebApplicationContextUtils.getWebApplicationContext(sce.getServletContext());
  cleanTempJettyDirectories();
  initDatabase(ctx);
  initPlugins(ctx);
  auditStartup(ctx);
  initAgentRuntime(ctx);
  initBackgroundJobs(ctx);
}

Fixed version (ground truth):
@Override public void contextInitialized(ServletContextEvent sce){
  WebApplicationContext ctx=WebApplicationContextUtils.getWebApplicationContext(sce.getServletContext());
  cleanTempJettyDirectories();
  initDatabase(ctx);
  initPlugins(ctx);
  auditStartup(ctx);
  initUICache(ctx);
  initAgentRuntime(ctx);
  initBackgroundJobs(ctx);
}
Program: 167312
Project: 167312
Buggy source:
public UICache(IConfigurationService configurationService){
  this.configurationService=configurationService;
  refreshAll();
  this.configurationService.addConfigurationChangeListener(new ChangeListener());
}

Fixed version (ground truth):
public UICache(IConfigurationService configurationService){
  this.configurationService=configurationService;
}
Program: 167315
Project: 167315
Buggy source:
protected void sendNotifications(Notification.EventType eventType){
  if (notifications != null && notifications.size() > 0) {
    Transport transport=null;
    Date date=new Date();
    flowParameters.put("String_Node_Str",DateFormatUtils.format(date,DATE_FORMAT));
    flowParameters.put("String_Node_Str",DateFormatUtils.format(date,TIME_FORMAT));
    try {
      for (      Notification notification : notifications) {
        if (notification.getEventType().equals(eventType.toString())) {
          log.info("String_Node_Str" + notification.getName() + "String_Node_Str"+ notification.getLevel()+ "String_Node_Str"+ notification.getNotifyType()+ "String_Node_Str");
          transport=mailSession.getTransport();
          MimeMessage message=new MimeMessage(mailSession.getSession());
          message.setSentDate(new Date());
          message.setRecipients(RecipientType.BCC,notification.getRecipients());
          message.setSubject(FormatUtils.replaceTokens(notification.getSubject(),flowParameters,true));
          message.setText(FormatUtils.replaceTokens(notification.getMessage(),flowParameters,true));
          try {
            transport.sendMessage(message,message.getAllRecipients());
          }
 catch (          MessagingException e) {
            log.error("String_Node_Str",e);
          }
        }
      }
    }
 catch (    MessagingException e) {
      log.error("String_Node_Str",e);
    }
 finally {
      mailSession.closeTransport();
    }
  }
}

Fixed version (ground truth):
protected void sendNotifications(Notification.EventType eventType){
  if (notifications != null && notifications.size() > 0) {
    Transport transport=null;
    Date date=new Date();
    flowParameters.put("String_Node_Str",DateFormatUtils.format(date,DATE_FORMAT));
    flowParameters.put("String_Node_Str",DateFormatUtils.format(date,TIME_FORMAT));
    MailSession mailSession=new MailSession(globalSettings);
    try {
      for (      Notification notification : notifications) {
        if (notification.getEventType().equals(eventType.toString())) {
          log.info("String_Node_Str" + notification.getName() + "String_Node_Str"+ notification.getLevel()+ "String_Node_Str"+ notification.getNotifyType()+ "String_Node_Str");
          transport=mailSession.getTransport();
          MimeMessage message=new MimeMessage(mailSession.getSession());
          message.setSentDate(new Date());
          message.setRecipients(RecipientType.BCC,notification.getRecipients());
          message.setSubject(FormatUtils.replaceTokens(notification.getSubject(),flowParameters,true));
          message.setText(FormatUtils.replaceTokens(notification.getMessage(),flowParameters,true));
          try {
            transport.sendMessage(message,message.getAllRecipients());
          }
 catch (          MessagingException e) {
            log.error("String_Node_Str",e);
          }
        }
      }
    }
 catch (    MessagingException e) {
      log.error("String_Node_Str",e);
    }
 finally {
      mailSession.closeTransport();
    }
  }
}
Program: 167316
Project: 167316
Buggy source:
public void closeTransport(){
  try {
    if (transport != null) {
      transport.get().close();
      transport.set(null);
    }
  }
 catch (  MessagingException e) {
  }
}

Fixed version (ground truth):
public void closeTransport(){
  try {
    if (transport.get() != null) {
      transport.get().close();
      transport.set(null);
    }
  }
 catch (  MessagingException e) {
  }
}
Program: 167317
Project: 167317
Buggy source:
public void buttonClick(ClickEvent event){
  MailSession mailSession=new MailSession(context.getOperationsSerivce().findGlobalSettingsAsMap());
  try {
    mailSession.getTransport();
    CommonUiUtils.notify("String_Node_Str","String_Node_Str");
  }
 catch (  AuthenticationFailedException e) {
    CommonUiUtils.notify("String_Node_Str","String_Node_Str" + e.getMessage());
    log.warn("String_Node_Str",e);
  }
catch (  MessagingException e) {
    CommonUiUtils.notify("String_Node_Str","String_Node_Str" + e.getMessage());
    log.warn("String_Node_Str",e);
  }
 finally {
    mailSession.closeTransport();
  }
}

Fixed version (ground truth):
public void buttonClick(ClickEvent event){
  MailSession mailSession=new MailSession(context.getOperationsSerivce().findGlobalSettingsAsMap());
  try {
    mailSession.getTransport();
    CommonUiUtils.notify("String_Node_Str","String_Node_Str");
  }
 catch (  AuthenticationFailedException e) {
    CommonUiUtils.notify("String_Node_Str","String_Node_Str" + e.getMessage(),Type.ERROR_MESSAGE);
    log.warn("String_Node_Str",e);
  }
catch (  MessagingException e) {
    CommonUiUtils.notify("String_Node_Str","String_Node_Str" + e.getMessage(),Type.ERROR_MESSAGE);
    log.warn("String_Node_Str",e);
  }
 finally {
    mailSession.closeTransport();
  }
}
Program: 167318
Project: 167318
Buggy source:
public boolean isDeleted(){
  return deleted;
}

Fixed version (ground truth):
public boolean isDeleted(){
  return deleted || project.isDeleted();
}
Program: 167319
Project: 167319
Buggy source:
@Override public List<Project> findProjects(){
  List<Project> list=persistenceManager.find(Project.class,new NameValue("String_Node_Str",0),null,null,tableName(Project.class));
  AbstractObjectNameBasedSorter.sort(list);
  for (  Project project : list) {
    project.setProjectVersions(findProjectVersionsByProject(project.getId()));
  }
  return list;
}

Fixed version (ground truth):
@Override public List<Project> findProjects(){
  List<Project> list=persistenceManager.find(Project.class,new NameValue("String_Node_Str",0),null,null,tableName(Project.class));
  AbstractObjectNameBasedSorter.sort(list);
  for (  Project project : list) {
    project.setProjectVersions(findProjectVersionsByProject(project));
  }
  return list;
}
Program: 167320
Project: 167320
Buggy source:
@Override public List<ProjectVersion> findProjectVersionsByProject(String projectId){
  Map<String,Object> params=new HashMap<>();
  params.put("String_Node_Str",0);
  params.put("String_Node_Str",projectId);
  List<ProjectVersion> versions=persistenceManager.find(ProjectVersion.class,params,null,null,tableName(ProjectVersion.class));
  AbstractObjectCreateTimeDescSorter.sort(versions);
  return versions;
}

Fixed version (ground truth):
@Override public List<ProjectVersion> findProjectVersionsByProject(Project project){
  Map<String,Object> params=new HashMap<>();
  params.put("String_Node_Str",0);
  params.put("String_Node_Str",project.getId());
  List<ProjectVersion> versions=persistenceManager.find(ProjectVersion.class,params,null,null,tableName(ProjectVersion.class));
  for (  ProjectVersion projectVersion : versions) {
    projectVersion.setProject(project);
  }
  AbstractObjectCreateTimeDescSorter.sort(versions);
  return versions;
}
Program: 167321
Project: 167321
Buggy source:
public List<ProjectVersion> findProjectVersionsByProject(String projectId);

Fixed version (ground truth):
public List<ProjectVersion> findProjectVersionsByProject(Project project);
Program: 167322
Project: 167322
Buggy source:
@SuppressWarnings("String_Node_Str") protected Panel buildPossibleTargetVersions(ProjectVersion targetProjectVersion){
  Panel possibleTargetVersionsPanel=new Panel("String_Node_Str");
  possibleTargetVersionsPanel.addStyleName(ValoTheme.PANEL_SCROLL_INDICATOR);
  possibleTargetVersionsPanel.setSizeFull();
  IndexedContainer container=new IndexedContainer();
  optionGroup=new OptionGroup("String_Node_Str",container);
  optionGroup.addStyleName(ValoTheme.OPTIONGROUP_SMALL);
  optionGroup.setItemCaptionMode(ItemCaptionMode.PROPERTY);
  optionGroup.setItemCaptionPropertyId("String_Node_Str");
  optionGroup.addStyleName("String_Node_Str");
  List<ProjectVersion> projectVersions=configService.findProjectVersionsByProject(targetProjectVersion.getProjectId());
  container.addContainerProperty("String_Node_Str",String.class,null);
  for (  ProjectVersion version : projectVersions) {
    Item item=container.addItem(version.getId());
    item.getItemProperty("String_Node_Str").setValue(version.getVersionLabel());
    if (targetProjectVersion.getId().equalsIgnoreCase(version.getId())) {
      optionGroup.setItemEnabled(version.getId(),false);
    }
  }
  possibleTargetVersionsPanel.setContent(optionGroup);
  return possibleTargetVersionsPanel;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") protected Panel buildPossibleTargetVersions(ProjectVersion targetProjectVersion){
  Panel possibleTargetVersionsPanel=new Panel("String_Node_Str");
  possibleTargetVersionsPanel.addStyleName(ValoTheme.PANEL_SCROLL_INDICATOR);
  possibleTargetVersionsPanel.setSizeFull();
  IndexedContainer container=new IndexedContainer();
  optionGroup=new OptionGroup("String_Node_Str",container);
  optionGroup.addStyleName(ValoTheme.OPTIONGROUP_SMALL);
  optionGroup.setItemCaptionMode(ItemCaptionMode.PROPERTY);
  optionGroup.setItemCaptionPropertyId("String_Node_Str");
  optionGroup.addStyleName("String_Node_Str");
  List<ProjectVersion> projectVersions=configService.findProjectVersionsByProject(targetProjectVersion.getProject());
  container.addContainerProperty("String_Node_Str",String.class,null);
  for (  ProjectVersion version : projectVersions) {
    Item item=container.addItem(version.getId());
    item.getItemProperty("String_Node_Str").setValue(version.getVersionLabel());
    if (targetProjectVersion.getId().equalsIgnoreCase(version.getId())) {
      optionGroup.setItemEnabled(version.getId(),false);
    }
  }
  possibleTargetVersionsPanel.setContent(optionGroup);
  return possibleTargetVersionsPanel;
}