nus-yam/ex-repair huggingface dataset:
Program: 170122
Project: 170122
Buggy source:
/** 
 * Show the box that allows for the setting of a password
 * @param evt The ActionEvent object with relevant data
 */
private void menuSecurityChangeActionPerformed(java.awt.event.ActionEvent evt){
  SecurityDialog secDialog=new SecurityDialog();
  secDialog.setVisible(true);
}

Fixed version (ground truth):
/** 
 * Show the box that allows for the setting of a password
 * @param evt The ActionEvent object with relevant data
 */
private void menuSecurityChangeActionPerformed(java.awt.event.ActionEvent evt){
  if (settingsManager.requiresAuth()) {
    SecurityDialog securityDialog=new SecurityDialog(settingsManager.getUsername(),settingsManager.getPassword());
    securityDialog.setVisible(true);
  }
 else {
    SecurityDialog secDialog=new SecurityDialog();
    secDialog.setVisible(true);
  }
}
Program: 170123
Project: 170123
Buggy source:
/** 
 * Adds a host report to the end of the output buffer
 * @param hostReport The report to add to the output
 */
@Override public void addHostReport(HostReport hostReport){
  ArrayList<Rule> rules=hostReport.getMatchedRules();
  String stub=hostReport.getHost().toString() + "String_Node_Str";
  for (  Rule rule : rules) {
    reportBuilder.append(stub + rule.getName() + "String_Node_Str"+ "String_Node_Str"+ rule.getDescription()+ System.lineSeparator());
  }
}

Fixed version (ground truth):
/** 
 * Adds a host report to the end of the output buffer
 * @param hostReport The report to add to the output
 */
@Override public void addHostReport(HostReport hostReport){
  ArrayList<Rule> rules=hostReport.getMatchedRules();
  String stub=hostReport.getHost().toString() + "String_Node_Str";
  for (  Rule rule : rules) {
    reportBuilder.append(stub + rule.getName() + "String_Node_Str"+ rule.getSeverity()+ "String_Node_Str"+ rule.getDescription()+ System.lineSeparator());
  }
}
Program: 170124
Project: 170124
Buggy source:
/** 
 * Adds a host report to the end of the output buffer
 * @param hostReport The report to add to the output
 */
@Override public void addHostReport(HostReport hostReport){
  reportBuilder.append("String_Node_Str" + hostReport.getHost() + System.lineSeparator());
  reportBuilder.append("String_Node_Str");
  ArrayList<Rule> rules=hostReport.getMatchedRules();
  for (  Rule rule : rules) {
    reportBuilder.append("String_Node_Str" + rule.getName() + System.lineSeparator());
    reportBuilder.append("String_Node_Str" + rule.getSeverity() + System.lineSeparator());
    reportBuilder.append("String_Node_Str" + rule.getDescription() + System.lineSeparator());
  }
  reportBuilder.append("String_Node_Str" + System.lineSeparator());
}

Fixed version (ground truth):
/** 
 * Adds a host report to the end of the output buffer
 * @param hostReport The report to add to the output
 */
@Override public void addHostReport(HostReport hostReport){
  reportBuilder.append(System.lineSeparator() + System.lineSeparator() + "String_Node_Str"+ hostReport.getHost()+ System.lineSeparator());
  reportBuilder.append("String_Node_Str" + System.lineSeparator());
  ArrayList<Rule> rules=hostReport.getMatchedRules();
  for (  Rule rule : rules) {
    reportBuilder.append("String_Node_Str" + rule.getName() + System.lineSeparator());
    reportBuilder.append("String_Node_Str" + rule.getSeverity() + System.lineSeparator());
    reportBuilder.append("String_Node_Str" + rule.getDescription() + System.lineSeparator());
  }
  reportBuilder.append("String_Node_Str" + System.lineSeparator());
}
Program: 170125
Project: 170125
Buggy source:
/** 
 * Adds a host report to the end of the output buffer
 * @param hostReport The report to add to the output
 */
@Override public void addHostReport(HostReport hostReport){
  ArrayList<Rule> rules=hostReport.getMatchedRules();
  Element host=new Element("String_Node_Str");
  host.appendChild(host.toString());
  Element scanType=new Element("String_Node_Str");
  scanType.appendChild("String_Node_Str");
  host.appendChild(scanType);
  Element eRules=new Element("String_Node_Str");
  for (  Rule rule : rules) {
    Element eRule=new Element("String_Node_Str");
    Element ruleName=new Element("String_Node_Str");
    Element severity=new Element("String_Node_Str");
    Element description=new Element("String_Node_Str");
    ruleName.appendChild(rule.getName());
    severity.appendChild(rule.getSeverity());
    description.appendChild(rule.getDescription());
    eRule.appendChild(ruleName);
    eRule.appendChild(severity);
    eRule.appendChild(description);
    eRules.appendChild(eRule);
  }
  host.appendChild(eRules);
  hostsRoot.appendChild(host);
}

Fixed version (ground truth):
/** 
 * Adds a host report to the end of the output buffer
 * @param hostReport The report to add to the output
 */
@Override public void addHostReport(HostReport hostReport){
  ArrayList<Rule> rules=hostReport.getMatchedRules();
  Element host=new Element("String_Node_Str");
  Element ip=new Element("String_Node_Str");
  ip.appendChild(String.valueOf(hostReport.getHost()));
  host.appendChild(ip);
  Element scanType=new Element("String_Node_Str");
  scanType.appendChild("String_Node_Str");
  host.appendChild(scanType);
  Element eRules=new Element("String_Node_Str");
  for (  Rule rule : rules) {
    Element eRule=new Element("String_Node_Str");
    Element ruleName=new Element("String_Node_Str");
    Element severity=new Element("String_Node_Str");
    Element description=new Element("String_Node_Str");
    ruleName.appendChild(rule.getName());
    severity.appendChild(rule.getSeverity());
    description.appendChild(rule.getDescription());
    eRule.appendChild(ruleName);
    eRule.appendChild(severity);
    eRule.appendChild(description);
    eRules.appendChild(eRule);
  }
  host.appendChild(eRules);
  hostsRoot.appendChild(host);
}
Program: 170126
Project: 170126
Buggy source:
/** 
 * Returns a Rule object from a given file
 * @param f The file to load the rule from
 * @return A Rule object
 */
private static Rule getRuleFromFile(File f){
  Rule r=null;
  try {
    Builder parser=new Builder();
    Document doc=parser.build(f);
    Element root=doc.getRootElement();
    Element name=root.getFirstChildElement("String_Node_Str");
    String nameVal=name.getValue();
    Element desc=root.getFirstChildElement("String_Node_Str");
    String descVal=desc.getValue();
    Element severity=root.getFirstChildElement("String_Node_Str");
    String sevVal=severity.getValue();
    Element ruledef=root.getFirstChildElement("String_Node_Str");
    Elements rules=ruledef.getChildElements();
    String[] settings=new String[rules.size()];
    String[] params=new String[rules.size()];
    for (int i=0; i < rules.size(); i++) {
      Element rule=rules.get(i);
      Element sett=rule.getFirstChildElement("String_Node_Str");
      settings[i]=StringEscapeUtils.unescapeXml(sett.getValue());
      Element arg=rule.getFirstChildElement("String_Node_Str");
      params[i]=StringEscapeUtils.unescapeXml(arg.getValue());
    }
    r=new Rule(StringEscapeUtils.unescapeXml(nameVal),StringEscapeUtils.unescapeXml(descVal),sevVal,settings,params);
  }
 catch (  ParsingException|IOException ex) {
    Logger.getLogger(RuleParser.class.getName()).log(Level.SEVERE,null,ex);
  }
  return r;
}

Fixed version (ground truth):
/** 
 * Returns a Rule object from a given file
 * @param f The file to load the rule from
 * @return A Rule object
 */
public static Rule getRuleFromFile(File f){
  Rule r=null;
  try {
    Builder parser=new Builder();
    Document doc=parser.build(f);
    Element root=doc.getRootElement();
    Element name=root.getFirstChildElement("String_Node_Str");
    String nameVal=name.getValue();
    Element desc=root.getFirstChildElement("String_Node_Str");
    String descVal=desc.getValue();
    Element severity=root.getFirstChildElement("String_Node_Str");
    String sevVal=severity.getValue();
    Element ruledef=root.getFirstChildElement("String_Node_Str");
    Elements rules=ruledef.getChildElements();
    String[] settings=new String[rules.size()];
    String[] params=new String[rules.size()];
    for (int i=0; i < rules.size(); i++) {
      Element rule=rules.get(i);
      Element sett=rule.getFirstChildElement("String_Node_Str");
      settings[i]=StringEscapeUtils.unescapeXml(sett.getValue());
      Element arg=rule.getFirstChildElement("String_Node_Str");
      params[i]=StringEscapeUtils.unescapeXml(arg.getValue());
    }
    r=new Rule(StringEscapeUtils.unescapeXml(nameVal),StringEscapeUtils.unescapeXml(descVal),sevVal,settings,params);
  }
 catch (  ParsingException|IOException ex) {
    Logger.getLogger(RuleParser.class.getName()).log(Level.SEVERE,null,ex);
  }
  return r;
}
Program: 170127
Project: 170127
Buggy source:
@Test public void shouldSuccessfullyParseValidRule() throws Exception {
  File f=new File("String_Node_Str");
  Rule r=null;
  Assert.assertNotNull("String_Node_Str",r);
}

Fixed version (ground truth):
@Test public void shouldSuccessfullyParseValidRule() throws Exception {
  File f=new File("String_Node_Str");
  Rule r=null;
  r=RuleParser.getRuleFromFile(f);
  Assert.assertNotNull("String_Node_Str",r);
}
Program: 170128
Project: 170128
Buggy source:
/** 
 * Adds a host report to the end of the output buffer
 * @param hostReport The report to add to the output
 */
@Override public void addHostReport(HostReport hostReport){
  ArrayList<Rule> rules=hostReport.getMatchedRules();
  String stub=hostReport.getHost().toString() + "String_Node_Str";
  for (  Rule rule : rules) {
    reportBuilder.append(stub + rule.getName() + "String_Node_Str"+ "String_Node_Str"+ rule.getDescription()+ "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Adds a host report to the end of the output buffer
 * @param hostReport The report to add to the output
 */
@Override public void addHostReport(HostReport hostReport){
  ArrayList<Rule> rules=hostReport.getMatchedRules();
  String stub=hostReport.getHost().toString() + "String_Node_Str";
  for (  Rule rule : rules) {
    reportBuilder.append(stub + rule.getName() + "String_Node_Str"+ "String_Node_Str"+ rule.getDescription()+ System.getProperty("String_Node_Str"));
  }
}
Program: 170129
Project: 170129
Buggy source:
/** 
 * Readies the output renderer
 * @param _file the file to save to NOTE: This assumes f has correct extension
 */
public CSVOutputRenderer(File _file){
  super(_file);
  reportBuilder=new StringBuilder();
  reportBuilder.append("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Readies the output renderer
 * @param _file the file to save to NOTE: This assumes f has correct extension
 */
public CSVOutputRenderer(File _file){
  super(_file);
  reportBuilder=new StringBuilder();
  reportBuilder.append("String_Node_Str" + System.getProperty("String_Node_Str"));
}
Program: 170130
Project: 170130
Buggy source:
/** 
 * Adds a host report to the end of the output buffer
 * @param hostReport The report to add to the output
 */
@Override public void addHostReport(HostReport hostReport){
  reportBuilder.append("String_Node_Str" + hostReport.getHost() + "String_Node_Str");
  reportBuilder.append("String_Node_Str");
  ArrayList<Rule> rules=hostReport.getMatchedRules();
  for (  Rule rule : rules) {
    reportBuilder.append("String_Node_Str" + rule.getName() + "String_Node_Str");
    reportBuilder.append("String_Node_Str" + rule.getSeverity() + "String_Node_Str");
    reportBuilder.append("String_Node_Str" + rule.getDescription() + "String_Node_Str");
  }
  reportBuilder.append("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Adds a host report to the end of the output buffer
 * @param hostReport The report to add to the output
 */
@Override public void addHostReport(HostReport hostReport){
  reportBuilder.append("String_Node_Str" + hostReport.getHost() + System.getProperty("String_Node_Str"));
  reportBuilder.append("String_Node_Str");
  ArrayList<Rule> rules=hostReport.getMatchedRules();
  for (  Rule rule : rules) {
    reportBuilder.append("String_Node_Str" + rule.getName() + System.getProperty("String_Node_Str"));
    reportBuilder.append("String_Node_Str" + rule.getSeverity() + System.getProperty("String_Node_Str"));
    reportBuilder.append("String_Node_Str" + rule.getDescription() + System.getProperty("String_Node_Str"));
  }
  reportBuilder.append("String_Node_Str");
}
Program: 170131
Project: 170131
Buggy source:
/** 
 * Adds a host report to the end of the output buffer
 * @param hostReport The report to add to the output
 */
@Override public void addHostReport(HostReport hostReport){
  ArrayList<Rule> rules=hostReport.getMatchedRules();
  Element host=new Element("String_Node_Str");
  Element scanType=new Element("String_Node_Str");
  scanType.appendChild("String_Node_Str");
  host.appendChild(scanType);
  Element eRules=new Element("String_Node_Str");
  for (  Rule rule : rules) {
    Element eRule=new Element("String_Node_Str");
    Element ruleName=new Element("String_Node_Str");
    Element severity=new Element("String_Node_Str");
    Element description=new Element("String_Node_Str");
    ruleName.appendChild(rule.getName());
    severity.appendChild(rule.getSeverity());
    description.appendChild(rule.getDescription());
    eRule.appendChild(ruleName);
    eRule.appendChild(severity);
    eRule.appendChild(description);
    eRules.appendChild(eRule);
  }
  host.appendChild(eRules);
  hostsRoot.appendChild(host);
}

Fixed version (ground truth):
/** 
 * Adds a host report to the end of the output buffer
 * @param hostReport The report to add to the output
 */
@Override public void addHostReport(HostReport hostReport){
  ArrayList<Rule> rules=hostReport.getMatchedRules();
  Element host=new Element("String_Node_Str");
  host.appendChild(host.toString());
  Element scanType=new Element("String_Node_Str");
  scanType.appendChild("String_Node_Str");
  host.appendChild(scanType);
  Element eRules=new Element("String_Node_Str");
  for (  Rule rule : rules) {
    Element eRule=new Element("String_Node_Str");
    Element ruleName=new Element("String_Node_Str");
    Element severity=new Element("String_Node_Str");
    Element description=new Element("String_Node_Str");
    ruleName.appendChild(rule.getName());
    severity.appendChild(rule.getSeverity());
    description.appendChild(rule.getDescription());
    eRule.appendChild(ruleName);
    eRule.appendChild(severity);
    eRule.appendChild(description);
    eRules.appendChild(eRule);
  }
  host.appendChild(eRules);
  hostsRoot.appendChild(host);
}
Program: 170132
Project: 170132
Buggy source:
public static Rule getRuleFromFile(File f){
  Rule r=null;
  try {
    Builder parser=new Builder();
    Document doc=parser.build(f);
    Element root=doc.getRootElement();
    Element name=root.getFirstChildElement("String_Node_Str");
    String nameVal=name.getValue();
    Element desc=root.getFirstChildElement("String_Node_Str");
    String descVal=desc.getValue();
    Element severity=root.getFirstChildElement("String_Node_Str");
    String sevVal=severity.getValue();
    Element ruledef=root.getFirstChildElement("String_Node_Str");
    Elements rules=ruledef.getChildElements();
    String[] settings=new String[rules.size()];
    String[] params=new String[rules.size()];
    for (int i=0; i < rules.size(); i++) {
      Element rule=rules.get(i);
      Element sett=rule.getFirstChildElement("String_Node_Str");
      settings[i]=sett.getValue();
      Element arg=rule.getFirstChildElement("String_Node_Str");
      params[i]=arg.getValue();
    }
    r=new Rule(nameVal,descVal,sevVal,settings,params);
  }
 catch (  ParsingException|IOException ex) {
    Logger.getLogger(RuleParser.class.getName()).log(Level.SEVERE,null,ex);
  }
  return r;
}

Fixed version (ground truth):
public static Rule getRuleFromFile(File f){
  Rule r=null;
  try {
    Builder parser=new Builder();
    Document doc=parser.build(f);
    Element root=doc.getRootElement();
    Element name=root.getFirstChildElement("String_Node_Str");
    String nameVal=name.getValue();
    Element desc=root.getFirstChildElement("String_Node_Str");
    String descVal=desc.getValue();
    Element severity=root.getFirstChildElement("String_Node_Str");
    String sevVal=severity.getValue();
    Element ruledef=root.getFirstChildElement("String_Node_Str");
    Elements rules=ruledef.getChildElements();
    String[] settings=new String[rules.size()];
    String[] params=new String[rules.size()];
    for (int i=0; i < rules.size(); i++) {
      Element rule=rules.get(i);
      Element sett=rule.getFirstChildElement("String_Node_Str");
      settings[i]=StringEscapeUtils.unescapeXml(sett.getValue());
      Element arg=rule.getFirstChildElement("String_Node_Str");
      params[i]=StringEscapeUtils.unescapeXml(arg.getValue());
      System.out.println("String_Node_Str" + settings[i] + "String_Node_Str"+ params[i]);
    }
    r=new Rule(StringEscapeUtils.unescapeXml(nameVal),StringEscapeUtils.unescapeXml(descVal),sevVal,settings,params);
  }
 catch (  ParsingException|IOException ex) {
    Logger.getLogger(RuleParser.class.getName()).log(Level.SEVERE,null,ex);
  }
  return r;
}
Program: 170133
Project: 170133
Buggy source:
/** 
 * Connects to the device and retrieves the configuration file from the  device.
 * @return A BufferedReader containing the output from the GET_ALL_CONFIG command 
 */
private BufferedReader getConfigFile() throws JSchException, IOException {
  InputStream in=null;
  JSch jsch=new JSch();
  Session session=jsch.getSession(host.getUser(),host.getAddress().getHostAddress(),SSH_PORT);
  session.setPassword(host.getPass());
  session.setConfig("String_Node_Str","String_Node_Str");
  session.connect();
  if (host.usesEnable()) {
    Channel channel=session.openChannel("String_Node_Str");
    ((ChannelExec)channel).setCommand(ENABLE_SUPERUSER);
    in=channel.getInputStream();
    OutputStream outputStream=channel.getOutputStream();
    channel.connect();
    outputStream.write((host.getEnablePass() + "String_Node_Str").getBytes());
    outputStream.flush();
    outputStream.write(DISABLE_OUTPUT_BUFFERING.getBytes());
    outputStream.flush();
    outputStream.write(GET_ALL_CONFIG.getBytes());
    outputStream.flush();
  }
 else {
    Channel channel=session.openChannel("String_Node_Str");
    ((ChannelExec)channel).setCommand(DISABLE_OUTPUT_BUFFERING);
    in=channel.getInputStream();
    OutputStream outputStream=channel.getOutputStream();
    channel.connect();
    outputStream.write(GET_ALL_CONFIG.getBytes());
    outputStream.flush();
  }
  return new BufferedReader(new InputStreamReader(in));
}

Fixed version (ground truth):
/** 
 * Connects to the device and retrieves the configuration file from the  device.
 * @return A BufferedReader containing the output from the GET_ALL_CONFIG command 
 */
private BufferedReader getConfigFile() throws JSchException, IOException {
  InputStream in=null;
  JSch jsch=new JSch();
  Session session=jsch.getSession(host.getUser(),host.getAddress().getHostAddress(),SSH_PORT);
  session.setPassword(host.getPass());
  session.setConfig("String_Node_Str","String_Node_Str");
  session.connect();
  if (host.usesEnable()) {
    Channel channel=session.openChannel("String_Node_Str");
    in=channel.getInputStream();
    OutputStream outputStream=channel.getOutputStream();
    channel.connect();
    outputStream.write((ENABLE_SUPERUSER + "String_Node_Str").getBytes());
    outputStream.write((host.getEnablePass() + "String_Node_Str").getBytes());
    outputStream.flush();
    outputStream.write((DISABLE_OUTPUT_BUFFERING + "String_Node_Str").getBytes());
    outputStream.flush();
    outputStream.write((GET_ALL_CONFIG + "String_Node_Str").getBytes());
    outputStream.flush();
  }
 else {
    Channel channel=session.openChannel("String_Node_Str");
    in=channel.getInputStream();
    OutputStream outputStream=channel.getOutputStream();
    channel.connect();
    outputStream.write((DISABLE_OUTPUT_BUFFERING + "String_Node_Str").getBytes());
    outputStream.flush();
    outputStream.write((GET_ALL_CONFIG + "String_Node_Str").getBytes());
    outputStream.flush();
  }
  return new BufferedReader(new InputStreamReader(in));
}
Program: 170134
Project: 170134
Buggy source:
/** 
 * Allows the user to save the current configuration from the file
 * @param evt The ActionEvent object with relevant data
 */
private void menuSaveConfigActionPerformed(java.awt.event.ActionEvent evt){
  int returnCode=fc.showSaveDialog(this);
  if (returnCode == JFileChooser.APPROVE_OPTION) {
    File file=fc.getSelectedFile();
    String filename=file.getName();
    if (!filename.matches("String_Node_Str")) {
      filename=filename + "String_Node_Str";
      file=new File(filename);
    }
    ConfigurationManager config=new ConfigurationManager(file);
    for (    Host h : hosts) {
      config.addHost(h);
    }
    JOptionPane.showMessageDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.INFORMATION_MESSAGE);
  }
}

Fixed version (ground truth):
/** 
 * Allows the user to save the current configuration from the file
 * @param evt The ActionEvent object with relevant data
 */
private void menuSaveConfigActionPerformed(java.awt.event.ActionEvent evt){
  int returnCode=fc.showSaveDialog(this);
  if (returnCode == JFileChooser.APPROVE_OPTION) {
    File file=fc.getSelectedFile();
    String filename=file.getName();
    if (!filename.matches("String_Node_Str")) {
      filename=filename + "String_Node_Str";
      file=new File(filename);
    }
    ConfigurationManager.saveConfiguration(file,hosts);
    JOptionPane.showMessageDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.INFORMATION_MESSAGE);
  }
}
Program: 170135
Project: 170135
Buggy source:
/** 
 * Runs a scan on the selected hosts.
 * @param evt The ActionEvent object with relevant data
 */
private void btnRunScanActionPerformed(java.awt.event.ActionEvent evt){
  if (hosts.size() < 1) {
    JOptionPane.showMessageDialog(this,"String_Node_Str");
  }
 else {
    scanning.setVisible(true);
    ScanManager manager=new ScanManager(this.getHostsToScan());
    ScanLauncher launcher=new ScanLauncher(this,manager);
    launcher.execute();
  }
}

Fixed version (ground truth):
/** 
 * Runs a scan on the selected hosts.
 * @param evt The ActionEvent object with relevant data
 */
private void btnRunScanActionPerformed(java.awt.event.ActionEvent evt){
  if (hosts.size() < 1) {
    JOptionPane.showMessageDialog(this,"String_Node_Str");
  }
 else {
    ScanManager manager=new ScanManager(this.getHostsToScan());
    ScanLauncher launcher=new ScanLauncher(this,manager);
    launcher.execute();
  }
}
Program: 170136
Project: 170136
Buggy source:
/** 
 * Runs a scan on the selected hosts.
 * @param evt The ActionEvent object with relevant data
 */
private void btnRunScanActionPerformed(java.awt.event.ActionEvent evt){
  if (hosts.size() < 1) {
    JOptionPane.showMessageDialog(this,"String_Node_Str");
  }
 else {
    scanning.setVisible(true);
    ScanManager manager=new ScanManager(hosts);
    ScanLauncher launcher=new ScanLauncher(this,manager);
    launcher.execute();
  }
}

Fixed version (ground truth):
/** 
 * Runs a scan on the selected hosts.
 * @param evt The ActionEvent object with relevant data
 */
private void btnRunScanActionPerformed(java.awt.event.ActionEvent evt){
  if (hosts.size() < 1) {
    JOptionPane.showMessageDialog(this,"String_Node_Str");
  }
 else {
    scanning.setVisible(true);
    ScanManager manager=new ScanManager(this.getHostsToScan());
    ScanLauncher launcher=new ScanLauncher(this,manager);
    launcher.execute();
  }
}
Program: 170137
Project: 170137
Buggy source:
private void btnDeleteActionPerformed(java.awt.event.ActionEvent evt){
  selected=(DefaultMutableTreeNode)reportTree.getLastSelectedPathComponent();
  if (selected == null) {
    return;
  }
  MutableTreeNode parent=(MutableTreeNode)selected.getParent();
  int index=parent.getIndex(selected);
  parent.remove(selected);
  DefaultTreeModel model=(DefaultTreeModel)reportTree.getModel();
  model.nodesWereRemoved(parent,new int[]{index},new Object[]{selected});
}

Fixed version (ground truth):
private void btnDeleteActionPerformed(java.awt.event.ActionEvent evt){
  selected=(DefaultMutableTreeNode)reportTree.getLastSelectedPathComponent();
  if (selected == null) {
    return;
  }
  MutableTreeNode parent=(MutableTreeNode)selected.getParent();
  int index=parent.getIndex(selected);
  parent.remove(selected);
  model.nodesWereRemoved(parent,new int[]{index},new Object[]{selected});
  reportTree.setModel(model);
}
Program: 170138
Project: 170138
Buggy source:
/** 
 * Creates new form OutputReview
 */
public OutputReview(FullReport r){
  report=r;
  DefaultMutableTreeNode root=new DefaultMutableTreeNode("String_Node_Str");
  ArrayList<HostReport> reports=report.getReports();
  for (  HostReport h : reports) {
    System.out.println("String_Node_Str" + h.getHost().toString());
    DefaultMutableTreeNode host=new DefaultMutableTreeNode(h.getHost().toString());
    System.out.println("String_Node_Str" + h.getMatchedRules().size() + "String_Node_Str");
    ArrayList<Rule> matchedRules=h.getMatchedRules();
    for (    Rule rule : matchedRules) {
      System.out.println("String_Node_Str" + rule.getName());
      System.out.println("String_Node_Str" + rule.getDescription());
      DefaultMutableTreeNode ruleName=new DefaultMutableTreeNode(rule.getName());
      DefaultMutableTreeNode ruleDesc=new DefaultMutableTreeNode(rule.getDescription());
      ruleName.add(ruleDesc);
      host.add(ruleName);
    }
    root.add(host);
  }
  initComponents();
  reportTree=new JTree(root);
  reportTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
  reportTree.setRootVisible(false);
}

Fixed version (ground truth):
/** 
 * Creates new form OutputReview
 */
public OutputReview(FullReport r){
  report=r;
  DefaultMutableTreeNode root=new DefaultMutableTreeNode("String_Node_Str");
  ArrayList<HostReport> reports=report.getReports();
  for (  HostReport h : reports) {
    System.out.println("String_Node_Str" + h.getHost().toString());
    DefaultMutableTreeNode host=new DefaultMutableTreeNode(h.getHost().toString());
    System.out.println("String_Node_Str" + h.getMatchedRules().size() + "String_Node_Str");
    ArrayList<Rule> matchedRules=h.getMatchedRules();
    for (    Rule rule : matchedRules) {
      System.out.println("String_Node_Str" + rule.getName());
      System.out.println("String_Node_Str" + rule.getDescription());
      DefaultMutableTreeNode ruleName=new DefaultMutableTreeNode(rule.getName());
      DefaultMutableTreeNode ruleDesc=new DefaultMutableTreeNode(rule.getDescription());
      ruleName.add(ruleDesc);
      host.add(ruleName);
    }
    root.add(host);
  }
  initComponents();
  model=new DefaultTreeModel(root);
  reportTree.setModel(model);
  reportTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
  reportTree.setRootVisible(false);
}
Program: 170139
Project: 170139
Buggy source:
public static ArrayList<Rule> getRules(){
  ArrayList<Rule> rules=new ArrayList<>();
  String cwd=System.getProperty("String_Node_Str");
  String xmlDirectory=cwd + "String_Node_Str";
  File xmlFolder=new File(xmlDirectory);
  File[] ruleFiles=xmlFolder.listFiles();
  if (ruleFiles != null) {
    for (    File rule : ruleFiles) {
      if (rule.isFile()) {
        Rule r=getRuleFromFile(rule);
        rules.add(r);
      }
    }
  }
  return rules;
}

Fixed version (ground truth):
public static ArrayList<Rule> getRules(){
  ArrayList<Rule> rules=new ArrayList<>();
  String cwd=System.getProperty("String_Node_Str");
  String xmlDirectory=cwd + "String_Node_Str";
  File xmlFolder=new File(xmlDirectory);
  File[] ruleFiles=xmlFolder.listFiles();
  if (ruleFiles != null) {
    for (    File rule : ruleFiles) {
      if (rule.isFile()) {
        Rule r=getRuleFromFile(rule);
        rules.add(r);
      }
    }
  }
  if (rules.size() == 0) {
    System.err.println("String_Node_Str");
  }
  return rules;
}
Program: 170140
Project: 170140
Buggy source:
/** 
 * Connects to the device and retrieves the configuration file from the  device.
 * @return A BufferedReader containing the output from the GET_ALL_CONFIG command 
 */
private BufferedReader getConfigFile() throws JSchException, IOException {
  InputStream in=null;
  JSch jsch=new JSch();
  Session session=jsch.getSession(host.getUser(),host.getAddress().getHostAddress(),SSH_PORT);
  session.setPassword(host.getPass());
  session.setConfig("String_Node_Str","String_Node_Str");
  session.connect();
  Channel channel=session.openChannel("String_Node_Str");
  ((ChannelExec)channel).setCommand(GET_ALL_CONFIG);
  in=channel.getInputStream();
  channel.connect();
  return new BufferedReader(new InputStreamReader(in));
}

Fixed version (ground truth):
/** 
 * Connects to the device and retrieves the configuration file from the  device.
 * @return A BufferedReader containing the output from the GET_ALL_CONFIG command 
 */
private BufferedReader getConfigFile() throws JSchException, IOException {
  InputStream in=null;
  JSch jsch=new JSch();
  Session session=jsch.getSession(host.getUser(),host.getAddress().getHostAddress(),SSH_PORT);
  session.setPassword(host.getPass());
  session.setConfig("String_Node_Str","String_Node_Str");
  session.connect();
  Channel channel=session.openChannel("String_Node_Str");
  ((ChannelExec)channel).setCommand("String_Node_Str" + GET_ALL_CONFIG);
  in=channel.getInputStream();
  channel.connect();
  return new BufferedReader(new InputStreamReader(in));
}
Program: 170141
Project: 170141
Buggy source:
/** 
 * Returns a list of hosts to be scanned (factoring in the checkboxes)
 * @return A list of hosts that are "checked" and should be scanned
 */
public ArrayList<Host> getHostsToScan(){
  ArrayList<Host> toScan=new ArrayList<>();
  DefaultTableModel tableModel=(DefaultTableModel)currentConfTable.getModel();
  int numRows=tableModel.getRowCount();
  for (int i=0; i < numRows; i++) {
    if (!((boolean)tableModel.getValueAt(i,0))) {
      continue;
    }
    String guiHostname=(String)tableModel.getValueAt(i,1);
    for (    Host h : hosts) {
      String hostname=h.toString();
      if (hostname.compareTo(guiHostname) == 0) {
        toScan.add(h);
      }
    }
  }
  return toScan;
}

Fixed version (ground truth):
/** 
 * Returns a list of hosts to be scanned (factoring in the checkboxes)
 * @return A list of hosts that are "checked" and should be scanned
 */
public ArrayList<Host> getHostsToScan(){
  ArrayList<Host> toScan=new ArrayList<>();
  DefaultTableModel tableModel=(DefaultTableModel)currentConfTable.getModel();
  int numRows=currentRow;
  for (int i=0; i < numRows; i++) {
    if (!((boolean)tableModel.getValueAt(i,0))) {
      continue;
    }
    String guiHostname=(String)tableModel.getValueAt(i,1);
    for (    Host h : hosts) {
      String hostname=h.toString();
      if (hostname.compareTo(guiHostname) == 0) {
        toScan.add(h);
      }
    }
  }
  return toScan;
}
Program: 170142
Project: 170142
Buggy source:
/** 
 * Creates new form OutputReview
 */
public OutputReview(FullReport r){
  report=r;
  DefaultMutableTreeNode root=new DefaultMutableTreeNode("String_Node_Str");
  ArrayList<HostReport> reports=report.getReports();
  for (  HostReport h : reports) {
    DefaultMutableTreeNode host=new DefaultMutableTreeNode(h.getHost().toString());
    ArrayList<Rule> matchedRules=h.getMatchedRules();
    for (    Rule rule : matchedRules) {
      DefaultMutableTreeNode ruleName=new DefaultMutableTreeNode(rule.getName());
      DefaultMutableTreeNode ruleDesc=new DefaultMutableTreeNode(rule.getDescription());
      ruleName.add(ruleDesc);
      host.add(ruleName);
    }
    root.add(host);
  }
  initComponents();
  reportTree=new JTree(root);
  reportTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
  reportTree.setRootVisible(false);
}

Fixed version (ground truth):
/** 
 * Creates new form OutputReview
 */
public OutputReview(FullReport r){
  report=r;
  DefaultMutableTreeNode root=new DefaultMutableTreeNode("String_Node_Str");
  ArrayList<HostReport> reports=report.getReports();
  for (  HostReport h : reports) {
    System.out.println("String_Node_Str" + h.getHost().toString());
    DefaultMutableTreeNode host=new DefaultMutableTreeNode(h.getHost().toString());
    System.out.println("String_Node_Str" + h.getMatchedRules().size() + "String_Node_Str");
    ArrayList<Rule> matchedRules=h.getMatchedRules();
    for (    Rule rule : matchedRules) {
      System.out.println("String_Node_Str" + rule.getName());
      System.out.println("String_Node_Str" + rule.getDescription());
      DefaultMutableTreeNode ruleName=new DefaultMutableTreeNode(rule.getName());
      DefaultMutableTreeNode ruleDesc=new DefaultMutableTreeNode(rule.getDescription());
      ruleName.add(ruleDesc);
      host.add(ruleName);
    }
    root.add(host);
  }
  initComponents();
  reportTree=new JTree(root);
  reportTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
  reportTree.setRootVisible(false);
}
Program: 170143
Project: 170143
Buggy source:
/** 
 * Performs the scan and returns a HostReport containing all matched rules.
 * @return The HostReport containing the matched rules.
 * @throws Exception Any Unhandled exception generated during the scan.
 */
@Override public HostReport call() throws Exception {
  BufferedReader reader=null;
  try {
    reader=getConfigFile();
  }
 catch (  JSchException|IOException e) {
    HostReport failedToConnect=new HostReport(host);
    return failedToConnect;
  }
  String line=null;
  ArrayList<String> lines=new ArrayList<>();
  while ((line=reader.readLine()) != null) {
    lines.add(line);
  }
  ArrayList<String> activeLines=RouterConfigManager.getActiveConfig(lines);
  return getHostReport(activeLines);
}

Fixed version (ground truth):
/** 
 * Performs the scan and returns a HostReport containing all matched rules.
 * @return The HostReport containing the matched rules.
 * @throws Exception Any Unhandled exception generated during the scan.
 */
@Override public HostReport call() throws Exception {
  BufferedReader reader=null;
  try {
    reader=getConfigFile();
  }
 catch (  JSchException|IOException e) {
    System.err.println("String_Node_Str" + host.getAddress().toString() + "String_Node_Str"+ "String_Node_Str");
    System.err.println("String_Node_Str" + e.getMessage());
    HostReport failedToConnect=new HostReport(host);
    return failedToConnect;
  }
  String line=null;
  ArrayList<String> lines=new ArrayList<>();
  while ((line=reader.readLine()) != null) {
    System.out.println("String_Node_Str" + line);
    lines.add(line);
  }
  ArrayList<String> activeLines=RouterConfigManager.getActiveConfig(lines);
  return getHostReport(activeLines);
}
Program: 170144
Project: 170144
Buggy source:
/** 
 * Connects to the device and retrieves the configuration file from the  device.
 * @return A BufferedReader containing the output from the GET_ALL_CONFIG command 
 */
private BufferedReader getConfigFile() throws JSchException, IOException {
  InputStream in=null;
  JSch jsch=new JSch();
  Session session=jsch.getSession(host.getUser(),host.getAddress().getHostAddress(),SSH_PORT);
  session.setPassword(host.getPass());
  session.connect();
  ChannelExec exec=(ChannelExec)session.openChannel("String_Node_Str");
  in=exec.getInputStream();
  exec.setCommand(GET_ALL_CONFIG);
  exec.connect();
  return new BufferedReader(new InputStreamReader(in));
}

Fixed version (ground truth):
/** 
 * Connects to the device and retrieves the configuration file from the  device.
 * @return A BufferedReader containing the output from the GET_ALL_CONFIG command 
 */
private BufferedReader getConfigFile() throws JSchException, IOException {
  InputStream in=null;
  JSch jsch=new JSch();
  Session session=jsch.getSession(host.getUser(),host.getAddress().getHostAddress(),SSH_PORT);
  session.setPassword(host.getPass());
  session.setConfig("String_Node_Str","String_Node_Str");
  session.connect();
  ChannelExec exec=(ChannelExec)session.openChannel("String_Node_Str");
  in=exec.getInputStream();
  exec.setCommand(GET_ALL_CONFIG);
  exec.connect();
  return new BufferedReader(new InputStreamReader(in));
}
Program: 170145
Project: 170145
Buggy source:
/** 
 * Turns the XML file into a list of host objects.
 * @param config The file to read from.
 * @return The list of hosts read from the file.
 */
private ArrayList<Host> parseConfig(File config){
  ArrayList<Host> _hosts=new ArrayList<>();
  try {
    Builder parser=new Builder();
    Document doc=parser.build(config);
    Element root=doc.getRootElement();
    Elements eHosts=root.getChildElements("String_Node_Str");
    for (int i=0; i < eHosts.size(); i++) {
      String ip, user, pass;
      Element host=eHosts.get(i);
      ip=host.getFirstChildElement("String_Node_Str").getValue();
      user=host.getFirstChildElement("String_Node_Str").getValue();
      pass=host.getFirstChildElement("String_Node_Str").getValue();
      hosts.add(new Host(InetAddress.getByName(ip),user,pass));
    }
  }
 catch (  ParsingException|IOException ex) {
    Logger.getLogger(ConfigurationManager.class.getName()).log(Level.SEVERE,null,ex);
  }
  return _hosts;
}

Fixed version (ground truth):
/** 
 * Turns the XML file into a list of host objects.
 * @param config The file to read from.
 * @return The list of hosts read from the file.
 */
private ArrayList<Host> parseConfig(File config){
  ArrayList<Host> _hosts=new ArrayList<>();
  try {
    Builder parser=new Builder();
    Document doc=parser.build(config);
    Element root=doc.getRootElement();
    Elements eHosts=root.getChildElements("String_Node_Str");
    for (int i=0; i < eHosts.size(); i++) {
      String ip, user, pass;
      Element host=eHosts.get(i);
      ip=host.getFirstChildElement("String_Node_Str").getValue();
      if (ip.contains("String_Node_Str")) {
        int index=ip.indexOf("String_Node_Str");
        ip=ip.substring((index + 1));
      }
      user=host.getFirstChildElement("String_Node_Str").getValue();
      pass=host.getFirstChildElement("String_Node_Str").getValue();
      InetAddress address=InetAddress.getByName(ip);
      _hosts.add(new Host(address,user,pass));
    }
  }
 catch (  ParsingException|IOException ex) {
    Logger.getLogger(ConfigurationManager.class.getName()).log(Level.SEVERE,null,ex);
  }
  return _hosts;
}
Program: 170146
Project: 170146
Buggy source:
/** 
 * Handles the opening of previously saved scanning configurations 
 * @param evt The ActionEvent object with relevant data
 */
private void menuOpenConfigActionPerformed(java.awt.event.ActionEvent evt){
  int returnVal=fc.showOpenDialog(this);
  if (returnVal == JFileChooser.APPROVE_OPTION) {
    File f=fc.getSelectedFile();
    ConfigurationManager manager=new ConfigurationManager(f);
    ArrayList<Host> configHosts=manager.getAllHosts();
    hosts.addAll(configHosts);
    for (    Host h : hosts) {
      this.updateTable(h);
    }
  }
}

Fixed version (ground truth):
/** 
 * Handles the opening of previously saved scanning configurations 
 * @param evt The ActionEvent object with relevant data
 */
private void menuOpenConfigActionPerformed(java.awt.event.ActionEvent evt){
  int returnVal=fc.showOpenDialog(this);
  if (returnVal == JFileChooser.APPROVE_OPTION) {
    File f=fc.getSelectedFile();
    ConfigurationManager manager=new ConfigurationManager(f);
    ArrayList<Host> configHosts=manager.getAllHosts();
    hosts.addAll(configHosts);
    for (    Host h : hosts) {
      this.addHostToTable(h);
    }
  }
}
Program: 170147
Project: 170147
Buggy source:
/** 
 * Adds a host to be scanned into the JTable and to the ArrayList. Note that the JTable is merely for presentation, the ArrayList holds the actual  data.
 * @param h The host to add to the table
 */
public void updateTable(Host h){
  final int ROWS_BY_DEFAULT=4;
  hosts.add(h);
  DefaultTableModel model=(DefaultTableModel)currentConfTable.getModel();
  String hosts=h.toString();
  if (currentRow >= ROWS_BY_DEFAULT) {
    Vector v=new Vector();
    model.addRow(v);
  }
  int rowToFill=currentRow;
  currentConfTable.setValueAt(true,rowToFill,0);
  currentConfTable.setValueAt(hosts,rowToFill,1);
  currentConfTable.setValueAt("String_Node_Str",rowToFill,2);
  currentRow++;
}

Fixed version (ground truth):
/** 
 * Adds a host to be scanned into the JTable and to the ArrayList. Note that the JTable is merely for presentation, the ArrayList holds the actual  data.
 * @param h The host to add to the table
 */
public void updateTable(Host h){
  hosts.add(h);
  this.addHostToTable(h);
}
Program: 170148
Project: 170148
Buggy source:
public ConfigurationManager(File config){
}

Fixed version (ground truth):
public ConfigurationManager(File config){
  hosts=parseConfig(config);
}
Program: 170149
Project: 170149
Buggy source:
private void btnLoginActionPerformed(java.awt.event.ActionEvent evt){
  if (MainGUI.settingsManager.checkAuth(null,null)) {
    this.setVisible(false);
  }
 else {
    JOptionPane.showConfirmDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.ERROR_MESSAGE);
  }
}

Fixed version (ground truth):
private void btnLoginActionPerformed(java.awt.event.ActionEvent evt){
  String username=fieldUsername.getText().trim();
  String password=new String(fieldPassword.getPassword());
  if (MainGUI.settingsManager.checkAuth(username,password)) {
    this.setVisible(false);
  }
 else {
    JOptionPane.showConfirmDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.ERROR_MESSAGE);
  }
}
Program: 170150
Project: 170150
Buggy source:
/** 
 * Checks the provided credentials against stored counterparts
 * @param _username The username provided by the user
 * @param _password The password provided by the user
 * @return true if the credentials are correct
 */
public boolean checkAuth(String _username,String _password){
  boolean isCorrectUsername=false;
  boolean isCorrectPassword=false;
  if (username == _username) {
    isCorrectUsername=true;
  }
  try {
    if (PasswordHash.validatePassword(_password,password)) {
      isCorrectPassword=true;
    }
  }
 catch (  NoSuchAlgorithmException|InvalidKeySpecException ex) {
    Logger.getLogger(SettingsManager.class.getName()).log(Level.SEVERE,null,ex);
  }
  return (isCorrectUsername && isCorrectPassword);
}

Fixed version (ground truth):
/** 
 * Checks the provided credentials against stored counterparts
 * @param _username The username provided by the user
 * @param _password The password provided by the user
 * @return true if the credentials are correct
 */
public boolean checkAuth(String _username,String _password){
  boolean isCorrectUsername=false;
  boolean isCorrectPassword=false;
  if (username.compareTo(_username) == 0) {
    isCorrectUsername=true;
  }
  try {
    if (PasswordHash.validatePassword(_password,password)) {
      isCorrectPassword=true;
    }
  }
 catch (  NoSuchAlgorithmException|InvalidKeySpecException ex) {
    Logger.getLogger(SettingsManager.class.getName()).log(Level.SEVERE,null,ex);
  }
  return (isCorrectUsername && isCorrectPassword);
}
Program: 170152
Project: 170152
Buggy source:
private CharArraySet remove(CharArraySet fromSet,char[] charArray){
  CharArraySet newSet=new CharArraySet(Version.LUCENE_46,5,false);
  Iterator<Object> phraseIt=currentSetToCheck.iterator();
  while (phraseIt != null && phraseIt.hasNext()) {
    char[] phrase=(char[])phraseIt.next();
    if (!equals(phrase,charArray)) {
      newSet.add(phrase);
    }
  }
  return newSet;
}

Fixed version (ground truth):
private CharArraySet remove(CharArraySet fromSet,char[] charArray){
  CharArraySet newSet=new CharArraySet(Version.LUCENE_46,5,false);
  Iterator<Object> phraseIt=currentSetToCheck.iterator();
  while (phraseIt != null && phraseIt.hasNext()) {
    char[] phrase=(char[])phraseIt.next();
    if (!equals(phrase,charArray) && startsWith(phrase,charArray)) {
      newSet.add(phrase);
    }
  }
  return newSet;
}
Program: 170154
Project: 170154
Buggy source:
private String filter(String qStr){
  String query=qStr;
  while (query.contains("String_Node_Str"))   query=query.replaceAll("String_Node_Str","String_Node_Str");
  query=query.replaceAll("String_Node_Str","String_Node_Str");
  query=query.replaceAll("String_Node_Str","String_Node_Str");
  try {
    query=autophrase(query);
  }
 catch (  IOException ioe) {
  }
  query=query.replaceAll("String_Node_Str","String_Node_Str");
  query=query.replaceAll("String_Node_Str","String_Node_Str");
  return query;
}

Fixed version (ground truth):
private String filter(String qStr){
  String query=qStr;
  while (query.contains("String_Node_Str"))   query=query.replaceAll("String_Node_Str","String_Node_Str");
  query=query.replaceAll("String_Node_Str","String_Node_Str");
  query=query.replaceAll("String_Node_Str","String_Node_Str");
  if (ignoreCase) {
    query=query.replaceAll("String_Node_Str","String_Node_Str");
    query=query.replaceAll("String_Node_Str","String_Node_Str");
  }
  try {
    query=autophrase(query);
  }
 catch (  IOException ioe) {
  }
  query=query.replaceAll("String_Node_Str","String_Node_Str");
  query=query.replaceAll("String_Node_Str","String_Node_Str");
  if (ignoreCase) {
    query=query.replaceAll("String_Node_Str","String_Node_Str");
    query=query.replaceAll("String_Node_Str","String_Node_Str");
  }
  return query;
}
Program: 170155
Project: 170155
Buggy source:
@Override public void init(NamedList initArgs){
  Log.info("String_Node_Str");
  SolrParams params=SolrParams.toSolrParams(initArgs);
  phraseSetFiles=params.get("String_Node_Str");
  String pImpl=params.get("String_Node_Str");
  if (pImpl != null) {
    parserImpl=pImpl;
  }
}

Fixed version (ground truth):
@Override public void init(NamedList initArgs){
  Log.info("String_Node_Str");
  SolrParams params=SolrParams.toSolrParams(initArgs);
  phraseSetFiles=params.get("String_Node_Str");
  String pImpl=params.get("String_Node_Str");
  if (pImpl != null) {
    parserImpl=pImpl;
  }
  String replaceWith=params.get("String_Node_Str");
  if (replaceWith != null && replaceWith.length() > 0) {
    replaceWhitespaceWith=replaceWith.charAt(0);
  }
  String ignoreCaseSt=params.get("String_Node_Str");
  if (ignoreCaseSt != null && ignoreCaseSt.equalsIgnoreCase("String_Node_Str")) {
    ignoreCase=false;
  }
}
Program: 170156
Project: 170156
Buggy source:
private String autophrase(String input) throws IOException {
  WhitespaceTokenizer wt=new WhitespaceTokenizer(Version.LUCENE_46,new StringReader(input));
  LowerCaseFilter lcf=new LowerCaseFilter(Version.LUCENE_46,wt);
  AutoPhrasingTokenFilter aptf=new AutoPhrasingTokenFilter(Version.LUCENE_46,lcf,phraseSets,false);
  aptf.setReplaceWhitespaceWith(new Character('x'));
  CharTermAttribute term=aptf.addAttribute(CharTermAttribute.class);
  aptf.reset();
  StringBuffer strbuf=new StringBuffer();
  while (aptf.incrementToken()) {
    strbuf.append(term.toString()).append("String_Node_Str");
  }
  return strbuf.toString();
}

Fixed version (ground truth):
private String autophrase(String input) throws IOException {
  WhitespaceTokenizer wt=new WhitespaceTokenizer(Version.LUCENE_46,new StringReader(input));
  TokenStream ts=wt;
  if (ignoreCase) {
    ts=new LowerCaseFilter(Version.LUCENE_46,wt);
  }
  AutoPhrasingTokenFilter aptf=new AutoPhrasingTokenFilter(Version.LUCENE_46,ts,phraseSets,false);
  aptf.setReplaceWhitespaceWith(new Character(replaceWhitespaceWith));
  CharTermAttribute term=aptf.addAttribute(CharTermAttribute.class);
  aptf.reset();
  StringBuffer strbuf=new StringBuffer();
  while (aptf.incrementToken()) {
    strbuf.append(term.toString()).append("String_Node_Str");
  }
  return strbuf.toString();
}
Program: 170158
Project: 170158
Buggy source:
private CharArraySet remove(CharArraySet fromSet,char[] charArray){
  CharArraySet newSet=new CharArraySet(Version.LUCENE_46,5,false);
  Iterator<Object> phraseIt=currentSetToCheck.iterator();
  while (phraseIt != null && phraseIt.hasNext()) {
    char[] phrase=(char[])phraseIt.next();
    if (!equals(phrase,charArray) && startsWith(phrase,charArray)) {
      newSet.add(phrase);
    }
  }
  return newSet;
}

Fixed version (ground truth):
private CharArraySet remove(CharArraySet fromSet,char[] charArray){
  CharArraySet newSet=new CharArraySet(Version.LUCENE_46,5,false);
  Iterator<Object> phraseIt=currentSetToCheck.iterator();
  while (phraseIt != null && phraseIt.hasNext()) {
    char[] phrase=(char[])phraseIt.next();
    if (!equals(phrase,charArray) && startsWith(phrase,charArray) || endsWith(charArray,phrase)) {
      newSet.add(phrase);
    }
 else {
    }
  }
  return newSet;
}