nus-yam/ex-repair huggingface dataset:
Program: 167561
Project: 167561
Buggy source:
protected void addResourcesToFolder(Folder folder,ProjectVersion projectVersion){
  IConfigurationService configurationService=context.getConfigurationService();
  List<Resource> resources=configurationService.findResourcesInProject(projectVersion.getId());
  for (  Resource resource : resources) {
    this.treeTable.addItem(resource);
    if (DataSourceResource.TYPE.equals(resource.getType())) {
      this.treeTable.setItemIcon(resource,Icons.DATABASE);
    }
 else {
      this.treeTable.setItemIcon(resource,Icons.GENERAL_RESOURCE);
    }
    this.treeTable.setChildrenAllowed(resource,false);
    this.treeTable.setParent(resource,folder);
  }
}

Fixed version (ground truth):
protected void addResourcesToFolder(Folder folder,ProjectVersion projectVersion){
  IConfigurationService configurationService=context.getConfigurationService();
  List<Resource> resources=configurationService.findResourcesInProject(projectVersion.getId());
  for (  Resource resource : resources) {
    this.treeTable.setChildrenAllowed(folder,true);
    this.treeTable.addItem(resource);
    if (DataSourceResource.TYPE.equals(resource.getType())) {
      this.treeTable.setItemIcon(resource,Icons.DATABASE);
    }
 else {
      this.treeTable.setItemIcon(resource,Icons.GENERAL_RESOURCE);
    }
    this.treeTable.setChildrenAllowed(resource,false);
    this.treeTable.setParent(resource,folder);
  }
}
Program: 167562
Project: 167562
Buggy source:
public void valueChange(ValueChangeEvent event){
  setButtonsEnabled();
  if (currentlyEditing != null) {
    currentlyEditing=null;
    treeTable.refreshRowCache();
    setButtonsEnabled();
  }
}

Fixed version (ground truth):
public void valueChange(ValueChangeEvent event){
  setButtonsEnabled();
  if (currentlyEditing != null) {
    currentlyEditing=null;
    refresh();
  }
}
Program: 167564
Project: 167564
Buggy source:
protected void refreshOpenProjects(){
  Iterator<ProjectVersion> i=projects.iterator();
  while (i.hasNext()) {
    ProjectVersion projectVersion=i.next();
    if (projectVersion.isDeleted() || projectVersion.getProject().isDeleted()) {
      i.remove();
    }
  }
  Collections.sort(projects,new Comparator<ProjectVersion>(){
    @Override public int compare(    ProjectVersion o1,    ProjectVersion o2){
      return o1.getProject().getName().compareTo(o2.getProject().getName());
    }
  }
);
  treeTable.removeAllItems();
  for (  ProjectVersion projectVersion : projects) {
    treeTable.addItem(projectVersion);
    treeTable.setItemIcon(projectVersion,Icons.PROJECT);
    treeTable.setItemCaption(projectVersion,projectVersion.getProject().getName());
    treeTable.setChildrenAllowed(projectVersion,true);
    addFlowsToFolder(addVirtualFolder("String_Node_Str",projectVersion),projectVersion);
    addModelsToFolder(addVirtualFolder("String_Node_Str",projectVersion),projectVersion);
    addResourcesToFolder(addVirtualFolder("String_Node_Str",projectVersion),projectVersion);
  }
}

Fixed version (ground truth):
protected void refreshOpenProjects(){
  Iterator<ProjectVersion> i=projects.iterator();
  while (i.hasNext()) {
    ProjectVersion projectVersion=i.next();
    context.getConfigurationService().refresh(projectVersion);
    if (projectVersion.isDeleted() || projectVersion.getProject().isDeleted()) {
      i.remove();
    }
  }
  Collections.sort(projects,new Comparator<ProjectVersion>(){
    @Override public int compare(    ProjectVersion o1,    ProjectVersion o2){
      return o1.getProject().getName().compareTo(o2.getProject().getName());
    }
  }
);
  treeTable.removeAllItems();
  for (  ProjectVersion projectVersion : projects) {
    treeTable.addItem(projectVersion);
    treeTable.setItemIcon(projectVersion,Icons.PROJECT);
    treeTable.setItemCaption(projectVersion,projectVersion.getProject().getName());
    treeTable.setChildrenAllowed(projectVersion,true);
    addFlowsToFolder(addVirtualFolder("String_Node_Str",projectVersion),projectVersion);
    addModelsToFolder(addVirtualFolder("String_Node_Str",projectVersion),projectVersion);
    addResourcesToFolder(addVirtualFolder("String_Node_Str",projectVersion),projectVersion);
  }
}
Program: 167565
Project: 167565
Buggy source:
@Override public Field<?> createField(Container container,Object itemId,Object propertyId,Component uiContext){
  boolean isVersion=itemId instanceof ProjectVersion;
  if (itemId.equals(currentlyEditing) && !propertyId.equals("String_Node_Str") && !(!isVersion && (propertyId.equals("String_Node_Str") || propertyId.equals("String_Node_Str")))) {
    Field<?> field=super.createField(container,itemId,propertyId,uiContext);
    if (field instanceof TextField) {
      final TextField textField=(TextField)field;
      textField.setNullRepresentation("String_Node_Str");
      textField.setWidth(100,Unit.PERCENTAGE);
      textField.addValueChangeListener(new ValueChangeListener(){
        @Override public void valueChange(        ValueChangeEvent event){
          textField.selectAll();
        }
      }
);
      if ("String_Node_Str".equals(propertyId)) {
        textField.focus();
      }
    }
 else     if (field instanceof CheckBox) {
      CheckBox checkBox=(CheckBox)field;
      checkBox.setCaption(null);
      checkBox.setWidth(100,Unit.PERCENTAGE);
    }
    return field;
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
@Override public Field<?> createField(Container container,Object itemId,Object propertyId,Component uiContext){
  boolean isVersion=itemId instanceof ProjectVersion;
  if (itemId.equals(currentlyEditing) && !propertyId.equals("String_Node_Str") && !(!isVersion && (propertyId.equals("String_Node_Str") || propertyId.equals("String_Node_Str")))) {
    Field<?> field=super.createField(container,itemId,propertyId,uiContext);
    if (field instanceof TextField) {
      final TextField textField=(TextField)field;
      textField.setNullRepresentation("String_Node_Str");
      textField.setWidth(100,Unit.PERCENTAGE);
      textField.addFocusListener(new FocusListener(){
        @Override public void focus(        FocusEvent event){
          textField.selectAll();
        }
      }
);
      if ("String_Node_Str".equals(propertyId)) {
        textField.focus();
      }
    }
 else     if (field instanceof CheckBox) {
      CheckBox checkBox=(CheckBox)field;
      checkBox.setCaption(null);
      checkBox.setWidth(100,Unit.PERCENTAGE);
    }
    return field;
  }
 else {
    return null;
  }
}
Program: 167566
Project: 167566
Buggy source:
@Override public void valueChange(ValueChangeEvent event){
  textField.selectAll();
}

Fixed version (ground truth):
public void valueChange(ValueChangeEvent event){
  setButtonsEnabled();
  if (currentlyEditing != null) {
    currentlyEditing=null;
    treeTable.refreshRowCache();
    setButtonsEnabled();
  }
}
Program: 167567
Project: 167567
Buggy source:
private Properties getConnectionProps(){
  Properties connectionProps=new Properties();
  for (  Entry<String,JComponent> entry : components.entrySet()) {
    String value=null;
    JComponent component=entry.getValue();
    if (component instanceof JTextField) {
      value=((JTextField)component).getText();
    }
 else     if (component instanceof JComboBox) {
      value=((JComboBox)component).getSelectedItem().toString();
    }
    connectionProps.put(entry.getKey(),value);
  }
  return connectionProps;
}

Fixed version (ground truth):
private Properties getConnectionProps(){
  Properties connectionProps=new Properties();
  for (  Entry<String,JComponent> entry : components.entrySet()) {
    String value=null;
    JComponent component=entry.getValue();
    if (component instanceof JTextField) {
      value=((JTextField)component).getText();
    }
 else     if (component instanceof JComboBox) {
      value=((JComboBox)component).getEditor().getItem().toString();
    }
    connectionProps.put(entry.getKey(),value);
  }
  return connectionProps;
}
Program: 167568
Project: 167568
Buggy source:
@Override public void keyPressed(KeyEvent e){
switch (e.getKeyCode()) {
case KeyEvent.VK_ENTER:
    ZooInspectorConnectionPropertiesDialog.this.dispose();
  Properties connectionProps=getConnectionProps();
zooInspectorPanel.connect(connectionProps);
break;
case KeyEvent.VK_ESCAPE:
ZooInspectorConnectionPropertiesDialog.this.dispose();
break;
default :
System.out.println("String_Node_Str");
break;
}
}

Fixed version (ground truth):
@Override public void keyPressed(KeyEvent e){
switch (e.getKeyCode()) {
case KeyEvent.VK_ENTER:
    okButton.doClick();
  break;
case KeyEvent.VK_ESCAPE:
cancelButton.doClick();
break;
default :
break;
}
}
Program: 167570
Project: 167570
Buggy source:
@Override public void updateDefaultConnectionFile(Properties connectionProps) throws IOException {
  Properties properties=new Properties();
  String connStr=connectionProps.getProperty(CONNECT_STRING);
  defaultHostsList.remove(connStr);
  while (defaultHostsList.size() > defaultHostsListSize) {
    defaultHostsList.remove(defaultHostsList.size() - 1);
  }
  try {
    defaultHostsList.add(0,connStr);
  }
 catch (  Throwable t) {
    System.out.println(t);
  }
  StringBuilder sb=new StringBuilder();
  for (int i=0; i < defaultHostsList.size(); i++) {
    String str=defaultHostsList.get(i);
    if (i > 0) {
      sb.append("String_Node_Str");
    }
    sb.append(str);
  }
  properties.setProperty(CONNECT_STRING,sb.toString());
  properties.setProperty(SESSION_TIMEOUT,defaultTimeout);
  properties.getProperty(DATA_ENCRYPTION_MANAGER,defaultEncryptionManager);
  saveDefaultConnectionFile(properties);
}

Fixed version (ground truth):
@Override public void updateDefaultConnectionFile(Properties connectionProps) throws IOException {
  Properties properties=new Properties();
  String connStr=connectionProps.getProperty(CONNECT_STRING);
  defaultHostsList.remove(connStr);
  while (defaultHostsList.size() > defaultHostsListSize) {
    defaultHostsList.remove(defaultHostsList.size() - 1);
  }
  defaultHostsList.add(0,connStr);
  StringBuilder sb=new StringBuilder();
  for (int i=0; i < defaultHostsList.size(); i++) {
    String str=defaultHostsList.get(i);
    if (i > 0) {
      sb.append("String_Node_Str");
    }
    sb.append(str);
  }
  System.out.println("String_Node_Str" + sb.toString());
  properties.setProperty(CONNECT_STRING,sb.toString());
  properties.setProperty(SESSION_TIMEOUT,defaultTimeout);
  properties.getProperty(DATA_ENCRYPTION_MANAGER,defaultEncryptionManager);
  saveDefaultConnectionFile(properties);
}
Program: 167571
Project: 167571
Buggy source:
@Override public List<String> loadNodeViewersFile(File selectedFile) throws IOException {
  List<String> result=new ArrayList<String>();
  if (defaultNodeViewersFile.exists()) {
    FileReader reader=new FileReader(selectedFile);
    try {
      BufferedReader buff=new BufferedReader(reader);
      try {
        while (buff.ready()) {
          String line=buff.readLine();
          if (line != null && line.length() > 0) {
            result.add(line);
          }
        }
      }
  finally {
        buff.close();
      }
    }
  finally {
      reader.close();
    }
  }
  return result;
}

Fixed version (ground truth):
@Override public List<String> loadNodeViewersFile(File selectedFile) throws IOException {
  List<String> result=new ArrayList<String>();
  if (defaultNodeViewersFile.exists()) {
    FileReader reader=new FileReader(selectedFile);
    try {
      BufferedReader buff=new BufferedReader(reader);
      try {
        while (buff.ready()) {
          String line=buff.readLine();
          if (line != null && line.length() > 0) {
            result.add(line);
          }
        }
      }
  finally {
        buff.close();
      }
    }
  finally {
      reader.close();
    }
  }
 else {
    result.add("String_Node_Str");
    result.add("String_Node_Str");
    result.add("String_Node_Str");
  }
  return result;
}
Program: 167573
Project: 167573
Buggy source:
/** 
 * @param args - not used. The value of these parameters will have no effect on the application
 */
public static void main(String[] args){
  try {
    Dimension screenSize=getScreenResolution();
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    JFrame frame=new JFrame("String_Node_Str");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    final ZooInspectorPanel zooInspectorPanel=new ZooInspectorPanel(new ZooInspectorManagerImpl());
    frame.addWindowListener(new WindowAdapter(){
      @Override public void windowClosed(      WindowEvent e){
        super.windowClosed(e);
        zooInspectorPanel.disconnect(true);
      }
    }
);
    frame.setContentPane(zooInspectorPanel);
    frame.setSize(1024,768);
    frame.setVisible(true);
  }
 catch (  Exception e) {
    LoggerFactory.getLogger().error("String_Node_Str",e);
    JOptionPane.showMessageDialog(null,"String_Node_Str" + e.getMessage(),"String_Node_Str",JOptionPane.ERROR_MESSAGE);
  }
}

Fixed version (ground truth):
/** 
 * @param args - not used. The value of these parameters will have no effect on the application
 */
public static void main(String[] args){
  try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    JFrame frame=new JFrame("String_Node_Str");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    final ZooInspectorPanel zooInspectorPanel=new ZooInspectorPanel(new ZooInspectorManagerImpl());
    frame.addWindowListener(new WindowAdapter(){
      @Override public void windowClosed(      WindowEvent e){
        super.windowClosed(e);
        zooInspectorPanel.disconnect(true);
      }
    }
);
    frame.setContentPane(zooInspectorPanel);
    frame.setSize(1024,768);
    frame.setVisible(true);
  }
 catch (  Exception e) {
    LoggerFactory.getLogger().error("String_Node_Str",e);
    JOptionPane.showMessageDialog(null,"String_Node_Str" + e.getMessage(),"String_Node_Str",JOptionPane.ERROR_MESSAGE);
  }
}
Program: 167574
Project: 167574
Buggy source:
@Override public void keyPressed(KeyEvent e){
switch (e.getKeyCode()) {
case KeyEvent.VK_ENTER:
    ZooInspectorConnectionPropertiesDialog.this.dispose();
  Properties connectionProps=getConnectionProps();
zooInspectorPanel.connect(connectionProps);
break;
case KeyEvent.VK_ESCAPE:
ZooInspectorConnectionPropertiesDialog.this.dispose();
break;
default :
break;
}
}

Fixed version (ground truth):
@Override public void keyPressed(KeyEvent e){
switch (e.getKeyCode()) {
case KeyEvent.VK_ENTER:
    ZooInspectorConnectionPropertiesDialog.this.dispose();
  Properties connectionProps=getConnectionProps();
zooInspectorPanel.connect(connectionProps);
break;
case KeyEvent.VK_ESCAPE:
ZooInspectorConnectionPropertiesDialog.this.dispose();
break;
default :
System.out.println("String_Node_Str");
break;
}
}
Program: 167576
Project: 167576
Buggy source:
@Override public void valueChanged(TreeSelectionEvent e){
  long start=System.currentTimeMillis();
  TreePath[] paths=e.getPaths();
  System.out.println("String_Node_Str" + Arrays.asList(paths));
  selectedNodes.clear();
  for (  TreePath path : paths) {
    boolean appended=false;
    StringBuilder sb=new StringBuilder();
    Object[] pathArray=path.getPath();
    for (    Object o : pathArray) {
      if (o != null) {
        String nodeName=o.toString();
        if (nodeName != null) {
          if (nodeName.length() > 0) {
            appended=true;
            sb.append("String_Node_Str");
            sb.append(o.toString());
          }
        }
      }
    }
    if (appended) {
      selectedNodes.add(sb.toString());
    }
  }
  for (int i=0; i < needsReload.size(); i++) {
    this.needsReload.set(i,true);
  }
  reloadSelectedViewer();
  long end=System.currentTimeMillis();
  System.out.println("String_Node_Str" + selectedNodes);
  System.out.println("String_Node_Str" + (end - start));
}

Fixed version (ground truth):
@Override public void valueChanged(TreeSelectionEvent e){
  long start=System.currentTimeMillis();
  TreePath[] paths=e.getPaths();
  System.out.println("String_Node_Str" + Arrays.toString(paths));
  selectedNodes.clear();
  for (  TreePath path : paths) {
    boolean appended=false;
    StringBuilder sb=new StringBuilder();
    Object[] pathArray=path.getPath();
    for (    Object o : pathArray) {
      if (o != null) {
        String nodeName=o.toString();
        if (nodeName != null) {
          if (nodeName.length() > 0) {
            appended=true;
            sb.append("String_Node_Str");
            sb.append(o.toString());
          }
        }
      }
    }
    if (appended) {
      selectedNodes.add(sb.toString());
    }
  }
  for (int i=0; i < needsReload.size(); i++) {
    this.needsReload.set(i,true);
  }
  reloadSelectedViewer();
  long end=System.currentTimeMillis();
  System.out.println("String_Node_Str" + selectedNodes);
  System.out.println("String_Node_Str" + (end - start));
}
Program: 167577
Project: 167577
Buggy source:
private void doRefresh(final TreePath[] selectedNodes){
  System.out.println("String_Node_Str" + selectedNodes);
  final Set<TreePath> expandedNodes=new LinkedHashSet<TreePath>();
  int rowCount=tree.getRowCount();
  for (int i=0; i < rowCount; i++) {
    TreePath path=tree.getPathForRow(i);
    if (tree.isExpanded(path)) {
      expandedNodes.add(path);
    }
  }
  System.out.println("String_Node_Str" + expandedNodes);
  SwingWorker<Boolean,Void> worker=new SwingWorker<Boolean,Void>(){
    @Override protected Boolean doInBackground() throws Exception {
      tree.setModel(new DefaultTreeModel(new ZooInspectorTreeNode("String_Node_Str",null)));
      return true;
    }
    @Override protected void done(){
      for (      TreePath path : expandedNodes) {
        tree.expandPath(path);
      }
      tree.getSelectionModel().setSelectionPaths(selectedNodes);
      skipRefreshPaths.clear();
    }
  }
;
  worker.execute();
}

Fixed version (ground truth):
private void doRefresh(final TreePath[] selectedNodes){
  System.out.println("String_Node_Str" + Arrays.toString(selectedNodes));
  final Set<TreePath> expandedNodes=new LinkedHashSet<TreePath>();
  int rowCount=tree.getRowCount();
  for (int i=0; i < rowCount; i++) {
    TreePath path=tree.getPathForRow(i);
    if (tree.isExpanded(path)) {
      expandedNodes.add(path);
    }
  }
  System.out.println("String_Node_Str" + expandedNodes);
  SwingWorker<Boolean,Void> worker=new SwingWorker<Boolean,Void>(){
    @Override protected Boolean doInBackground() throws Exception {
      tree.setModel(new DefaultTreeModel(new ZooInspectorTreeNode("String_Node_Str",null)));
      return true;
    }
    @Override protected void done(){
      for (      TreePath path : expandedNodes) {
        tree.expandPath(path);
      }
      tree.getSelectionModel().setSelectionPaths(selectedNodes);
      skipRefreshPaths.clear();
    }
  }
;
  worker.execute();
}
Program: 167578
Project: 167578
Buggy source:
/** 
 * Refresh the tree view
 */
public void refreshView(){
  List<String> visiblePaths=new ArrayList<String>();
  int rowCount=tree.getRowCount();
  System.out.println("String_Node_Str");
  System.out.println("String_Node_Str" + rowCount);
  for (int i=0; i < rowCount; i++) {
    TreePath path=tree.getPathForRow(i);
    visiblePaths.add(ZooInspectorUtil.treePathToZnodePath(path));
  }
  System.out.println("String_Node_Str" + visiblePaths);
  try {
    zooInspectorManager.getCache().refresh(visiblePaths,0);
  }
 catch (  KeeperException e) {
    zooInspectorPanel.checkZookeeperStates(e.getMessage());
    return;
  }
  skipRefreshPaths.addAll(getExpandedNodes());
  doRefresh(tree.getSelectionPaths());
}

Fixed version (ground truth):
/** 
 * Refresh the tree view
 */
public void refreshView(){
  List<String> visiblePaths=new ArrayList<String>();
  int rowCount=tree.getRowCount();
  System.out.println("String_Node_Str");
  System.out.println("String_Node_Str" + rowCount);
  for (int i=0; i < rowCount; i++) {
    TreePath path=tree.getPathForRow(i);
    visiblePaths.add(ZooInspectorUtil.treePathToZnodePath(path));
  }
  System.out.println("String_Node_Str" + visiblePaths);
  try {
    zooInspectorManager.getCache().refresh(visiblePaths,0);
  }
 catch (  KeeperException e) {
    zooInspectorPanel.checkZookeeperStates(e.getMessage());
    return;
  }
  skipRefreshPaths.addAll(getExpandedNodes());
  doRefresh(tree.getSelectionPaths());
  System.out.println("String_Node_Str");
}
Program: 167582
Project: 167582
Buggy source:
@Override protected Map<String,String> doInBackground() throws Exception {
  return NodeViewerMetaData.this.zooInspectorManager.getNodeMeta(NodeViewerMetaData.this.selectedNode);
}

Fixed version (ground truth):
@Override protected Map<String,String> doInBackground() throws Exception {
  return NodeViewerMetaData.this.zooInspectorManager.getNodeMeta(selectedNode);
}
Program: 167584
Project: 167584
Buggy source:
public JsonNode toJsonNode(Patch patch){
  List<PatchOperation> operations=patch.getOperations();
  JsonNodeFactory nodeFactory=JsonNodeFactory.instance;
  ArrayNode patchNode=nodeFactory.arrayNode();
  for (  PatchOperation operation : operations) {
    ObjectNode opNode=nodeFactory.objectNode();
    opNode.set("String_Node_Str",nodeFactory.textNode(operation.getOp()));
    opNode.set("String_Node_Str",nodeFactory.textNode(operation.getPath()));
    if (operation instanceof FromOperation) {
      FromOperation fromOp=(FromOperation)operation;
      opNode.set("String_Node_Str",nodeFactory.textNode(fromOp.getFrom()));
    }
    Object value=operation.getValue();
    if (value != null) {
      opNode.set("String_Node_Str",MAPPER.valueToTree(value));
    }
  }
  return patchNode;
}

Fixed version (ground truth):
public JsonNode toJsonNode(Patch patch){
  List<PatchOperation> operations=patch.getOperations();
  JsonNodeFactory nodeFactory=JsonNodeFactory.instance;
  ArrayNode patchNode=nodeFactory.arrayNode();
  for (  PatchOperation operation : operations) {
    ObjectNode opNode=nodeFactory.objectNode();
    opNode.set("String_Node_Str",nodeFactory.textNode(operation.getOp()));
    opNode.set("String_Node_Str",nodeFactory.textNode(operation.getPath()));
    if (operation instanceof FromOperation) {
      FromOperation fromOp=(FromOperation)operation;
      opNode.set("String_Node_Str",nodeFactory.textNode(fromOp.getFrom()));
    }
    Object value=operation.getValue();
    if (value != null) {
      opNode.set("String_Node_Str",MAPPER.valueToTree(value));
    }
    patchNode.add(opNode);
  }
  return patchNode;
}
Program: 167586
Project: 167586
Buggy source:
private void requestNewInterstitial(){
  if (!bp.isPurchased("String_Node_Str")) {
    AdRequest adRequest=new AdRequest.Builder().addTestDevice(AdRequest.DEVICE_ID_EMULATOR).addTestDevice("String_Node_Str").build();
    mInterstitialAd.loadAd(adRequest);
  }
}

Fixed version (ground truth):
private void requestNewInterstitial(){
  if (!inAppPayments.isPurchased()) {
    AdRequest adRequest=new AdRequest.Builder().addTestDevice(AdRequest.DEVICE_ID_EMULATOR).addTestDevice("String_Node_Str").build();
    mInterstitialAd.loadAd(adRequest);
  }
}
Program: 167587
Project: 167587
Buggy source:
private void showAd(){
  SharedPreferences sp=getSharedPreferences("String_Node_Str",MODE_PRIVATE);
  if (!bp.isPurchased("String_Node_Str")) {
    if (mInterstitialAd.isLoaded()) {
      if (sp.getInt("String_Node_Str",0) < 2) {
        SharedPreferences.Editor ed=sp.edit();
        ed.putInt("String_Node_Str",sp.getInt("String_Node_Str",0) + 1);
        ed.commit();
        mInterstitialAd.show();
      }
    }
  }
}

Fixed version (ground truth):
private void showAd(){
  SharedPreferences sp=getSharedPreferences("String_Node_Str",MODE_PRIVATE);
  if (!inAppPayments.isPurchased()) {
    if (mInterstitialAd.isLoaded()) {
      if (sp.getInt("String_Node_Str",0) < 2) {
        SharedPreferences.Editor ed=sp.edit();
        ed.putInt("String_Node_Str",sp.getInt("String_Node_Str",0) + 1);
        ed.commit();
        mInterstitialAd.show();
      }
    }
  }
}
Program: 167589
Project: 167589
Buggy source:
public boolean isPurchased(){
}

Fixed version (ground truth):
public boolean isPurchased(){
  return bp.isPurchased("String_Node_Str");
}
Program: 167590
Project: 167590
Buggy source:
/** 
 * Update server
 */
private void updateServer(){
  Database db=new Database(this);
  int serverId=this.server.getId();
  int identityId=db.getIdentityIdByServerId(serverId);
  Server server=getServerFromView();
  server.setAuthentication(authentication);
  db.updateServer(serverId,server,identityId);
  Identity identity=getIdentityFromView();
  db.updateIdentity(identityId,identity.getNickname(),identity.getIdent(),identity.getRealName(),identity.getAliases());
  db.setChannels(serverId,channels);
  db.setCommands(serverId,commands);
  db.close();
  server.setId(this.server.getId());
  server.setIdentity(identity);
  server.setAutoJoinChannels(channels);
  server.setConnectCommands(commands);
  Hermes.getInstance().updateServer(server);
}

Fixed version (ground truth):
/** 
 * Update server
 */
private void updateServer(){
  Database db=new Database(this);
  int serverId=this.server.getId();
  int identityId=db.getIdentityIdByServerId(serverId);
  Server server=getServerFromView();
  if (nickservCheckbox.isChecked()) {
    authentication.setNickservPassword(saslPasswordEditText.toString());
  }
 else   if (saslCheckbox.isChecked()) {
    authentication.setSaslUsername(saslUsernameEditText.toString());
    authentication.setSaslPassword(saslPasswordEditText.toString());
  }
  server.setAuthentication(authentication);
  db.updateServer(serverId,server,identityId);
  Identity identity=getIdentityFromView();
  db.updateIdentity(identityId,identity.getNickname(),identity.getIdent(),identity.getRealName(),identity.getAliases());
  db.setChannels(serverId,channels);
  db.setCommands(serverId,commands);
  db.close();
  server.setId(this.server.getId());
  server.setIdentity(identity);
  server.setAutoJoinChannels(channels);
  server.setConnectCommands(commands);
  Hermes.getInstance().updateServer(server);
}
Program: 167591
Project: 167591
Buggy source:
/** 
 * Add server to database
 */
private void addServer(){
  Database db=new Database(this);
  Identity identity=getIdentityFromView();
  long identityId=db.addIdentity(identity.getNickname(),identity.getIdent(),identity.getRealName(),identity.getAliases());
  Server server=getServerFromView();
  server.setAuthentication(authentication);
  long serverId=db.addServer(server,(int)identityId);
  db.setChannels((int)serverId,channels);
  db.setCommands((int)serverId,commands);
  db.close();
  server.setId((int)serverId);
  server.setIdentity(identity);
  server.setAutoJoinChannels(channels);
  server.setConnectCommands(commands);
  Hermes.getInstance().addServer(server);
}

Fixed version (ground truth):
/** 
 * Add server to database
 */
private void addServer(){
  Database db=new Database(this);
  Identity identity=getIdentityFromView();
  long identityId=db.addIdentity(identity.getNickname(),identity.getIdent(),identity.getRealName(),identity.getAliases());
  Server server=getServerFromView();
  if (nickservCheckbox.isChecked()) {
    authentication.setNickservPassword(saslPasswordEditText.toString());
  }
 else   if (saslCheckbox.isChecked()) {
    authentication.setSaslUsername(saslUsernameEditText.toString());
    authentication.setSaslPassword(saslPasswordEditText.toString());
  }
  server.setAuthentication(authentication);
  long serverId=db.addServer(server,(int)identityId);
  db.setChannels((int)serverId,channels);
  db.setCommands((int)serverId,commands);
  db.close();
  server.setId((int)serverId);
  server.setIdentity(identity);
  server.setAutoJoinChannels(channels);
  server.setConnectCommands(commands);
  Hermes.getInstance().addServer(server);
}
Program: 167592
Project: 167592
Buggy source:
/** 
 * Populate an identity object from the data in the view
 * @return The identity object
 */
private Identity getIdentityFromView(){
  String nickname=((EditText)findViewById(R.id.nickname)).getText().toString();
  String ident=((EditText)findViewById(R.id.ident)).getText().toString().trim();
  String realname=((EditText)findViewById(R.id.realname)).getText().toString().trim();
  String[] floatStrings=nickname.split("String_Node_Str");
  String[] nick=new String[floatStrings.length];
  for (int i=0; i < nick.length; i++) {
    nick[i]=String.valueOf(floatStrings[i]);
  }
  Identity identity=new Identity();
  identity.setNickname(nick[0]);
  identity.setIdent(ident);
  identity.setRealName(realname);
  List<String> aliasesList=Arrays.asList(nick);
  identity.setAliases(aliasesList);
  return identity;
}

Fixed version (ground truth):
/** 
 * Populate an identity object from the data in the view
 * @return The identity object
 */
private Identity getIdentityFromView(){
  String nickname=((EditText)findViewById(R.id.nickname)).getText().toString();
  String ident=((EditText)findViewById(R.id.username)).getText().toString().trim();
  String realname=((EditText)findViewById(R.id.realname)).getText().toString().trim();
  String[] floatStrings=nickname.split("String_Node_Str");
  String[] nick=new String[floatStrings.length];
  for (int i=0; i < nick.length; i++) {
    nick[i]=String.valueOf(floatStrings[i]);
  }
  Identity identity=new Identity();
  identity.setNickname(nick[0]);
  identity.setIdent(ident);
  identity.setRealName(realname);
  List<String> aliasesList=Arrays.asList(nick);
  identity.setAliases(aliasesList);
  return identity;
}
Program: 167593
Project: 167593
Buggy source:
/** 
 * Populate an identity object from the data in the view
 * @return The identity object
 */
private Identity getIdentityFromView(){
  String nickname=((EditText)findViewById(R.id.nickname)).getText().toString();
  String ident=((EditText)findViewById(R.id.username)).getText().toString().trim();
  String realname=((EditText)findViewById(R.id.realname)).getText().toString().trim();
  String[] floatStrings=nickname.split("String_Node_Str");
  String[] nick=new String[floatStrings.length];
  for (int i=0; i < nick.length; i++) {
    nick[i]=String.valueOf(floatStrings[i]);
  }
  Identity identity=new Identity();
  identity.setNickname(nick[0]);
  identity.setIdent(ident);
  identity.setRealName(realname);
  List<String> aliasesList=Arrays.asList(nick);
  identity.setAliases(aliasesList);
  return identity;
}

Fixed version (ground truth):
/** 
 * Populate an identity object from the data in the view
 * @return The identity object
 */
private Identity getIdentityFromView(){
  String nickname=((EditText)findViewById(R.id.nickname)).getText().toString();
  String ident=((EditText)findViewById(R.id.ident)).getText().toString().trim();
  String realname=((EditText)findViewById(R.id.realname)).getText().toString().trim();
  String[] floatStrings=nickname.split("String_Node_Str");
  String[] nick=new String[floatStrings.length];
  for (int i=0; i < nick.length; i++) {
    nick[i]=String.valueOf(floatStrings[i]);
  }
  Identity identity=new Identity();
  identity.setNickname(nick[0]);
  identity.setIdent(ident);
  identity.setRealName(realname);
  List<String> aliasesList=Arrays.asList(nick);
  identity.setAliases(aliasesList);
  return identity;
}
Program: 167595
Project: 167595
Buggy source:
/** 
 * On server status update
 */
@Override public void onStatusUpdate(){
  EditText input=(EditText)findViewById(R.id.input);
  if (server.isConnected()) {
    input.setEnabled(true);
  }
 else {
    input.setEnabled(false);
    if (server.getStatus() == Status.CONNECTING) {
      return;
    }
    if (binder == null || binder.getService() == null || binder.getService().getSettings() == null) {
      return;
    }
    if (!binder.getService().getSettings().isReconnectEnabled() && !reconnectDialogActive) {
      reconnectDialogActive=true;
      AlertDialog.Builder builder=new AlertDialog.Builder(this);
      builder.setMessage(getResources().getString(R.string.reconnect_after_disconnect,server.getTitle())).setCancelable(false).setPositiveButton("String_Node_Str",new DialogInterface.OnClickListener(){
        @Override public void onClick(        DialogInterface dialog,        int id){
          if (!server.isDisconnected()) {
            reconnectDialogActive=false;
            return;
          }
          server.setStatus(Status.CONNECTING);
          binder.connect(server);
          reconnectDialogActive=false;
        }
      }
).setNegativeButton(getString(R.string.negative_button),new DialogInterface.OnClickListener(){
        @Override public void onClick(        DialogInterface dialog,        int id){
          server.setMayReconnect(false);
          reconnectDialogActive=false;
          dialog.cancel();
        }
      }
);
      AlertDialog alert=builder.create();
      alert.show();
    }
  }
}

Fixed version (ground truth):
/** 
 * On server status update
 */
@Override public void onStatusUpdate(){
  EditText input=(EditText)findViewById(R.id.input);
  if (server.isConnected()) {
    input.setEnabled(true);
  }
 else {
    input.setEnabled(false);
    if (server.getStatus() == Status.CONNECTING) {
      return;
    }
    if (binder == null || binder.getService() == null || binder.getService().getSettings() == null) {
      return;
    }
    if (!binder.getService().getSettings().isReconnectEnabled() && !reconnectDialogActive && server.mayReconnect() == true) {
      reconnectDialogActive=true;
      AlertDialog.Builder builder=new AlertDialog.Builder(this);
      builder.setMessage(getResources().getString(R.string.reconnect_after_disconnect,server.getTitle())).setCancelable(false).setPositiveButton("String_Node_Str",new DialogInterface.OnClickListener(){
        @Override public void onClick(        DialogInterface dialog,        int id){
          if (!server.isDisconnected()) {
            reconnectDialogActive=false;
            return;
          }
          server.setStatus(Status.CONNECTING);
          binder.connect(server);
          reconnectDialogActive=false;
        }
      }
).setNegativeButton(getString(R.string.negative_button),new DialogInterface.OnClickListener(){
        @Override public void onClick(        DialogInterface dialog,        int id){
          server.setMayReconnect(false);
          reconnectDialogActive=false;
          dialog.cancel();
        }
      }
);
      AlertDialog alert=builder.create();
      alert.show();
    }
  }
}
Program: 167597
Project: 167597
Buggy source:
@Override public void onItemClick(AdapterView<?> adapter,View v,int position,long arg3){
  final String room=(String)recentAdapter.getRoomAtPosition(position);
  if (RoomsList.size() != 0) {
    new Thread(){
      @Override public void run(){
        try {
          binder.getService().getConnection(serverId).joinChannel(room);
        }
 catch (        Exception E) {
        }
      }
    }
.start();
    recentList.remove(position);
    saveRecentItems();
    refreshActivity();
  }
 else {
    Toast toast=Toast.makeText(getApplicationContext(),"String_Node_Str",Toast.LENGTH_SHORT);
    toast.show();
    refreshActivity();
  }
}

Fixed version (ground truth):
@Override public void onItemClick(AdapterView<?> adapter,View v,int position,long arg3){
  final String room=(String)recentAdapter.getRoomAtPosition(position);
  if (RoomsList.size() != 0) {
    new Thread(){
      @Override public void run(){
        try {
          binder.getService().getConnection(serverId).joinChannel(room);
        }
 catch (        Exception E) {
        }
      }
    }
.start();
    recentList.remove(position);
    saveRecentItems();
    refreshActivity();
  }
 else {
    new Thread(){
      @Override public void run(){
        try {
          binder.getService().getConnection(serverId).joinChannel(room);
        }
 catch (        Exception E) {
        }
      }
    }
.start();
    saveRecentItems();
    refreshActivity();
  }
}
Program: 167600
Project: 167600
Buggy source:
/** 
 * Open the soft keyboard (helper function)
 */
private void openSoftKeyboard(View view){
  ((InputMethodManager)getSystemService(INPUT_METHOD_SERVICE)).showSoftInput(view,InputMethodManager.SHOW_IMPLICIT);
}

Fixed version (ground truth):
/** 
 * Open the soft keyboard (helper function)
 */
private void openSoftKeyboard(View view){
  ((InputMethodManager)getSystemService(INPUT_METHOD_SERVICE)).showSoftInput(view,InputMethodManager.SHOW_IMPLICIT);
  getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
}
Program: 167602
Project: 167602
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  FrameLayout llLayout=(FrameLayout)inflater.inflate(R.layout.server_sliding_fragment,container,false);
  llLayout.findViewById(R.id.home_mainFragment);
  serverSliding=(SlidingUpPanelLayout)llLayout.findViewById(R.id.sliding_layout);
  serverSliding.setEnableDragViewTouchEvents(true);
  list=(ListView)llLayout.findViewById(android.R.id.list);
  list.setAdapter(adapter);
  return llLayout;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  FrameLayout llLayout=(FrameLayout)inflater.inflate(R.layout.server_sliding_fragment,container,false);
  llLayout.findViewById(R.id.home_mainFragment);
  serverSliding=(SlidingUpPanelLayout)llLayout.findViewById(R.id.sliding_layout);
  serverSliding.setEnableDragViewTouchEvents(true);
  adapter=new ServerListAdapter();
  list=(ListView)llLayout.findViewById(android.R.id.list);
  list.setAdapter(adapter);
  list.setOnItemClickListener(this);
  list.setOnItemLongClickListener(this);
  return llLayout;
}
Program: 167603
Project: 167603
Buggy source:
@Override public void init(Bundle savedInstanceState){
  allowArrowAnimation();
  MaterialSection home=newSection("String_Node_Str",new ServersActivity());
  MaterialSection addserver=newSection("String_Node_Str",new Intent(this,AddServerActivity.class));
  MaterialSection settings=newSection("String_Node_Str",R.drawable.ic_ic_settings_24px,new Intent(this,SettingsActivity.class));
  MaterialSection help=newSection("String_Node_Str",R.drawable.ic_ic_help_24px,new Intent(this,SettingsActivity.class));
  MaterialSection about=newSection("String_Node_Str",R.drawable.ic_ic_info_24px,new Intent(this,SettingsActivity.class));
  addSection(home);
  addSection(addserver);
  addBottomSection(settings);
  addBottomSection(help);
  addBottomSection(about);
  setDrawerHeaderImage(R.drawable.cover);
  this.addSection(newSection("String_Node_Str",new MaterialSectionListener(){
    @Override public void onClick(    MaterialSection section){
      FragmentManager fm=getSupportFragmentManager();
      HomeFragment fragment=(HomeFragment)fm.findFragmentByTag("String_Node_Str");
      fragment.openServerPane();
    }
  }
));
  if (instanceCount > 0) {
    finish();
  }
  instanceCount++;
}

Fixed version (ground truth):
@Override public void init(Bundle savedInstanceState){
  allowArrowAnimation();
  final MaterialSection home=newSection("String_Node_Str",new HomeFragment());
  MaterialSection addserver=newSection("String_Node_Str",new Intent(this,AddServerActivity.class));
  MaterialSection settings=newSection("String_Node_Str",R.drawable.ic_ic_settings_24px,new Intent(this,SettingsActivity.class));
  MaterialSection help=newSection("String_Node_Str",R.drawable.ic_ic_help_24px,new Intent(this,SettingsActivity.class));
  MaterialSection about=newSection("String_Node_Str",R.drawable.ic_ic_info_24px,new Intent(this,SettingsActivity.class));
  final FragmentManager fm=getSupportFragmentManager();
  final HomeFragment fragment=(HomeFragment)home.getTargetFragment();
  addSection(home);
  addSection(addserver);
  addBottomSection(settings);
  addBottomSection(help);
  addBottomSection(about);
  setDrawerHeaderImage(R.drawable.cover);
  home.setSectionColor(Color.rgb(255,152,0),Color.rgb(251,140,0));
  this.addSection(newSection("String_Node_Str",new MaterialSectionListener(){
    @Override public void onClick(    MaterialSection section){
      fragment.openServerPane();
    }
  }
));
  if (instanceCount > 0) {
    finish();
  }
  instanceCount++;
}
Program: 167604
Project: 167604
Buggy source:
@Override public void onClick(MaterialSection section){
  FragmentManager fm=getSupportFragmentManager();
  HomeFragment fragment=(HomeFragment)fm.findFragmentByTag("String_Node_Str");
  fragment.openServerPane();
}

Fixed version (ground truth):
@Override public void onClick(MaterialSection section){
  fragment.openServerPane();
}
Program: 167606
Project: 167606
Buggy source:
private Object innerRpcRequest(String method,Object[] params){
  ConnectionFactory connectionFactory=new ConnectionFactory();
  connectionFactory.setHost(this.host);
  try {
    Connection connection=connectionFactory.newConnection();
    Channel channel=connection.createChannel();
    JsonRpcClient client=new JsonRpcClient(channel,Constants.PROXY_EXCHANGE_NAME,Constants.DEFAULT_CONFIG_RPC_RESPONSE_ROUTING_KEY,10000);
    return client.call(method,params);
  }
 catch (  IOException e) {
    logger.error(e);
    throw new RuntimeException(e);
  }
catch (  TimeoutException e) {
    logger.error(e);
    throw new RuntimeException(e);
  }
catch (  JsonRpcException e) {
    logger.error(e);
    throw new RuntimeException(e);
  }
catch (  Exception e) {
    logger.error(e);
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
private Object innerRpcRequest(String method,Object[] params){
  ConnectionFactory connectionFactory=new ConnectionFactory();
  connectionFactory.setHost(this.host);
  Connection connection=null;
  Channel channel=null;
  JsonRpcClient client=null;
  try {
    connection=connectionFactory.newConnection();
    channel=connection.createChannel();
    client=new JsonRpcClient(channel,Constants.PROXY_EXCHANGE_NAME,Constants.DEFAULT_CONFIG_RPC_RESPONSE_ROUTING_KEY,30000);
    return client.call(method,params);
  }
 catch (  IOException e) {
    logger.error(e);
    throw new RuntimeException(e);
  }
catch (  TimeoutException e) {
    logger.error(e);
    throw new RuntimeException(e);
  }
catch (  JsonRpcException e) {
    logger.error(e);
    throw new RuntimeException(e);
  }
catch (  Exception e) {
    logger.error(e);
    throw new RuntimeException(e);
  }
 finally {
    try {
      if (client != null) {
        client.close();
      }
      if (channel != null && channel.isOpen()) {
        channel.close();
      }
      if (connection != null && connection.isOpen()) {
        connection.close();
      }
    }
 catch (    IOException e) {
      logger.error(e);
    }
catch (    TimeoutException e) {
      logger.error(e);
    }
  }
}
Program: 167607
Project: 167607
Buggy source:
public static void writeFile(String fileName,long[] xArr,long[] yArr){
  String filePath=String.format(TestConfigConstant.OUTPUT_FILE_PATH_FORMAT,fileName);
  PrintWriter out=null;
  try {
    logger.info(filePath);
    File dataFile=new File(filePath);
    if (!dataFile.exists()) {
      dataFile.createNewFile();
    }
    out=new PrintWriter(new FileWriter(filePath));
    out.println("String_Node_Str");
    for (int i=0; i < xArr.length; i++) {
      out.println(xArr[i] + "String_Node_Str" + yArr[i]);
    }
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
 finally {
    if (null != out) {
      out.close();
    }
  }
}

Fixed version (ground truth):
public static void writeFile(String fileName,long[] xArr,long[] yArr){
  String filePath=String.format(TestConfigConstant.OUTPUT_FILE_PATH_FORMAT,fileName);
  File dataFile=new File(filePath);
  try {
    if (!dataFile.exists() && (!dataFile.createNewFile())) {
      throw new RuntimeException("String_Node_Str" + filePath + "String_Node_Str");
    }
  }
 catch (  IOException e) {
    ExceptionHelper.logException(logger,e,"String_Node_Str");
    throw new RuntimeException(e);
  }
  try (FileWriter fileWriter=new FileWriter(filePath);PrintWriter out=new PrintWriter(fileWriter)){
    out.println("String_Node_Str");
    for (int i=0; i < xArr.length; i++) {
      out.println(xArr[i] + "String_Node_Str" + yArr[i]);
    }
  }
 catch (  IOException e) {
    ExceptionHelper.logException(logger,e,"String_Node_Str");
    throw new RuntimeException(e);
  }
}
Program: 167608
Project: 167608
Buggy source:
public static void exec(String[] cmds,boolean hasOutput){
  if (cmds == null || cmds.length == 0) {
    return;
  }
  try {
    Process process=Runtime.getRuntime().exec(cmds);
    if (hasOutput) {
      InputStreamReader ir=new InputStreamReader(process.getInputStream());
      LineNumberReader input=new LineNumberReader(ir);
      String line;
      while ((line=input.readLine()) != null)       System.out.println(line);
    }
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public static void exec(String[] cmds,boolean hasOutput){
  if (cmds == null || cmds.length == 0) {
    return;
  }
  if (hasOutput) {
    Process process=null;
    try {
      process=Runtime.getRuntime().exec(cmds);
    }
 catch (    IOException e) {
      ExceptionHelper.logException(logger,e,"String_Node_Str");
      throw new RuntimeException(e.toString());
    }
    try (InputStreamReader ir=new InputStreamReader(process.getInputStream());LineNumberReader input=new LineNumberReader(ir)){
      String line;
      while ((line=input.readLine()) != null)       System.out.println(line);
    }
 catch (    IOException e) {
      ExceptionHelper.logException(logger,e,"String_Node_Str");
      throw new RuntimeException(e.toString());
    }
  }
}
Program: 167609
Project: 167609
Buggy source:
@Override public void run(){
  try {
    this.init();
    msgBodyProcessor=MessageBodyTransferFactory.createMsgBodyProcessor(msg.getMessageType());
    byte[] msgBodyOfBytes=msgBodyProcessor.box(msg.getMessageBody());
    AMQP.BasicProperties header=MessageHeaderTransfer.box(msg.getMessageHeader());
    while (flag) {
      ProxyProducer.produce(CONSTS.PROXY_EXCHANGE_NAME,this.channel,this.getRoutingkey(),msgBodyOfBytes,header);
      ++counter;
    }
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
 finally {
    try {
      this.close();
    }
 catch (    IOException e) {
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  try {
    this.init();
    msgBodyProcessor=MessageBodyTransferFactory.createMsgBodyProcessor(msg.getMessageType());
    byte[] msgBodyOfBytes=msgBodyProcessor.box(msg.getMessageBody());
    AMQP.BasicProperties header=MessageHeaderTransfer.box(msg.getMessageHeader());
    while (flag) {
      ProxyProducer.produce(Constants.PROXY_EXCHANGE_NAME,this.channel,this.getRoutingkey(),msgBodyOfBytes,header);
      ++counter;
    }
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
 finally {
    try {
      this.close();
    }
 catch (    IOException e) {
    }
  }
}
Program: 167610
Project: 167610
Buggy source:
public ExchangerManager(String pubsuberHost,int pubsuberPort){
  this.pubsuber=PubSuberFactory.createPubSuber();
  this.pubsuber.setHost(pubsuberHost);
  this.pubsuber.setPort(pubsuberPort);
  this.pubsuber.open();
  boolean isAlive=this.pubsuber.isAlive();
  if (!isAlive)   return;
  scan();
  registry=new ConcurrentHashMap<>();
  this.channels.add(CONSTS.PUBSUB_AUTH_CHANNEL);
  watchPubSuber();
}

Fixed version (ground truth):
public ExchangerManager(String pubsuberHost,int pubsuberPort){
  this.pubsuber=PubSuberFactory.createPubSuber();
  this.pubsuber.setHost(pubsuberHost);
  this.pubsuber.setPort(pubsuberPort);
  this.pubsuber.open();
  boolean isAlive=this.pubsuber.isAlive();
  if (!isAlive)   return;
  scan();
  registry=new ConcurrentHashMap<>();
  this.channels.add(Constants.PUBSUB_AUTH_CHANNEL);
  watchPubSuber();
}
Program: 167611
Project: 167611
Buggy source:
/** 
 * main operation method for producing and consuming msg, in the method body, the message will flow through a handler-chain
 * @param context the message context
 */
public void carry(MessageContext context){
  if (ConfigManager.getInstance().getServerState().equals(CONSTS.MESSAGEBUS_SERVER_EVENT_STARTED)) {
    IHandlerChain handlerChain=new MessageCarryHandlerChain(carryType,this.getContext());
    handlerChain.handle(context);
  }
 else {
    throw new RuntimeException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * main operation method for producing and consuming msg, in the method body, the message will flow through a handler-chain
 * @param context the message context
 */
public void carry(MessageContext context){
  if (ConfigManager.getInstance().getServerState().equals(Constants.MESSAGEBUS_SERVER_EVENT_STARTED)) {
    IHandlerChain handlerChain=new MessageCarryHandlerChain(carryType,this.getContext());
    handlerChain.handle(context);
  }
 else {
    throw new RuntimeException("String_Node_Str");
  }
}