nus-yam/ex-repair huggingface dataset:
Program: 134319
Project: 134319
Buggy source:
private static Path getGameDataPath(Collection<ZipEntry> entries){
  int shortestLength=Integer.MAX_VALUE;
  ZipEntry gameDataEntry=null;
  for (  ZipEntry entry : entries) {
    if (entry.isDirectory()) {
      if (entry.getName().toLowerCase().endsWith("String_Node_Str")) {
        int pathLength=Paths.get(entry.getName()).getNameCount();
        if (pathLength < shortestLength) {
          shortestLength=pathLength;
          gameDataEntry=entry;
        }
      }
    }
  }
  return gameDataEntry != null ? Paths.get(gameDataEntry.getName()) : null;
}

Fixed version (ground truth):
private static Path getGameDataPath(Collection<ZipEntry> entries){
  int shortestLength=Integer.MAX_VALUE;
  Path gameDataPath=null;
  for (  ZipEntry entry : entries) {
    Path path=Paths.get(entry.getName());
    if (entry.isDirectory() && entry.getName().toLowerCase().endsWith("String_Node_Str")) {
      int pathLength=path.getNameCount();
      if (pathLength < shortestLength) {
        shortestLength=pathLength;
        gameDataPath=path;
      }
    }
 else     if (entry.getName().toLowerCase().startsWith("String_Node_Str")) {
      gameDataPath=path.getName(0);
    }
  }
  return gameDataPath;
}
Program: 134320
Project: 134320
Buggy source:
@Override public void display(Mod element){
  if (element != null) {
    try {
      super.display(element);
      Image cachedImage=ImageIO.read(element.getCachedImagePath(config).toFile());
      label.setIcon(cachedImage != null ? new ImageIcon(cachedImage) : null);
    }
 catch (    IOException ex) {
    }
  }
}

Fixed version (ground truth):
@Override public void display(Mod element){
  if (element != null) {
    try {
      super.display(element);
      BufferedImage image=imageManager.getImage(element.getCachedImagePath(config));
      if (image != null) {
        Dimension size=imageManager.scaleToFit(image,new Dimension(panel.getWidth(),panel.getWidth()));
        label.setIcon(new ImageIcon(imageManager.resizeImage(image,size)));
      }
 else {
        label.setIcon(null);
      }
    }
 catch (    IOException ex) {
    }
  }
}
Program: 134321
Project: 134321
Buggy source:
@Override public void display(Mod mod){
  this.mod=mod;
  panel.removeAll();
  if (mod != null) {
    panel.setBorder(BorderFactory.createTitledBorder(mod.getName() + "String_Node_Str" + mod.getCreator()));
    JLabel updatedLabel=new JLabel();
    updatedLabel.setText("String_Node_Str" + DATE_FORMAT.format(mod.getUpdatedOn()));
    panel.add(updatedLabel);
    panel.add(new UrlPanel("String_Node_Str",mod.getPageUrl()).getComponent());
    Config config=new Config();
    if (mod.getCachedZipPath(config).toFile().exists()) {
      String readmeText=ArchiveInspector.getReadmeText(config,mod);
      if (readmeText != null && !readmeText.trim().isEmpty()) {
        panel.add(new JLabel("String_Node_Str"));
        JTextArea readmeArea=new JTextArea(readmeText);
        readmeArea.setLineWrap(true);
        readmeArea.setWrapStyleWord(true);
        readmeArea.setEditable(false);
        panel.add(readmeArea);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void display(Mod mod){
  this.mod=mod;
  panel.removeAll();
  if (mod != null) {
    panel.setBorder(BorderFactory.createTitledBorder(mod.getName() + "String_Node_Str" + mod.getCreator()));
    JLabel updatedLabel=new JLabel();
    Date updatedOn=mod.getUpdatedOn();
    updatedLabel.setText("String_Node_Str" + (updatedOn != null ? DATE_FORMAT.format(updatedOn) : "String_Node_Str"));
    panel.add(updatedLabel);
    panel.add(new UrlPanel("String_Node_Str",mod.getPageUrl()).getComponent());
    Config config=new Config();
    if (mod.getCachedZipPath(config).toFile().exists()) {
      String readmeText=ArchiveInspector.getReadmeText(config,mod);
      if (readmeText != null && !readmeText.trim().isEmpty()) {
        panel.add(new JLabel("String_Node_Str"));
        JTextArea readmeArea=new JTextArea(readmeText);
        readmeArea.setLineWrap(true);
        readmeArea.setWrapStyleWord(true);
        readmeArea.setEditable(false);
        panel.add(readmeArea);
      }
    }
  }
}
Program: 134322
Project: 134322
Buggy source:
public synchronized Set<Mod> getMods(){
  if (modCache.isEmpty()) {
    modCache.addAll(loadMods());
  }
  return new HashSet<Mod>(modCache);
}

Fixed version (ground truth):
public synchronized Set<Mod> getMods(){
  if (modCache.isEmpty()) {
    modCache.addAll(loadMods());
    for (    SelectorInterface<Mod> l : getListeners()) {
      l.clear();
      for (      Mod mod : modCache) {
        l.addElement(mod);
      }
    }
  }
  return new HashSet<Mod>(modCache);
}
Program: 134323
Project: 134323
Buggy source:
private synchronized Set<Mod> loadMods(){
  try (FileReader reader=new FileReader(config.getModsListPath().toFile())){
    Set<Mod> mods=gson.fromJson(reader,modsType);
    if (mods != null) {
      updateListeners(mods);
      return mods;
    }
  }
 catch (  FileNotFoundException e) {
  }
catch (  IOException e1) {
    e1.printStackTrace();
  }
  return new HashSet<Mod>();
}

Fixed version (ground truth):
private synchronized Set<Mod> loadMods(){
  try (FileReader reader=new FileReader(config.getModsListPath().toFile())){
    Set<Mod> mods=gson.fromJson(reader,modsType);
    if (mods != null) {
      return mods;
    }
  }
 catch (  FileNotFoundException e) {
  }
catch (  IOException e1) {
    e1.printStackTrace();
  }
  return new HashSet<Mod>();
}
Program: 134324
Project: 134324
Buggy source:
@Override public void setUpdateAvailable(URL pageUrl,String newestFileName){
  for (  Mod mod : getMods()) {
    if (mod.getPageUrl().equals(pageUrl)) {
      modUpdated(mod,false);
      break;
    }
  }
}

Fixed version (ground truth):
@Override public synchronized void setUpdateAvailable(URL pageUrl,String newestFileName){
  for (  Mod mod : getMods()) {
    if (mod.getPageUrl().equals(pageUrl)) {
      modUpdated(mod,false);
      break;
    }
  }
}
Program: 134325
Project: 134325
Buggy source:
@Override public synchronized void modUpdated(Mod mod,boolean deleted){
  modCache.clear();
  Set<Mod> mods=loadMods();
  Set<Mod> toRemove=new HashSet<>();
  for (  Mod m : mods) {
    if (m.getName().equals(mod.getName())) {
      toRemove.add(m);
    }
  }
  mods.removeAll(toRemove);
  if (!deleted) {
    mods.add(mod);
  }
  saveMods(mods);
}

Fixed version (ground truth):
@Override public synchronized void modUpdated(Mod mod,boolean deleted){
  Set<Mod> toRemove=new HashSet<>();
  for (  Mod m : modCache) {
    if (m.equals(mod)) {
      toRemove.add(mod);
      for (      SelectorInterface<Mod> l : getListeners()) {
        l.removeElement(mod);
      }
    }
  }
  modCache.removeAll(toRemove);
  if (!deleted) {
    modCache.add(mod);
    for (    SelectorInterface<Mod> l : getListeners()) {
      l.addElement(mod);
    }
  }
  try (FileWriter writer=new FileWriter(config.getModsListPath().toFile())){
    gson.toJson(modCache,modsType,writer);
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}
Program: 134326
Project: 134326
Buggy source:
public void updateConfig(boolean restartOnSuccess,boolean exitOnCancel){
  Set<OptionInput> optionInputs=new HashSet<>();
  Option option=new Option("String_Node_Str",getGameDataPath().toString(),new OptionSaveStrategy.ConfigStrategy(this,GAMEDATA_PATH));
  optionInputs.add(new OptionInput.FileChooserInput(option,JFileChooser.DIRECTORIES_ONLY));
  option=new Option("String_Node_Str",Boolean.toString(autoUpdateModuleManager()),new OptionSaveStrategy.ConfigStrategy(this,AUTO_UPDATE_MM));
  optionInputs.add(new OptionInput.TrueFalseInput(option));
  option=new Option("String_Node_Str",Boolean.toString(autoCheckForModUpdates()),new OptionSaveStrategy.ConfigStrategy(this,AUTO_CHECK_FOR_MOD_UPDATES));
  optionInputs.add(new OptionInput.TrueFalseInput(option));
  new OptionsWindow("String_Node_Str",optionInputs,restartOnSuccess,exitOnCancel).toDialog();
}

Fixed version (ground truth):
public void updateConfig(boolean restartOnSuccess,boolean exitOnCancel){
  Set<OptionInput> optionInputs=new HashSet<>();
  Option option=new Option("String_Node_Str",hasProperty(GAMEDATA_PATH) ? getGameDataPath().toString() : null,new OptionSaveStrategy.ConfigStrategy(this,GAMEDATA_PATH));
  option.addConstraint(new Constraints.NotNull(option));
  option.addConstraint(new Constraints.EnsurePathExists(option,true));
  optionInputs.add(new OptionInput.FileChooserInput(option,JFileChooser.DIRECTORIES_ONLY));
  option=new Option("String_Node_Str",Boolean.toString(autoUpdateModuleManager()),new OptionSaveStrategy.ConfigStrategy(this,AUTO_UPDATE_MM));
  optionInputs.add(new OptionInput.TrueFalseInput(option));
  option=new Option("String_Node_Str",Boolean.toString(autoCheckForModUpdates()),new OptionSaveStrategy.ConfigStrategy(this,AUTO_CHECK_FOR_MOD_UPDATES));
  optionInputs.add(new OptionInput.TrueFalseInput(option));
  new OptionsWindow("String_Node_Str",optionInputs,restartOnSuccess,exitOnCancel).toDialog();
}
Program: 134327
Project: 134327
Buggy source:
@Override public void verifyConfig(){
  if (!hasProperty(AUTO_UPDATE_MM)) {
    setProperty(AUTO_UPDATE_MM,Boolean.toString(true));
  }
  if (!hasProperty(AUTO_CHECK_FOR_MOD_UPDATES)) {
    setProperty(AUTO_CHECK_FOR_MOD_UPDATES,Boolean.toString(true));
  }
  if (!hasProperty(GAMEDATA_PATH)) {
    updateConfig(true,true);
  }
}

Fixed version (ground truth):
@Override public void verifyConfig(){
  if (!hasProperty(AUTO_UPDATE_MM)) {
    setProperty(AUTO_UPDATE_MM,Boolean.toString(true));
  }
  if (!hasProperty(AUTO_CHECK_FOR_MOD_UPDATES)) {
    setProperty(AUTO_CHECK_FOR_MOD_UPDATES,Boolean.toString(true));
  }
  if (!hasProperty(GAMEDATA_PATH) || getProperty(GAMEDATA_PATH) == null || getProperty(GAMEDATA_PATH).isEmpty()) {
    updateConfig(true,true);
  }
}
Program: 134328
Project: 134328
Buggy source:
@Override public Path getCurrentPath(){
  for (  File file : destFolder.toFile().listFiles()) {
    if (file.getName().toLowerCase().startsWith(MODULE_MANAGER.toLowerCase())) {
      return file.toPath();
    }
  }
  return null;
}

Fixed version (ground truth):
@Override public Path getCurrentPath(){
  if (destFolder != null && destFolder.toFile().isDirectory()) {
    for (    File file : destFolder.toFile().listFiles()) {
      if (file.getName().toLowerCase().startsWith(MODULE_MANAGER.toLowerCase())) {
        return file.toPath();
      }
    }
  }
  return null;
}
Program: 134329
Project: 134329
Buggy source:
@Override public void buildWorkflowTask(Workflow workflow,final Crawler<?> crawler,boolean downloadOnlyIfNewer) throws IOException {
  if (currentlyExists()) {
    getCurrentPath().toFile().delete();
  }
  PathGen destGen=new PathGen(){
    @Override public URI getURI() throws URISyntaxException {
      return getPath().toUri();
    }
    @Override public Path getPath(){
      try {
        return destFolder.resolve(crawler.getNewestFileName());
      }
 catch (      IOException e) {
        throw new RuntimeException(e);
      }
    }
  }
;
  if (downloadOnlyIfNewer) {
    ModWorkflowBuilder.downloadFile(workflow,crawler,destGen);
  }
 else {
    try {
      ModWorkflowBuilder.downloadFileIfNewer(workflow,new UpdateableFile(getCurrentVersion(),null,crawler.url),destGen);
    }
 catch (    UnsupportedHostException e) {
      throw new RuntimeException(e);
    }
  }
}

Fixed version (ground truth):
@Override public void buildWorkflowTask(Workflow workflow,final Crawler<?> crawler,boolean downloadOnlyIfNewer) throws IOException {
  if (getCurrentPath() != null) {
    getCurrentPath().toFile().delete();
  }
  PathGen destGen=new PathGen(){
    @Override public URI getURI() throws URISyntaxException {
      return getPath().toUri();
    }
    @Override public Path getPath(){
      try {
        return destFolder.resolve(crawler.getNewestFileName());
      }
 catch (      IOException e) {
        throw new RuntimeException(e);
      }
    }
  }
;
  if (downloadOnlyIfNewer) {
    ModWorkflowBuilder.downloadFile(workflow,crawler,destGen);
  }
 else {
    try {
      ModWorkflowBuilder.downloadFileIfNewer(workflow,new UpdateableFile(getCurrentVersion(),null,crawler.url),destGen);
    }
 catch (    UnsupportedHostException e) {
      throw new RuntimeException(e);
    }
  }
}
Program: 134330
Project: 134330
Buggy source:
public void checkForModUpdates() throws ModUpdateFailedException {
  for (  Mod mod : sm.getMods()) {
    submitDownloadWorkflow(CheckForUpdateWorkflow.forExistingFile(mod,sm));
  }
}

Fixed version (ground truth):
public void checkForModUpdates() throws ModUpdateFailedException {
  for (  Mod mod : sm.getMods()) {
    submitDownloadWorkflow(CheckForUpdateWorkflow.forExistingFile(mod,true,sm));
  }
}
Program: 134331
Project: 134331
Buggy source:
@Override public void actionPerformed(ActionEvent e){
  try {
    Workflow workflow=Workflows.tempDownload(latestPage.getDownloadLink(),config.getGameDataPath().resolve(latestPage.getNewestFileName()));
    workflow.queueDelete(getCurrentFile().toPath());
    workflow.addListener(this);
    mm.submitDownloadWorkflow(workflow);
  }
 catch (  IOException e1) {
    e1.printStackTrace();
  }
}

Fixed version (ground truth):
@Override public void actionPerformed(ActionEvent e){
  try {
    String latestFileName=latestPage.getNewestFileName();
    Workflow workflow=Workflows.tempDownload(latestPage.getDownloadLink(),config.getGameDataPath().resolve(latestFileName));
    File currentFile=getCurrentFile();
    if (currentFile != null && !currentFile.getName().equals(latestFileName)) {
      workflow.queueDelete(currentFile.toPath());
    }
    workflow.addListener(this);
    mm.submitDownloadWorkflow(workflow);
  }
 catch (  IOException e1) {
    e1.printStackTrace();
  }
}
Program: 134332
Project: 134332
Buggy source:
public void updateCurrentVersion(){
  currentVersionLabel.setText("String_Node_Str" + getCurrentFile().getName());
}

Fixed version (ground truth):
public void updateCurrentVersion(){
  File currentFile=getCurrentFile();
  currentVersionLabel.setText(String.format("String_Node_Str",currentFile != null ? currentFile.getName() : "String_Node_Str"));
}
Program: 134333
Project: 134333
Buggy source:
@Override public void setUpdateAvailable(FilePage latestPage){
  this.latestPage=latestPage;
  String latestVersion=latestPage != null ? latestPage.getNewestFileName() : "String_Node_Str";
  latestVersionLabel.setText(String.format("String_Node_Str",latestVersion));
  if (latestPage != null) {
    this.latestPage=latestPage;
    updateButton.setEnabled(true);
  }
}

Fixed version (ground truth):
@Override public void setUpdateAvailable(FilePage latestPage){
  this.latestPage=latestPage;
  String latestVersion=latestPage != null ? latestPage.getNewestFileName() : "String_Node_Str";
  latestVersionLabel.setText(String.format("String_Node_Str",latestVersion));
  File currentFile=getCurrentFile();
  if (latestPage != null && (currentFile == null || !latestPage.getNewestFileName().equals(currentFile.getName()))) {
    this.latestPage=latestPage;
    updateButton.setEnabled(true);
  }
}
Program: 134334
Project: 134334
Buggy source:
public static CheckForUpdateWorkflow forExistingFile(DownloadedFile existing,UpdateListener... listeners){
  ArrayList<UpdateListener> listenerList=new ArrayList<>();
  listenerList.add(existing);
  for (  UpdateListener l : listeners) {
    listenerList.add(l);
  }
  return new CheckForUpdateWorkflow(existing.getNewestFileName(),existing.getPageUrl(),existing.getUpdatedOn(),existing.getNewestFileName(),listenerList.toArray(new UpdateListener[listenerList.size()]));
}

Fixed version (ground truth):
public static CheckForUpdateWorkflow forExistingFile(DownloadedFile existing,boolean onlyUpdateIfNewer,UpdateListener... listeners){
  ArrayList<UpdateListener> listenerList=new ArrayList<>();
  listenerList.add(existing);
  for (  UpdateListener l : listeners) {
    listenerList.add(l);
  }
  return new CheckForUpdateWorkflow(existing.getNewestFileName(),existing.getPageUrl(),existing.getUpdatedOn(),existing.getNewestFileName(),onlyUpdateIfNewer,listenerList.toArray(new UpdateListener[listenerList.size()]));
}
Program: 134335
Project: 134335
Buggy source:
public CheckForUpdateWorkflow(String label,URL pageUrl,Date lastUpdated,String lastFileName,UpdateListener... listeners){
  super("String_Node_Str" + label);
  try {
    newPagePath=Files.createTempFile("String_Node_Str","String_Node_Str");
    newPagePath.toFile().deleteOnExit();
    queueDownload(pageUrl,newPagePath);
    addTask(new CheckForUpdateTask(this,newPagePath,pageUrl,lastUpdated,lastFileName));
    addTask(new NotfiyUpdateAvailableTask(this,newPagePath,pageUrl,listeners));
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
public CheckForUpdateWorkflow(String label,URL pageUrl,Date lastUpdated,String lastFileName,boolean onlyUpdateIfNewer,UpdateListener... listeners){
  super("String_Node_Str" + label);
  try {
    newPagePath=Files.createTempFile("String_Node_Str","String_Node_Str");
    newPagePath.toFile().deleteOnExit();
    queueDownload(pageUrl,newPagePath);
    if (onlyUpdateIfNewer) {
      addTask(new CheckForUpdateTask(this,newPagePath,pageUrl,lastUpdated,lastFileName));
    }
    addTask(new NotfiyUpdateAvailableTask(this,newPagePath,pageUrl,listeners));
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
}
Program: 134336
Project: 134336
Buggy source:
@Override public int getTargetProgress() throws InvalidContentException {
  return 0;
}

Fixed version (ground truth):
@Override public int getTargetProgress() throws InvalidContentException {
  return 1;
}
Program: 134337
Project: 134337
Buggy source:
private void forceDisableModule(ModEnableContext context,Module module) throws CannotDisableModException {
  try {
    FileUtils.deleteDirectory(getDestPath(context,module).toFile());
  }
 catch (  IOException e) {
    throw new CannotDisableModException();
  }
}

Fixed version (ground truth):
private void forceDisableModule(ModEnableContext context,Module module) throws CannotDisableModException {
  FileUtils.deleteQuietly(getDestPath(context,module).toFile());
}
Program: 134338
Project: 134338
Buggy source:
@Override public Resolution getResolution(Module module,Mod mod){
  return (Resolution)JOptionPane.showInputDialog(null,String.format("String_Node_Str" + "String_Node_Str",module,mod),"String_Node_Str",JOptionPane.QUESTION_MESSAGE,null,Resolution.values(),Resolution.Overwrite);
}

Fixed version (ground truth):
@Override public Resolution getResolution(Module module,Mod mod){
  return (Resolution)JOptionPane.showInputDialog(null,String.format("String_Node_Str" + "String_Node_Str",module.getName(),mod.getName()),"String_Node_Str",JOptionPane.QUESTION_MESSAGE,null,Resolution.values(),Resolution.Overwrite);
}
Program: 134339
Project: 134339
Buggy source:
public Set<ZipEntry> getZipEntries(){
synchronized (zipPath) {
    Set<ZipEntry> set=new HashSet<>();
    try (ZipFile zipFile=new ZipFile(zipPath.toFile())){
      Enumeration<? extends ZipEntry> entries=zipFile.entries();
      while (entries.hasMoreElements()) {
        set.add(entries.nextElement());
      }
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
    return set;
  }
}

Fixed version (ground truth):
public Set<ZipEntry> getZipEntries(){
synchronized (zipPath) {
    Set<ZipEntry> set=new HashSet<>();
    try (ZipFile zipFile=new ZipFile(zipPath.toFile())){
      set.addAll(Collections.list(zipFile.entries()));
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
    return set;
  }
}
Program: 134340
Project: 134340
Buggy source:
public ModStructure(Path zipPath){
  this.zipPath=zipPath;
  zipManager=new ZipManager(zipPath);
  Path gameDataPath=null;
  Set<ZipEntry> entries=getZipManager().getZipEntries();
  for (  ZipEntry entry : entries) {
    if (!entry.isDirectory() && entry.getName().toLowerCase().contains("String_Node_Str")) {
      readmeName=entry.getName();
    }
    if (entry.isDirectory()) {
      if (entry.getName().toLowerCase().endsWith("String_Node_Str")) {
        gameDataPath=Paths.get(entry.getName());
      }
    }
  }
  for (  ZipEntry entry : entries) {
    if (entry.isDirectory()) {
      Path entryPath=toPath(entry);
      if (!entryPath.equals(gameDataPath)) {
        Path rel=gameDataPath != null ? gameDataPath.relativize(entryPath) : entryPath;
        if (rel.getNameCount() == 1) {
          modules.add(new Module(zipPath,entryPath));
        }
      }
    }
  }
}

Fixed version (ground truth):
public ModStructure(Path zipPath){
  this.zipPath=zipPath;
  zipManager=new ZipManager(zipPath);
  Path gameDataPath=null;
  Set<ZipEntry> entries=getZipManager().getZipEntries();
  for (  ZipEntry entry : entries) {
    if (!entry.isDirectory() && entry.getName().toLowerCase().contains("String_Node_Str")) {
      readmeName=entry.getName();
    }
    if (entry.isDirectory()) {
      if (entry.getName().toLowerCase().endsWith("String_Node_Str")) {
        gameDataPath=Paths.get(entry.getName());
      }
    }
  }
  Set<Path> modulePaths=new HashSet<>();
  for (  ZipEntry entry : entries) {
    if (entry.isDirectory()) {
      Path entryPath=toPath(entry);
      if (gameDataPath == null) {
        modulePaths.add(entryPath.subpath(0,1));
      }
 else       if (entryPath.startsWith(gameDataPath) && !entryPath.equals(gameDataPath)) {
        Path rel=gameDataPath.relativize(entryPath);
        if (rel.getNameCount() == 1) {
          modulePaths.add(rel);
        }
      }
    }
  }
  for (  Path modulePath : modulePaths) {
    modules.add(new Module(zipPath,modulePath));
  }
}
Program: 134341
Project: 134341
Buggy source:
public TinkerMenuBar(ModManager mm){
  this.mm=mm;
  JMenu fileMenu=new JMenu("String_Node_Str");
  fileMenu.add(new JMenuItem(new UpdatePathsAction()));
  fileMenu.add(new JMenuItem(new ExitAction()));
  add(fileMenu);
  JMenu modMenu=new JMenu("String_Node_Str");
  modMenu.add(new JMenuItem(new AddModAction()));
  modMenu.add(new JMenuItem(new DeleteModAction()));
  add(modMenu);
  JMenu updateMenu=new JMenu("String_Node_Str");
  updateMenu.add(new JMenuItem(new UpdateModAction()));
  updateMenu.add(new JMenuItem(new UpdateAllAction()));
  updateMenu.add(new JMenuItem(new CheckforUpdatesAction()));
  add(updateMenu);
  JMenu helpMenu=new JMenu("String_Node_Str");
  helpMenu.add(new JMenuItem(new AboutAction()));
  helpMenu.add(new JMenuItem(new HelpAction()));
  add(helpMenu);
  popupMenu=new JPopupMenu();
  popupMenu.add(new EnableDisableModAction());
  popupMenu.add(new DeleteModAction());
}

Fixed version (ground truth):
public TinkerMenuBar(ModManager mm){
  this.mm=mm;
  JMenu fileMenu=new JMenu("String_Node_Str");
  fileMenu.add(new JMenuItem(new UpdatePathsAction()));
  fileMenu.add(new JMenuItem(new ExitAction()));
  add(fileMenu);
  JMenu modMenu=new JMenu("String_Node_Str");
  modMenu.add(new JMenuItem(new AddModAction()));
  modMenu.add(new JMenuItem(new EnableDisableModAction()));
  modMenu.add(new JMenuItem(new DeleteModAction()));
  add(modMenu);
  JMenu updateMenu=new JMenu("String_Node_Str");
  updateMenu.add(new JMenuItem(new UpdateModAction()));
  updateMenu.add(new JMenuItem(new UpdateAllAction()));
  updateMenu.add(new JMenuItem(new CheckforUpdatesAction()));
  add(updateMenu);
  JMenu helpMenu=new JMenu("String_Node_Str");
  helpMenu.add(new JMenuItem(new AboutAction()));
  helpMenu.add(new JMenuItem(new HelpAction()));
  add(helpMenu);
  popupMenu=new JPopupMenu();
  popupMenu.add(new EnableDisableModAction());
  popupMenu.add(new DeleteModAction());
}
Program: 134342
Project: 134342
Buggy source:
public EnableModWorkflow(Mod mod,Config config,ModStateManager sm,ConflictResolver cr){
  super("String_Node_Str" + mod.getName());
  ModStructure structure=new ModStructure(mod,config);
  for (  Module module : structure.getModules()) {
    addTask(new UnzipTask(this,structure.zipPath,config.getGameDataPath().resolve(module.getName()),module.getOutput(),cr));
  }
  addTask(new MarkModEnabledTask(this,mod,sm,true));
}

Fixed version (ground truth):
public EnableModWorkflow(Mod mod,Config config,ModStateManager sm,ConflictResolver cr){
  super("String_Node_Str" + mod.getName());
  ModStructure structure=new ModStructure(mod,config);
  for (  Module module : structure.getModules()) {
    addTask(new UnzipTask(this,structure.zipPath,config.getGameDataPath(),module.getOutput(),cr));
  }
  addTask(new MarkModEnabledTask(this,mod,sm,true));
}
Program: 134343
Project: 134343
Buggy source:
@Override public URL getDownloadLink(){
  Element ele=doc.select("String_Node_Str").first();
  Matcher m=ID_PATTERN.matcher(ele.attr("String_Node_Str"));
  m.find();
  try {
    return new URL(String.format("String_Node_Str",m.group(1),m.group(2),getNewestFile().replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str")));
  }
 catch (  MalformedURLException|IndexOutOfBoundsException e) {
    e.printStackTrace();
    return null;
  }
}

Fixed version (ground truth):
@Override public URL getDownloadLink(){
  Element ele=doc.select("String_Node_Str").first();
  Matcher m=ID_PATTERN.matcher(ele.attr("String_Node_Str"));
  m.find();
  int id1=Integer.parseInt(m.group(1));
  int id2=Integer.parseInt(m.group(2));
  try {
    return new URL(String.format("String_Node_Str",id1,id2,getNewestFile().replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str")));
  }
 catch (  MalformedURLException|IndexOutOfBoundsException e) {
    e.printStackTrace();
    return null;
  }
}
Program: 134344
Project: 134344
Buggy source:
public ModManager(ModStateManager sm,Config config,Downloader pageDownloader,Downloader modDownloader,ModEnabler enabler){
  this.sm=sm;
  this.config=config;
  this.pageDownloader=pageDownloader;
  this.modDownloader=modDownloader;
  this.enabler=enabler;
  this.addListener(sm);
  enabler.addListener(this);
  pageDownloader.addListener(this);
}

Fixed version (ground truth):
public ModManager(ModStateManager sm,Config config,Downloader pageDownloader,Downloader modDownloader,ModEnabler enabler){
  this.sm=sm;
  this.config=config;
  this.pageDownloader=pageDownloader;
  this.modDownloader=modDownloader;
  this.enabler=enabler;
  this.addListener(sm);
  enabler.addListener(this);
  pageDownloader.addListener(this);
  modDownloader.addListener(this);
}
Program: 134345
Project: 134345
Buggy source:
@Before public void setUp() throws Throwable {
  manager=new ModManager(sm=mock(ModStateManager.class),config=MockConfig.getSpy(),cr=spy(new MockCR(config,sm)),downloader=mock(Downloader.class));
  mod=ModLoader.addMod(ModLoader.MECHJEB,config);
  testMod1=ModLoader.addMod(ModLoader.TESTMOD1,config);
  testMod2=ModLoader.addMod(ModLoader.TESTMOD2,config);
}

Fixed version (ground truth):
@Before public void setUp() throws Throwable {
  manager=new ModManager(sm=mock(ModStateManager.class),config=MockConfig.getSpy(),downloader=mock(Downloader.class),mock(ModEnabler.class));
  mod=ModLoader.addMod(ModLoader.MECHJEB,config);
  testMod1=ModLoader.addMod(ModLoader.TESTMOD1,config);
  testMod2=ModLoader.addMod(ModLoader.TESTMOD2,config);
}
Program: 134346
Project: 134346
Buggy source:
void segment(){
  segmentDir(this.sourceDir,this.targetDir);
}

Fixed version (ground truth):
public void segment(){
  segmentDir(this.sourceDir,this.targetDir);
}
Program: 134348
Project: 134348
Buggy source:
public static void writeFileByChars(String fileName,String value){
  ByteBuffer byteBuffer=ByteBuffer.wrap(value.getBytes());
  FileChannel fileChannel=null;
  try {
    FileOutputStream fos=new FileOutputStream(fileName);
    fileChannel=fos.getChannel();
    FileLock fileLock=fileChannel.tryLock();
    fileChannel.write(byteBuffer);
    fileLock.release();
    fileChannel.close();
    fos.close();
  }
 catch (  FileNotFoundException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public static void writeFileByChars(String fileName,String value){
  ByteBuffer byteBuffer=ByteBuffer.wrap(value.getBytes());
  FileChannel fileChannel=null;
  try {
    File file=new File(fileName);
    if (!file.getParentFile().exists()) {
      file.getParentFile().mkdirs();
    }
    FileOutputStream fos=new FileOutputStream(fileName);
    fileChannel=fos.getChannel();
    FileLock fileLock=fileChannel.tryLock();
    fileChannel.write(byteBuffer);
    fileLock.release();
    fileChannel.close();
    fos.close();
  }
 catch (  FileNotFoundException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
}
Program: 134349
Project: 134349
Buggy source:
public String downloadFile(String url){
  String filePath=null;
  HttpRequestRetryHandler myRetryHandler=new HttpRequestRetryHandler(){
    @Override public boolean retryRequest(    IOException arg0,    int executionCount,    HttpContext arg2){
      if (executionCount > 5) {
        return false;
      }
      return false;
    }
  }
;
  CloseableHttpClient httpClient=HttpClients.custom().setRetryHandler(myRetryHandler).build();
  RequestConfig requestConfig=RequestConfig.custom().setConnectTimeout(Constant.DEFAULT_CONNECT_TIMEOUT).setConnectionRequestTimeout(Constant.DEFAULT_CONNECTION_REQUEST_TIMEOUT).build();
  HttpGet httpGet=new HttpGet(url);
  httpGet.setConfig(requestConfig);
  CloseableHttpResponse response;
  try {
    response=httpClient.execute(httpGet);
    StatusLine statusLine=response.getStatusLine();
    if (statusLine.getStatusCode() != HttpStatus.SC_OK) {
      System.err.println("String_Node_Str" + statusLine);
      filePath=null;
    }
    HttpEntity entity=response.getEntity();
    if (entity != null) {
      InputStream entityContent=entity.getContent();
      filePath="String_Node_Str" + getFileNameByUrl(url);
      saveToLocal(entityContent,filePath);
    }
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  System.out.println("String_Node_Str" + filePath + "String_Node_Str");
  return filePath;
}

Fixed version (ground truth):
public String downloadFile(String url){
  String filePath=null;
  HttpRequestRetryHandler myRetryHandler=new HttpRequestRetryHandler(){
    @Override public boolean retryRequest(    final IOException arg0,    int executionCount,    final HttpContext arg2){
      if (executionCount > 5) {
        return false;
      }
      return false;
    }
  }
;
  CloseableHttpClient httpClient=HttpClients.custom().setRetryHandler(myRetryHandler).build();
  RequestConfig requestConfig=RequestConfig.custom().setConnectTimeout(Constant.DEFAULT_CONNECT_TIMEOUT).setConnectionRequestTimeout(Constant.DEFAULT_CONNECTION_REQUEST_TIMEOUT).build();
  HttpGet httpGet=new HttpGet(url);
  httpGet.setConfig(requestConfig);
  CloseableHttpResponse response;
  try {
    response=httpClient.execute(httpGet);
    StatusLine statusLine=response.getStatusLine();
    if (statusLine.getStatusCode() != HttpStatus.SC_OK) {
      System.err.println("String_Node_Str" + statusLine);
      filePath=null;
    }
    HttpEntity entity=response.getEntity();
    if (entity != null) {
      InputStream entityContent=entity.getContent();
      filePath="String_Node_Str" + getFileNameByUrl(url);
      saveToLocal(entityContent,filePath);
    }
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  System.out.println("String_Node_Str" + filePath + "String_Node_Str");
  return filePath;
}
Program: 134350
Project: 134350
Buggy source:
public String getFileNameByUrl(String url){
  StringUtils.removeStartIgnoreCase(url,"String_Node_Str");
  StringUtils.removeStartIgnoreCase(url,"String_Node_Str");
  url=url.replaceAll("String_Node_Str","String_Node_Str");
  return url;
}

Fixed version (ground truth):
public String getFileNameByUrl(String url){
  url=StringUtils.removeStartIgnoreCase(url,"String_Node_Str");
  url=StringUtils.removeStartIgnoreCase(url,"String_Node_Str");
  url=url.replaceAll("String_Node_Str","String_Node_Str");
  return url;
}
Program: 134351
Project: 134351
Buggy source:
@Override public boolean retryRequest(IOException arg0,int executionCount,HttpContext arg2){
  if (executionCount > 5) {
    return false;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean retryRequest(final IOException arg0,int executionCount,final HttpContext arg2){
  if (executionCount > 5) {
    return false;
  }
  return false;
}
Program: 134352
Project: 134352
Buggy source:
public static Set<String> extracLinks(String url,LinkFilter filter){
  Set<String> links=new HashSet<String>();
  try {
    Parser parser=new Parser(url);
    NodeFilter frameFilter=new NodeFilter(){
      /** 
 */
      private static final long serialVersionUID=1L;
      public boolean accept(      Node node){
        if (node.getText().startsWith("String_Node_Str") && node.getText().contains("String_Node_Str")) {
          return true;
        }
 else {
          return false;
        }
      }
    }
;
    OrFilter linkFilter=new OrFilter(new NodeClassFilter(LinkTag.class),frameFilter);
    NodeList list=parser.extractAllNodesThatMatch(linkFilter);
    for (int i=0; i < list.size(); i++) {
      Node tag=list.elementAt(i);
      if (tag instanceof LinkTag) {
        LinkTag link=(LinkTag)tag;
        String linkUrl=link.getLink();
        if (filter.accept(linkUrl)) {
          links.add(linkUrl);
        }
      }
 else {
        String frame=tag.getText();
        int start=frame.indexOf("String_Node_Str");
        frame=frame.substring(start);
        int end=frame.indexOf("String_Node_Str");
        if (end == -1) {
          end=frame.indexOf("String_Node_Str");
        }
        String frameUrl=frame.substring(5,end - 1);
        if (filter.accept(frameUrl)) {
          links.add(frameUrl);
        }
      }
    }
  }
 catch (  ParserException e) {
    e.printStackTrace();
  }
  return links;
}

Fixed version (ground truth):
public static Set<String> extracLinks(String url,LinkFilter filter){
  Set<String> links=new HashSet<String>();
  try {
    Parser parser=new Parser(url);
    NodeFilter frameFilter=new NodeFilter(){
      /** 
 */
      private static final long serialVersionUID=1L;
      public boolean accept(      Node node){
        return node.getText().startsWith("String_Node_Str") && node.getText().contains("String_Node_Str");
      }
    }
;
    OrFilter linkFilter=new OrFilter(new NodeClassFilter(LinkTag.class),frameFilter);
    NodeList list=parser.extractAllNodesThatMatch(linkFilter);
    for (int i=0; i < list.size(); i++) {
      Node tag=list.elementAt(i);
      if (tag instanceof LinkTag) {
        LinkTag link=(LinkTag)tag;
        String linkUrl=link.getLink();
        if (filter.accept(linkUrl)) {
          links.add(linkUrl);
        }
      }
 else {
        String frame=tag.getText();
        int start=frame.indexOf("String_Node_Str");
        frame=frame.substring(start);
        int end=frame.indexOf("String_Node_Str");
        if (end == -1) {
          end=frame.indexOf("String_Node_Str");
        }
        String frameUrl=frame.substring(5,end - 1);
        if (filter.accept(frameUrl)) {
          links.add(frameUrl);
        }
      }
    }
  }
 catch (  ParserException e) {
    e.printStackTrace();
  }
  return links;
}
Program: 134353
Project: 134353
Buggy source:
public boolean accept(Node node){
  if (node.getText().startsWith("String_Node_Str") && node.getText().contains("String_Node_Str")) {
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
public boolean accept(Node node){
  return node.getText().startsWith("String_Node_Str") && node.getText().contains("String_Node_Str");
}
Program: 134356
Project: 134356
Buggy source:
public static void main(String[] argv){
  MyEngine index=new MyEngine("String_Node_Str");
  ArrayList<ResultModel> testList=index.getResultSet("String_Node_Str");
  for (int i=0; i < testList.size(); i++) {
    testList.get(i).printInfo();
    System.out.println(i);
  }
}

Fixed version (ground truth):
public static void main(final String[] argv){
  MyEngine index=new MyEngine("String_Node_Str");
  ArrayList<ResultModel> testList=index.getResultSet("String_Node_Str");
  for (int i=0; i < testList.size(); i++) {
    testList.get(i).printInfo();
    System.out.println(i);
  }
}
Program: 134357
Project: 134357
Buggy source:
public Html2Text() throws IOException {
  File directory=new File("String_Node_Str");
  File[] fileList=directory.listFiles();
  if (fileList != null) {
    for (int i=0; i < fileList.length; i++) {
      String fileName=fileList[i].getName();
      StringBuilder content=new StringBuilder();
      String str=new String();
      BufferedReader in=new BufferedReader(new InputStreamReader(new FileInputStream(fileList[i]),"String_Node_Str"));
      while ((str=in.readLine()) != null) {
        content.append(str);
      }
      in.close();
      String result=this.DealHtml(content);
      ReadAndWrite.writeFileByChars("String_Node_Str" + fileName + "String_Node_Str",result);
      String titleResult=content.toString();
      int titleStart=titleResult.indexOf("String_Node_Str");
      if (titleStart > 0) {
        titleResult=titleResult.substring(titleStart);
      }
      int titleEnd=titleResult.indexOf("String_Node_Str");
      if (titleEnd > 0) {
        titleResult=titleResult.substring(0,titleEnd);
      }
      titleResult=this.DealHtml(titleResult);
      ReadAndWrite.writeFileByChars("String_Node_Str" + fileName + "String_Node_Str",titleResult);
      System.out.println("String_Node_Str" + fileName + "String_Node_Str");
    }
  }
}

Fixed version (ground truth):
public Html2Text() throws IOException {
  File directory=new File("String_Node_Str");
  File[] fileList=directory.listFiles();
  if (fileList != null) {
    for (int i=0; i < fileList.length; i++) {
      String fileName=fileList[i].getName();
      StringBuilder content=new StringBuilder();
      String str=new String();
      BufferedReader in=new BufferedReader(new InputStreamReader(new FileInputStream(fileList[i]),"String_Node_Str"));
      while ((str=in.readLine()) != null) {
        content.append(str);
      }
      in.close();
      String result=this.dealHtml(content);
      FileUtils.writeStringToFile(new File("String_Node_Str" + fileName + "String_Node_Str"),result,"String_Node_Str");
      String titleResult=content.toString();
      int titleStart=titleResult.indexOf("String_Node_Str");
      if (titleStart > 0) {
        titleResult=titleResult.substring(titleStart);
      }
      int titleEnd=titleResult.indexOf("String_Node_Str");
      if (titleEnd > 0) {
        titleResult=titleResult.substring(0,titleEnd);
      }
      titleResult=this.dealHtml(titleResult);
      FileUtils.writeStringToFile(new File("String_Node_Str" + fileName + "String_Node_Str"),titleResult,"String_Node_Str");
      System.out.println("String_Node_Str" + fileName + "String_Node_Str");
    }
  }
}
Program: 134358
Project: 134358
Buggy source:
public void segmentDir(String source,String target){
  File[] file=new File(source).listFiles();
  if (file == null) {
    return;
  }
  for (int i=0; i < file.length; ++i) {
    if (file[i].isFile()) {
      segmentFile(file[i].getAbsolutePath(),target + File.separator + file[i].getName());
    }
    if (file[i].isDirectory()) {
      String _sourceDir=source + File.separator + file[i].getName();
      String _targetDir=target + File.separator + file[i].getName();
      new File(_targetDir).mkdirs();
      segmentDir(_sourceDir,_targetDir);
    }
  }
}

Fixed version (ground truth):
/** 
 * @param source source directory.
 * @param target target directory.
 */
public final void segmentDir(final String source,final String target){
  File[] file=new File(source).listFiles();
  if (file == null) {
    return;
  }
  for (int i=0; i < file.length; ++i) {
    if (file[i].isFile()) {
      segmentFile(file[i].getAbsolutePath(),target + File.separator + file[i].getName());
    }
    if (file[i].isDirectory()) {
      String sourceDirTmp=source + File.separator + file[i].getName();
      String targetDirTmp=target + File.separator + file[i].getName();
      new File(targetDirTmp).mkdirs();
      segmentDir(sourceDirTmp,targetDirTmp);
    }
  }
}
Program: 134359
Project: 134359
Buggy source:
public Spilt(String source,String target){
  this.sourceDir=source;
  this.targetDir=target;
}

Fixed version (ground truth):
/** 
 * @param source source directory.
 * @param target target directory.
 */
public Spilt(final String source,final String target){
  this.sourceDir=source;
  this.targetDir=target;
}
Program: 134360
Project: 134360
Buggy source:
public void segmentFile(String srcfilename,String resfilename){
  File filetemp=new File(resfilename);
  filetemp.getParentFile().mkdirs();
  if (!(filetemp.exists())) {
    try {
      filetemp.createNewFile();
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
  }
  FileReader filereader=null;
  FileWriter filewriter=null;
  Lexeme lexeme=null;
  try {
    filereader=new FileReader(srcfilename);
  }
 catch (  FileNotFoundException e0) {
    e0.printStackTrace();
  }
  try {
    filewriter=new FileWriter(resfilename);
  }
 catch (  IOException e1) {
    e1.printStackTrace();
  }
  IKSegmenter iksegmentation=new IKSegmenter(filereader,true);
  try {
    while ((lexeme=iksegmentation.next()) != null) {
      filewriter.write(lexeme.getLexemeText());
      filewriter.write("String_Node_Str");
    }
  }
 catch (  IOException e2) {
    e2.printStackTrace();
  }
 finally {
    if (filewriter != null) {
      try {
        filewriter.close();
      }
 catch (      IOException e) {
        e.printStackTrace();
      }
    }
  }
  System.out.println("String_Node_Str" + srcfilename + "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * @param srcfilename srcfilename
 * @param resfilename resfilename
 */
public final void segmentFile(final String srcfilename,final String resfilename){
  File filetemp=new File(resfilename);
  filetemp.getParentFile().mkdirs();
  if (!(filetemp.exists())) {
    try {
      filetemp.createNewFile();
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
  }
  FileReader filereader=null;
  FileWriter filewriter=null;
  Lexeme lexeme=null;
  try {
    filereader=new FileReader(srcfilename);
  }
 catch (  FileNotFoundException e0) {
    e0.printStackTrace();
  }
  try {
    filewriter=new FileWriter(resfilename);
  }
 catch (  IOException e1) {
    e1.printStackTrace();
  }
  IKSegmenter iksegmentation=new IKSegmenter(filereader,true);
  try {
    while ((lexeme=iksegmentation.next()) != null) {
      filewriter.write(lexeme.getLexemeText());
      filewriter.write("String_Node_Str");
    }
  }
 catch (  IOException e2) {
    e2.printStackTrace();
  }
 finally {
    if (filewriter != null) {
      try {
        filewriter.close();
      }
 catch (      IOException e) {
        e.printStackTrace();
      }
    }
  }
  System.out.println("String_Node_Str" + srcfilename + "String_Node_Str");
}
Program: 134361
Project: 134361
Buggy source:
public void segment(){
  segmentDir(this.sourceDir,this.targetDir);
}

Fixed version (ground truth):
/** 
 */
public final void segment(){
  segmentDir(this.sourceDir,this.targetDir);
}
Program: 134362
Project: 134362
Buggy source:
public static void writeFileByChars(String fileName,String value){
  String path=fileName;
  ByteBuffer bb=ByteBuffer.wrap(value.getBytes());
  value=null;
  FileChannel out2;
  try {
    out2=new FileOutputStream(path).getChannel();
    out2.write(bb);
    bb.clear();
    bb=null;
    out2.close();
  }
 catch (  FileNotFoundException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public static void writeFileByChars(String fileName,String value){
  String path=fileName;
  ByteBuffer bb=ByteBuffer.wrap(value.getBytes());
  value=null;
  FileChannel out2;
  try {
    FileOutputStream fos=new FileOutputStream(path);
    out2=fos.getChannel();
    out2.write(bb);
    bb.clear();
    bb=null;
    out2.close();
    fos.close();
  }
 catch (  FileNotFoundException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
}
Program: 134363
Project: 134363
Buggy source:
public static void writeFileByChars(String fileName,String value){
  ByteBuffer byteBuffer=ByteBuffer.wrap(value.getBytes());
  File filepath=new File(fileName);
  filepath.getParentFile().mkdirs();
  FileChannel out;
  try {
    out=new FileOutputStream(fileName).getChannel();
    out.write(byteBuffer);
    byteBuffer.clear();
    byteBuffer=null;
    out.close();
  }
 catch (  FileNotFoundException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public static void writeFileByChars(String fileName,String value){
  ByteBuffer byteBuffer=ByteBuffer.wrap(value.getBytes());
  File filepath=new File(fileName);
  filepath.getParentFile().mkdirs();
  FileChannel out;
  try {
    FileOutputStream outputStream=new FileOutputStream(fileName);
    out=outputStream.getChannel();
    out.write(byteBuffer);
    byteBuffer.clear();
    byteBuffer=null;
    out.close();
    outputStream.close();
  }
 catch (  FileNotFoundException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
}
Program: 134365
Project: 134365
Buggy source:
/** 
 * Called by the scheduler when it is time to run the check
 * @param gridName the name of the grid containing this check 
 * @param rowName the name of the row containing this check
 * @param colName the name of the column containing this check
 * @param params a map of check-specific parameters defined in the check configuration
 * @param timeout the maximum amount of time to wait for this check
 * @return the result of the check
 */
public CheckResult check(String gridName,String rowName,String colName,Map params,Map<String,String> rowVars,Map<String,String> colVars,int timeout);

Fixed version (ground truth):
/** 
 * Called by the scheduler when it is time to run the check
 * @param gridName the name of the grid containing this check 
 * @param rowName the name of the row containing this check
 * @param colName the name of the column containing this check
 * @param params a map of check-specific parameters defined in the check configuration
 * @param timeout the maximum amount of time to wait for this check
 * @return the result of the check
 */
public CheckResult check(String gridName,String rowName,String colName,Map params,TemplateVariableMap rowVars,TemplateVariableMap colVars,int timeout);
Program: 134367
Project: 134367
Buggy source:
private String replaceVars(String param,Map<String,String> vars,Map<String,String> rowVars,Map<String,String> colVars){
  for (  String rowVar : rowVars.keySet()) {
    param=param.replaceAll("String_Node_Str" + rowVar,rowVars.get(rowVar));
  }
  for (  String colVar : colVars.keySet()) {
    param=param.replaceAll("String_Node_Str" + colVar,colVars.get(colVar));
  }
  for (  String var : vars.keySet()) {
    param=param.replaceAll(var,vars.get(var));
  }
  return param;
}

Fixed version (ground truth):
private String replaceVars(String param,TemplateVariableMap vars,TemplateVariableMap rowVars,TemplateVariableMap colVars){
  for (  String rowVar : rowVars.keySet()) {
    param=param.replaceAll("String_Node_Str" + rowVar,rowVars.get(rowVar));
  }
  for (  String colVar : colVars.keySet()) {
    param=param.replaceAll("String_Node_Str" + colVar,colVars.get(colVar));
  }
  for (  String var : vars.keySet()) {
    param=param.replaceAll(var,vars.get(var));
  }
  return param;
}
Program: 134369
Project: 134369
Buggy source:
public CheckResult check(String gridName,String rowName,String colName,Map params,Map rowVars,Map colVars,int timeout){
  Random rand=new Random();
  int resultCode=rand.nextInt(CheckConstants.RESULT_UNKNOWN + 1);
  return new CheckResult(resultCode,"String_Node_Str",null);
}

Fixed version (ground truth):
public CheckResult check(String gridName,String rowName,String colName,Map params,TemplateVariableMap rowVars,TemplateVariableMap colVars,int timeout){
  Random rand=new Random();
  int resultCode=rand.nextInt(CheckConstants.RESULT_UNKNOWN + 1);
  return new CheckResult(resultCode,"String_Node_Str",null);
}