nus-yam/ex-repair huggingface dataset:
Program: 50053
Project: 50053
Buggy source:
@Override public void run(){
  log.debug("String_Node_Str");
  while (!closed) {
    try {
      log.debug("String_Node_Str");
      if (sessionContext.isLogRespXML())       parser.parse(new InputSource(new TeeInputStream(inStream,new FileOutputStream(sessionContext.getLogFileXML()))));
 else       parser.parse(new InputSource(inStream));
    }
 catch (    InterruptedIOException ie) {
      log.warn("String_Node_Str");
    }
catch (    IOException e) {
      e.printStackTrace();
    }
catch (    SAXException e) {
      if (e.getMessage().contentEquals("String_Node_Str")) {
        log.debug("String_Node_Str");
      }
 else {
        log.error(e.getMessage());
        e.printStackTrace();
        disconnect();
      }
      log.info("String_Node_Str");
    }
    log.debug("String_Node_Str");
  }
  log.debug("String_Node_Str");
}

Fixed version (ground truth):
@Override public void run(){
  log.debug("String_Node_Str");
  while (!closed) {
    try {
      log.debug("String_Node_Str");
      if (sessionContext.isLogRespXML())       parser.parse(new InputSource(new TeeInputStream(inStream,new FileOutputStream(sessionContext.getLogFileXML()))));
 else {
        parser.parse(new InputSource(inStream));
      }
    }
 catch (    InterruptedIOException ie) {
      log.warn("String_Node_Str");
    }
catch (    IOException e) {
      e.printStackTrace();
    }
catch (    SAXException e) {
      if (e.getMessage().contentEquals("String_Node_Str")) {
        log.debug("String_Node_Str");
      }
 else {
        log.error(e.getMessage());
        e.printStackTrace();
        disconnect();
      }
      log.info("String_Node_Str");
    }
    log.debug("String_Node_Str");
  }
  log.debug("String_Node_Str");
}
Program: 50054
Project: 50054
Buggy source:
public void sendAsyncQuery(RPCElement query){
  try {
    outStream.write(simHelper.generateReply(query).getBytes());
  }
 catch (  IOException e) {
    log.error(e.getMessage());
  }
  log.info("String_Node_Str");
}

Fixed version (ground truth):
public void sendAsyncQuery(RPCElement query){
  try {
    outStream.write(simHelper.generateReply(query).getBytes());
    outStream.flush();
  }
 catch (  IOException e) {
    log.error(e.getMessage());
  }
  log.info("String_Node_Str");
}
Program: 50055
Project: 50055
Buggy source:
/** 
 * This method handles the case where a project looks like a Grails project but doesn't have grails nature. 
 */
private void handleNoGrailsNature(final IProject project,GrailsVersion grailsVersion){
  debug("String_Node_Str" + project);
  final IGrailsInstall install=GrailsCoreActivator.getDefault().getInstallManager().getDefaultGrailsInstall();
  Assert.isTrue(install.getVersion().equals(grailsVersion));
  boolean convert=askConvertToGrailsProject(project,grailsVersion);
  if (convert) {
    debug("String_Node_Str");
    WorkspaceJob job=new WorkspaceJob("String_Node_Str" + project.getName() + "String_Node_Str"){
      @Override public IStatus runInWorkspace(      IProgressMonitor monitor) throws CoreException {
        monitor.beginTask("String_Node_Str",2);
        try {
          performLegacyConversion(project,new SubProgressMonitor(monitor,1));
          GrailsCommandUtils.eclipsifyProject(install,project);
          monitor.worked(1);
          return Status.OK_STATUS;
        }
  finally {
          monitor.done();
        }
      }
    }
;
    job.setRule(ResourcesPlugin.getWorkspace().getRuleFactory().buildRule());
    job.setPriority(Job.INTERACTIVE);
    job.schedule();
  }
}

Fixed version (ground truth):
/** 
 * This method handles the case where a project looks like a Grails project but doesn't have grails nature. 
 */
private void handleNoGrailsNature(final IProject project,GrailsVersion grailsVersion){
  debug("String_Node_Str" + project);
  final IGrailsInstall install=GrailsCoreActivator.getDefault().getInstallManager().getGrailsInstall(project);
  Assert.isTrue(install.getVersion().equals(grailsVersion));
  boolean convert=askConvertToGrailsProject(project,grailsVersion);
  if (convert) {
    debug("String_Node_Str");
    WorkspaceJob job=new WorkspaceJob("String_Node_Str" + project.getName() + "String_Node_Str"){
      @Override public IStatus runInWorkspace(      IProgressMonitor monitor) throws CoreException {
        monitor.beginTask("String_Node_Str",2);
        try {
          performLegacyConversion(project,new SubProgressMonitor(monitor,1));
          GrailsCommandUtils.eclipsifyProject(install,project);
          monitor.worked(1);
          return Status.OK_STATUS;
        }
  finally {
          monitor.done();
        }
      }
    }
;
    job.setRule(ResourcesPlugin.getWorkspace().getRuleFactory().buildRule());
    job.setPriority(Job.INTERACTIVE);
    job.schedule();
  }
}
Program: 50056
Project: 50056
Buggy source:
public boolean perform(IProgressMonitor mon) throws CoreException {
  int totalWork=2;
  File copyLoc=getCopyLocation();
  if (copyLoc != null) {
    totalWork++;
  }
  mon.beginTask("String_Node_Str",totalWork);
  try {
    if (copyLoc != null) {
      FileUtils.copyDirectory(location.getValue(),copyLoc);
      mon.worked(1);
    }
    IWorkspace ws=ResourcesPlugin.getWorkspace();
    File projectDir=copyLoc != null ? copyLoc : location.getValue();
    String projectName=projectDir.getName();
    IProjectDescription projectDescription=ws.newProjectDescription(projectName);
    if (!isDefaultProjectLocation(projectName,projectDir)) {
      projectDescription.setLocation(new Path(projectDir.getAbsolutePath()));
    }
    IProject project=ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
    project.create(projectDescription,new SubProgressMonitor(mon,1));
    IGrailsInstall install=grailsInstall.getValue();
    if (install != null) {
      File projectAbsoluteFile=location.getValue();
      if (projectAbsoluteFile != null) {
        IPath projectAbsolutePath=new Path(projectAbsoluteFile.toString());
        GrailsCommandUtils.eclipsifyProject(grailsInstall.getValue(),false,projectAbsolutePath);
        return true;
      }
    }
    mon.worked(1);
    return false;
  }
 catch (  IOException e) {
    throw new CoreException(new Status(IStatus.ERROR,GrailsCoreActivator.PLUGIN_ID,"String_Node_Str",e));
  }
 finally {
    mon.done();
  }
}

Fixed version (ground truth):
public boolean perform(IProgressMonitor mon) throws CoreException {
  int totalWork=2;
  File copyLoc=getCopyLocation();
  if (copyLoc != null) {
    totalWork++;
  }
  mon.beginTask("String_Node_Str",totalWork);
  try {
    if (copyLoc != null) {
      FileUtils.copyDirectory(location.getValue(),copyLoc);
      mon.worked(1);
    }
    IWorkspace ws=ResourcesPlugin.getWorkspace();
    File projectDir=copyLoc != null ? copyLoc : location.getValue();
    String projectName=projectDir.getName();
    IProjectDescription projectDescription=ws.newProjectDescription(projectName);
    if (!isDefaultProjectLocation(projectName,projectDir)) {
      projectDescription.setLocation(new Path(projectDir.getAbsolutePath()));
    }
    IProject project=ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
    project.create(projectDescription,new SubProgressMonitor(mon,1));
    IGrailsInstall install=grailsInstall.getValue();
    if (install != null) {
      File projectAbsoluteFile=location.getValue();
      if (projectAbsoluteFile != null) {
        IPath projectAbsolutePath=new Path(projectAbsoluteFile.toString());
        GrailsCommandUtils.eclipsifyProject(grailsInstall.getValue(),projectAbsolutePath);
        return true;
      }
    }
    mon.worked(1);
    return false;
  }
 catch (  IOException e) {
    throw new CoreException(new Status(IStatus.ERROR,GrailsCoreActivator.PLUGIN_ID,"String_Node_Str",e));
  }
 finally {
    mon.done();
  }
}
Program: 50057
Project: 50057
Buggy source:
public void testCreateAndEclipsifyLinkedProject() throws Exception {
  String projName="String_Node_Str";
  GrailsCommand createApp=GrailsCommandFactory.createApp(projName);
  final File projectLoc=new File(StsTestUtil.createTempDirectory(),projName);
  createApp.setPath(projectLoc.getParent());
  createApp.synchExec();
  GrailsCommandUtils.eclipsifyProject(null,true,new Path(projectLoc.getAbsolutePath()));
  project=ResourcesPlugin.getWorkspace().getRoot().getProject(projName);
  checkProjectBasics();
}

Fixed version (ground truth):
public void testCreateAndEclipsifyLinkedProject() throws Exception {
  String projName="String_Node_Str";
  GrailsCommand createApp=GrailsCommandFactory.createApp(projName);
  final File projectLoc=new File(StsTestUtil.createTempDirectory(),projName);
  createApp.setPath(projectLoc.getParent());
  createApp.synchExec();
  GrailsCommandUtils.eclipsifyProject(null,new Path(projectLoc.getAbsolutePath()));
  project=ResourcesPlugin.getWorkspace().getRoot().getProject(projName);
  checkProjectBasics();
}
Program: 50058
Project: 50058
Buggy source:
public static boolean isVersionSynched(IProject project){
  GrailsClasspathContainer container=GrailsClasspathUtils.getClasspathContainer(JavaCore.create(project));
  GrailsVersion oldVersion=container.getGrailsVersion();
  GrailsVersion newVersion=GrailsVersion.getGrailsVersion(project);
  return oldVersion.equals(newVersion);
}

Fixed version (ground truth):
public static boolean isVersionSynched(IProject project){
  GrailsClasspathContainer container=GrailsClasspathUtils.getClasspathContainer(JavaCore.create(project));
  if (container != null) {
    GrailsVersion oldVersion=container.getGrailsVersion();
    if (oldVersion != null) {
      GrailsVersion newVersion=GrailsVersion.getGrailsVersion(project);
      return oldVersion.equals(newVersion);
    }
    return false;
  }
  return true;
}
Program: 50059
Project: 50059
Buggy source:
/** 
 * Change given project's application.properties file so it is specified to  use this GrailsVersion
 */
public void setOn(IProject project) throws Exception {
  Properties props=GrailsBuildSettingsHelper.getApplicationProperties(project);
  props.put("String_Node_Str",this.getVersionString());
  GrailsBuildSettingsHelper.saveApplicationProperties(project,props);
}

Fixed version (ground truth):
/** 
 * Change given project's application.properties file so it is specified to  use this GrailsVersion
 */
public void setOn(IProject project,boolean create) throws Exception {
  Properties props;
  if (create) {
    props=new Properties();
  }
 else {
    props=GrailsBuildSettingsHelper.getApplicationProperties(project);
  }
  props.put("String_Node_Str",this.getVersionString());
  GrailsBuildSettingsHelper.saveApplicationProperties(project,props);
}
Program: 50060
Project: 50060
Buggy source:
private void setGrailsVersion(IProject project,GrailsVersion version) throws Exception {
  version.setOn(project);
}

Fixed version (ground truth):
private void setGrailsVersion(IProject project,GrailsVersion version) throws Exception {
  version.setOn(project,false);
}
Program: 50061
Project: 50061
Buggy source:
/** 
 * Ensures that the project passed in has a classpath compatible with a grails project. Sets up project natures and compliance levels Sets up the grails dsld file
 * @param project
 * @throws Exception
 */
public static void mockGrailsProject(IProject project,GrailsVersion grailsVersion) throws Exception {
  IClasspathEntry[] classpath=JavaCore.create(project).getRawClasspath();
  boolean wasAutobuilding=isAutoBuilding();
  try {
    setAutoBuilding(false);
    @SuppressWarnings("String_Node_Str") Hashtable options=JavaCore.getDefaultOptions();
    options.put(JavaCore.COMPILER_COMPLIANCE,"String_Node_Str");
    options.put(JavaCore.COMPILER_SOURCE,"String_Node_Str");
    JavaCore.setOptions(options);
    addGrailsNature(project);
    grailsVersion.setOn(project);
    Set<String> dependencies=findDependencies();
    for (    String file : dependencies) {
      if (new File(file).isFile()) {
        if (!(file.contains("String_Node_Str") || file.contains("String_Node_Str"))) {
          addExternalLibrary(project,file);
        }
      }
 else {
        System.out.println("String_Node_Str" + file);
      }
    }
    GroovyRuntime.addGroovyClasspathContainer(JavaCore.create(project));
    File grailsDSLD=GrailsTestsActivator.getGrailsDSLD();
    addExternalLibrary(project,grailsDSLD.getCanonicalPath());
    new RefreshDSLDJob(project).run(null);
  }
  finally {
    setAutoBuilding(wasAutobuilding);
  }
}

Fixed version (ground truth):
/** 
 * Ensures that the project passed in has a classpath compatible with a grails project. Sets up project natures and compliance levels Sets up the grails dsld file
 * @param project
 * @throws Exception
 */
public static void mockGrailsProject(IProject project,GrailsVersion grailsVersion) throws Exception {
  IClasspathEntry[] classpath=JavaCore.create(project).getRawClasspath();
  boolean wasAutobuilding=isAutoBuilding();
  try {
    setAutoBuilding(false);
    @SuppressWarnings("String_Node_Str") Hashtable options=JavaCore.getDefaultOptions();
    options.put(JavaCore.COMPILER_COMPLIANCE,"String_Node_Str");
    options.put(JavaCore.COMPILER_SOURCE,"String_Node_Str");
    JavaCore.setOptions(options);
    addGrailsNature(project);
    grailsVersion.setOn(project,true);
    Set<String> dependencies=findDependencies();
    for (    String file : dependencies) {
      if (new File(file).isFile()) {
        if (!(file.contains("String_Node_Str") || file.contains("String_Node_Str"))) {
          addExternalLibrary(project,file);
        }
      }
 else {
        System.out.println("String_Node_Str" + file);
      }
    }
    GroovyRuntime.addGroovyClasspathContainer(JavaCore.create(project));
    File grailsDSLD=GrailsTestsActivator.getGrailsDSLD();
    addExternalLibrary(project,grailsDSLD.getCanonicalPath());
    new RefreshDSLDJob(project).run(null);
  }
  finally {
    setAutoBuilding(wasAutobuilding);
  }
}
Program: 50062
Project: 50062
Buggy source:
/** 
 * The cache is flushed when the classpath changes or there is a refresh dependencies Cache is selectively flushed when a service class changes
 */
public void projectChanged(GrailsElementKind[] changeKinds,IResourceDelta change){
synchronized (GrailsCore.get().getLockForProject(project)) {
    boolean foundRelevantChange=false;
    for (    GrailsElementKind changeKind : changeKinds) {
      if (changeKind == GrailsElementKind.PROJECT || changeKind == GrailsElementKind.CLASSPATH) {
        foundRelevantChange=true;
        break;
      }
    }
    if (foundRelevantChange) {
      classNodeCache.clear();
      setProject(project);
    }
  }
}

Fixed version (ground truth):
/** 
 * The cache is flushed when the classpath changes or there is a refresh dependencies Cache is selectively flushed when a service class changes
 */
public void projectChanged(GrailsElementKind[] changeKinds,IResourceDelta change){
synchronized (GrailsCore.get().getLockForProject(project)) {
    boolean foundRelevantChange=changeKinds.length > 0;
    if (foundRelevantChange) {
      classNodeCache.clear();
      setProject(project);
    }
  }
}
Program: 50063
Project: 50063
Buggy source:
private static String windowsEscape(String argument){
  if (System.getProperty("String_Node_Str").toLowerCase().indexOf("String_Node_Str") >= 0) {
    return winQuote(argument);
  }
  return argument;
}

Fixed version (ground truth):
private static String windowsEscape(String argument){
  return argument;
}
Program: 50064
Project: 50064
Buggy source:
public void testGrails20SourceAttachements() throws Exception {
  if (GrailsVersion.MOST_RECENT.compareTo(GrailsVersion.V_2_2_3) > 0) {
    try {
      doTestType(GrailsVersion.MOST_RECENT,"String_Node_Str","String_Node_Str");
      fail("String_Node_Str");
    }
 catch (    AssertionFailedError e) {
      assertTrue(e.getMessage().contains("String_Node_Str"));
    }
    DownloadSourcesActionDelegate.doit(project,new NullProgressMonitor());
    doTestType(GrailsVersion.MOST_RECENT,"String_Node_Str","String_Node_Str");
  }
}

Fixed version (ground truth):
public void testGrails20SourceAttachements() throws Exception {
  if (GrailsVersion.MOST_RECENT.compareTo(GrailsVersion.V_2_2_4) > 0) {
    try {
      doTestType(GrailsVersion.MOST_RECENT,"String_Node_Str","String_Node_Str");
      fail("String_Node_Str");
    }
 catch (    AssertionFailedError e) {
      assertTrue(e.getMessage().contains("String_Node_Str"));
    }
    DownloadSourcesActionDelegate.doit(project,new NullProgressMonitor());
    doTestType(GrailsVersion.MOST_RECENT,"String_Node_Str","String_Node_Str");
  }
}
Program: 50065
Project: 50065
Buggy source:
@Override public PerWorkingCopyInfo getPerWorkingCopyInfo(){
  if (elementInfo == null) {
    try {
      elementInfo=(CompilationUnitElementInfo)createElementInfo();
      openWhenClosed(elementInfo,new NullProgressMonitor());
    }
 catch (    JavaModelException e) {
      elementInfo=null;
      GrailsCoreActivator.log(e.getJavaModelStatus());
    }
  }
  return info;
}

Fixed version (ground truth):
@Override public PerWorkingCopyInfo getPerWorkingCopyInfo(){
  if (elementInfo == null) {
    try {
      elementInfo=(CompilationUnitElementInfo)createElementInfo();
      openWhenClosed(elementInfo,true,new NullProgressMonitor());
    }
 catch (    JavaModelException e) {
      elementInfo=null;
      GrailsCoreActivator.log(e.getJavaModelStatus());
    }
  }
  return info;
}
Program: 50066
Project: 50066
Buggy source:
private static String windowsEscape(String argument){
  if (System.getProperty("String_Node_Str").toLowerCase().indexOf("String_Node_Str") >= 0) {
    Bundle jdtLaunching=Platform.getBundle("String_Node_Str");
    if (jdtLaunching != null) {
      Version version=jdtLaunching.getVersion();
      VersionRange newEnough=new VersionRange("String_Node_Str");
      if (!newEnough.includes(version)) {
        return winQuote(argument);
      }
    }
  }
  return argument;
}

Fixed version (ground truth):
private static String windowsEscape(String argument){
  Bundle jdtLaunching=Platform.getBundle("String_Node_Str");
  if (jdtLaunching != null) {
    Version version=jdtLaunching.getVersion();
    Version newEnough=new Version("String_Node_Str");
    if (newEnough.compareTo(version) <= 0) {
    }
 else {
      return winQuote(argument);
    }
  }
  return argument;
}
Program: 50067
Project: 50067
Buggy source:
private static String windowsEscape(String argument){
  return argument;
}

Fixed version (ground truth):
private static String windowsEscape(String argument){
  if (System.getProperty("String_Node_Str").toLowerCase().indexOf("String_Node_Str") >= 0) {
    Bundle jdtLaunching=Platform.getBundle("String_Node_Str");
    if (jdtLaunching != null) {
      Version version=jdtLaunching.getVersion();
      VersionRange newEnough=new VersionRange("String_Node_Str");
      if (!newEnough.includes(version)) {
        return winQuote(argument);
      }
    }
  }
  return argument;
}
Program: 50069
Project: 50069
Buggy source:
/** 
 * It is possible to have controller without associated views. This shouldn't break the refactoring.
 */
public void testPerformRenameActionWithoutViewRefactoring() throws Exception {
  importZippedProject("String_Node_Str");
  checkImportedProject();
  createResource(project,"String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  String oldActionName="String_Node_Str";
  String newActionName="String_Node_Str";
  IType controller=getType("String_Node_Str");
  IMethod target=controller.getMethod(oldActionName,new String[]{});
  RenameMethodProcessor processor=new RenameVirtualMethodProcessor(target);
  processor.setNewElementName(newActionName);
  RenameRefactoring refactoring=new RenameRefactoring(processor);
  RefactoringStatus status=performRefactoring(refactoring,true,false);
  assertOK(status);
  assertFile("String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  String songControllerPath="String_Node_Str";
  String songController=getContents(ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(songControllerPath)));
  assertFile(songControllerPath,songController);
}

Fixed version (ground truth):
/** 
 * It is possible to have controller without associated views. This shouldn't break the refactoring.
 */
public void testPerformRenameActionWithoutViewRefactoring() throws Exception {
  importZippedProject("String_Node_Str");
  checkImportedProject();
  createResource(project,"String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  StsTestUtil.assertNoErrors(project);
  String oldActionName="String_Node_Str";
  String newActionName="String_Node_Str";
  IType controller=getType("String_Node_Str");
  IMethod target=controller.getMethod(oldActionName,new String[]{});
  RenameMethodProcessor processor=new RenameVirtualMethodProcessor(target);
  processor.setNewElementName(newActionName);
  RenameRefactoring refactoring=new RenameRefactoring(processor);
  RefactoringStatus status=performRefactoring(refactoring,true,false);
  assertOK(status);
  assertFile("String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  String songControllerPath="String_Node_Str";
  String songController=getContents(ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(songControllerPath)));
  assertFile(songControllerPath,songController);
}
Program: 50071
Project: 50071
Buggy source:
public GrailsCommandExecution(GrailsClient process,GrailsCommand cmd){
  this.process=process;
  this.cmd=cmd;
  this.bytesOut=new LimitedByteArrayOutputStream(GrailsCoreActivator.getDefault().getGrailsCommandOutputLimit());
  this.bytesErr=new LimitedByteArrayOutputStream(GrailsCoreActivator.getDefault().getGrailsCommandOutputLimit());
  this.console=buildConsole(cmd,bytesOut,bytesErr);
  this.console.setExection(this);
}

Fixed version (ground truth):
public GrailsCommandExecution(GrailsClient process,GrailsCommand cmd){
  this.process=process;
  this.cmd=cmd;
  this.bytesOut=new LimitedByteArrayOutputStream(GrailsCoreActivator.getDefault().getGrailsCommandOutputLimit());
  this.bytesErr=new LimitedByteArrayOutputStream(GrailsCoreActivator.getDefault().getGrailsCommandOutputLimit());
  this.console=buildConsole(cmd,bytesOut,bytesErr);
}
Program: 50072
Project: 50072
Buggy source:
/** 
 * Get the springloaded jar, search for it the first time. Cached after that 
 */
public File get(){
  if (getVersion().compareTo(GrailsVersion.V_2_0_0) >= 0) {
    if (foundJar == null) {
      find(new File(getHome(),searchIn));
    }
  }
  return foundJar;
}

Fixed version (ground truth):
/** 
 * Get the springloaded jar, search for it the first time. Cached after that 
 */
public File get(){
  if (getVersion().compareTo(GrailsVersion.V_2_0_0) >= 0) {
    if (foundJar == null) {
      for (      String searchLoc : searchIn) {
        if (foundJar != null) {
          break;
        }
        find(new File(getHome(),searchLoc));
      }
    }
  }
  return foundJar;
}
Program: 50073
Project: 50073
Buggy source:
public static void configureGrailsVersions(boolean useGrails200){
  if (useGrails200) {
    GrailsVersion.PREVIOUS_PREVIOUS=GrailsVersion.V_1_3_7;
    GrailsVersion.PREVIOUS=GrailsVersion.V_2_0_4;
    GrailsVersion.MOST_RECENT=GrailsVersion.V_2_1_1_SNAP;
  }
 else {
    GrailsVersion.PREVIOUS_PREVIOUS=GrailsVersion.V_1_3_6;
    GrailsVersion.PREVIOUS=GrailsVersion.V_1_3_7;
    GrailsVersion.MOST_RECENT=GrailsVersion.V_1_3_8;
  }
  System.out.println("String_Node_Str" + GrailsVersion.MOST_RECENT);
}

Fixed version (ground truth):
public static void configureGrailsVersions(boolean useGrails200){
  if (useGrails200) {
    GrailsVersion.PREVIOUS_PREVIOUS=GrailsVersion.V_1_3_7;
    GrailsVersion.PREVIOUS=GrailsVersion.V_2_0_4;
    GrailsVersion.MOST_RECENT=GrailsVersion.V_2_1_0;
  }
 else {
    GrailsVersion.PREVIOUS_PREVIOUS=GrailsVersion.V_1_3_6;
    GrailsVersion.PREVIOUS=GrailsVersion.V_1_3_7;
    GrailsVersion.MOST_RECENT=GrailsVersion.V_1_3_8;
  }
  System.out.println("String_Node_Str" + GrailsVersion.MOST_RECENT);
}
Program: 50074
Project: 50074
Buggy source:
private boolean isMavenProject(IJavaProject javaProject) throws CoreException {
  return javaProject.getProject().hasNature(M2E_NATURE);
}

Fixed version (ground truth):
private boolean isMavenProject(IJavaProject javaProject) throws CoreException {
  try {
    return javaProject.getProject().hasNature(M2E_NATURE);
  }
 catch (  CoreException e) {
    GrailsCoreActivator.log(e);
    return false;
  }
}
Program: 50075
Project: 50075
Buggy source:
public void run(IProgressMonitor monitor) throws CoreException {
  if (!isMavenProject(javaProject)) {
    return;
  }
  javaProject.getProject().refreshLocal(IResource.DEPTH_INFINITE,monitor);
  GrailsClasspathContainer container=GrailsClasspathUtils.getClasspathContainer(javaProject);
  if (container != null) {
    container.invalidate();
  }
  GrailsCore.get().connect(javaProject.getProject(),PerProjectDependencyDataCache.class).refreshData();
  GrailsCore.get().connect(javaProject.getProject(),PerProjectPluginCache.class).refreshDependencyCache();
  SourceFolderJob updateSourceFolders=new SourceFolderJob(javaProject);
  updateSourceFolders.refreshSourceFolders(new NullProgressMonitor());
  javaProject.setRawClasspath(javaProject.getRawClasspath(),monitor);
}

Fixed version (ground truth):
public void run(IProgressMonitor monitor) throws CoreException {
  if (isMavenProject(javaProject)) {
    return;
  }
  javaProject.getProject().refreshLocal(IResource.DEPTH_INFINITE,monitor);
  GrailsClasspathContainer container=GrailsClasspathUtils.getClasspathContainer(javaProject);
  if (container != null) {
    container.invalidate();
  }
  GrailsCore.get().connect(javaProject.getProject(),PerProjectDependencyDataCache.class).refreshData();
  GrailsCore.get().connect(javaProject.getProject(),PerProjectPluginCache.class).refreshDependencyCache();
  SourceFolderJob updateSourceFolders=new SourceFolderJob(javaProject);
  updateSourceFolders.refreshSourceFolders(new NullProgressMonitor());
  javaProject.setRawClasspath(javaProject.getRawClasspath(),monitor);
}
Program: 50076
Project: 50076
Buggy source:
public static String[] getURLDependencies() throws Exception {
  List<String> allJars=new ArrayList<String>();
  allJars.add(getLocationForBundle("String_Node_Str"));
  allJars.add(getLocationForBundle("String_Node_Str"));
  allJars.add(FileLocator.getBundleFile(elBundle).getAbsolutePath());
  GrailsTest.waitForGrailsIntall();
  GrailsTest.ensureDefaultGrailsVersion(GrailsVersion.MOST_RECENT);
  IGrailsInstall install=GrailsCoreActivator.getDefault().getInstallManager().getInstallFor(GrailsVersion.MOST_RECENT);
  if (install == null) {
    throw new AssertionFailedError("String_Node_Str" + GrailsVersion.MOST_RECENT);
  }
  allJars.addAll(findJars(install.getHome() + "String_Node_Str",true));
  allJars.addAll(findJars(install.getHome() + "String_Node_Str",true));
  return allJars.toArray(new String[0]);
}

Fixed version (ground truth):
public static String[] getURLDependencies() throws Exception {
  List<String> allJars=new ArrayList<String>();
  allJars.add(getLocationForBundle("String_Node_Str"));
  allJars.add(getLocationForBundle("String_Node_Str"));
  GrailsTest.waitForGrailsIntall();
  GrailsTest.ensureDefaultGrailsVersion(GrailsVersion.MOST_RECENT);
  IGrailsInstall install=GrailsCoreActivator.getDefault().getInstallManager().getInstallFor(GrailsVersion.MOST_RECENT);
  if (install == null) {
    throw new AssertionFailedError("String_Node_Str" + GrailsVersion.MOST_RECENT);
  }
  allJars.addAll(findJars(install.getHome() + "String_Node_Str",true));
  allJars.addAll(findJars(install.getHome() + "String_Node_Str",true));
  return allJars.toArray(new String[0]);
}
Program: 50077
Project: 50077
Buggy source:
@Override public AccountHolder getAccountHolder(String uuidOrName){
  OfflinePlayer player;
  try {
    UUID playerId=UUID.fromString(uuidOrName);
    player=Bukkit.getOfflinePlayer(playerId);
  }
 catch (  IllegalArgumentException ignored) {
    for (    OfflinePlayer p : Bukkit.getOfflinePlayers()) {
      if (p.getName().equals(uuidOrName))       return new PlayerAccountHolder(p);
    }
    return null;
  }
  if (player.isOnline() || player.hasPlayedBefore())   return new PlayerAccountHolder(player);
 else   return null;
}

Fixed version (ground truth):
@Override public AccountHolder getAccountHolder(String uuidOrName){
  if (uuidOrName == null)   return null;
  OfflinePlayer player;
  try {
    UUID playerId=UUID.fromString(uuidOrName);
    player=Bukkit.getOfflinePlayer(playerId);
  }
 catch (  IllegalArgumentException ignored) {
    for (    OfflinePlayer p : Bukkit.getOfflinePlayers()) {
      if (uuidOrName.equals(p.getName()))       return new PlayerAccountHolder(p);
    }
    return null;
  }
  if (player.isOnline() || player.hasPlayedBefore())   return new PlayerAccountHolder(player);
 else   return null;
}
Program: 50078
Project: 50078
Buggy source:
@Override public AccountHolder getAccountHolder(String uuidOrName){
  OfflinePlayer player;
  try {
    UUID playerId=UUID.fromString(uuidOrName);
    player=Bukkit.getOfflinePlayer(playerId);
  }
 catch (  IllegalArgumentException ignored) {
    player=Bukkit.getOfflinePlayer(uuidOrName);
  }
  if (player.isOnline() || player.hasPlayedBefore())   return new PlayerAccountHolder(player);
 else   return null;
}

Fixed version (ground truth):
@Override public AccountHolder getAccountHolder(String uuidOrName){
  OfflinePlayer player;
  try {
    UUID playerId=UUID.fromString(uuidOrName);
    player=Bukkit.getOfflinePlayer(playerId);
  }
 catch (  IllegalArgumentException ignored) {
    for (    OfflinePlayer p : Bukkit.getOfflinePlayers()) {
      if (p.getName().equals(uuidOrName))       return new PlayerAccountHolder(p);
    }
    return null;
  }
  if (player.isOnline() || player.hasPlayedBefore())   return new PlayerAccountHolder(player);
 else   return null;
}
Program: 50079
Project: 50079
Buggy source:
@Override public Set<AccountChest> getChests(GringottsAccount account){
  SqlQuery getChests=db.createSqlQuery("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
  getChests.setParameter("String_Node_Str",account.owner.getId());
  getChests.setParameter("String_Node_Str",account.owner.getType());
  Set<AccountChest> chests=new HashSet<>();
  for (  SqlRow result : getChests.findSet()) {
    String worldName=result.getString("String_Node_Str");
    int x=result.getInteger("String_Node_Str");
    int y=result.getInteger("String_Node_Str");
    int z=result.getInteger("String_Node_Str");
    World world=Bukkit.getWorld(worldName);
    Location loc=new Location(world,x,y,z);
    Block signBlock=loc.getBlock();
    if (Util.isSignBlock(signBlock)) {
      Sign sign=(Sign)loc.getBlock().getState();
      chests.add(new AccountChest(sign,account));
    }
 else {
      deleteAccountChest(worldName,x,y,z);
    }
  }
  return chests;
}

Fixed version (ground truth):
@Override public Set<AccountChest> getChests(GringottsAccount account){
  SqlQuery getChests=db.createSqlQuery("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
  getChests.setParameter("String_Node_Str",account.owner.getId());
  getChests.setParameter("String_Node_Str",account.owner.getType());
  Set<AccountChest> chests=new HashSet<>();
  for (  SqlRow result : getChests.findSet()) {
    String worldName=result.getString("String_Node_Str");
    int x=result.getInteger("String_Node_Str");
    int y=result.getInteger("String_Node_Str");
    int z=result.getInteger("String_Node_Str");
    World world=Bukkit.getWorld(worldName);
    if (world == null)     continue;
    Location loc=new Location(world,x,y,z);
    Block signBlock=loc.getBlock();
    if (Util.isSignBlock(signBlock)) {
      Sign sign=(Sign)loc.getBlock().getState();
      chests.add(new AccountChest(sign,account));
    }
 else {
      deleteAccountChest(worldName,x,y,z);
    }
  }
  return chests;
}
Program: 50080
Project: 50080
Buggy source:
/** 
 * Get a FactionAccountHolder based on the name of the account. Valid ids for this method are either raw faction ids, or faction ids or tags prefixed with "faction-"  Only names beginning with "faction-" will be considered, and the rest of the string  can be either a faction id or a faction tag.
 * @param name Name of the account.
 * @return a FactionAccountHolder based on the name of the account, if a valid faction could be found. null otherwise.
 */
@Override public FactionAccountHolder getAccountHolder(String id){
  String factionId=id;
  if (id.startsWith("String_Node_Str"))   factionId=id.substring(8);
  FactionAccountHolder owner=getAccountHolderById(factionId);
  if (owner != null)   return owner;
  String factionTag=factionId.substring(8);
  Faction faction=Factions.i.getByTag(factionTag);
  if (faction != null)   return new FactionAccountHolder(faction);
  return null;
}

Fixed version (ground truth):
/** 
 * Get a FactionAccountHolder based on the name of the account. Valid ids for this method are either raw faction ids, or faction ids or tags prefixed with "faction-"  Only names beginning with "faction-" will be considered, and the rest of the string  can be either a faction id or a faction tag.
 * @param name Name of the account.
 * @return a FactionAccountHolder based on the name of the account, if a valid faction could be found. null otherwise.
 */
@Override public FactionAccountHolder getAccountHolder(String id){
  String factionId=id;
  if (id.startsWith("String_Node_Str"))   factionId=id.substring(8);
  FactionAccountHolder owner=getAccountHolderById(factionId);
  if (owner != null)   return owner;
  Faction faction=Factions.i.getByTag(id);
  if (faction != null)   return new FactionAccountHolder(faction);
  return null;
}
Program: 50081
Project: 50081
Buggy source:
/** 
 * Check whether a block is a sign or wall sign type.
 * @param block
 * @return true if the block is a sign or wall sign
 */
public static boolean isSignBlock(Block block){
  Material type=block.getType();
  return Material.SIGN == type || Material.WALL_SIGN == type;
}

Fixed version (ground truth):
/** 
 * Check whether a block is a sign or wall sign type.
 * @param block
 * @return true if the block is a sign or wall sign
 */
public static boolean isSignBlock(Block block){
  return block.getState() instanceof Sign;
}
Program: 50082
Project: 50082
Buggy source:
/** 
 * Catches and handles breaking of the sign block of an account chest.
 * @param event
 */
@EventHandler public void vaultBroken(BlockBreakEvent event){
  Block block=event.getBlock();
  if (!Util.isSignBlock(block))   return;
  Sign sign=(Sign)block.getState();
  if (!("String_Node_Str".equalsIgnoreCase(sign.getLine(0)) || "String_Node_Str".equalsIgnoreCase(sign.getLine(0))))   return;
  Location loc=block.getLocation();
  for (  AccountChest chest : dao.getChests()) {
    if (loc.equals(chest.sign.getBlock().getLocation())) {
      chest.destroy();
      Account account=chest.getAccount();
      account.owner.sendMessage("String_Node_Str" + account.balance());
    }
  }
}

Fixed version (ground truth):
/** 
 * Catches and handles breaking of the sign block of an account chest.
 * @param event
 */
@EventHandler public void vaultBroken(BlockBreakEvent event){
  Block block=event.getBlock();
  if (!Util.isSignBlock(block))   return;
  Sign sign=(Sign)block.getState();
  if (!("String_Node_Str".equalsIgnoreCase(sign.getLine(0)) || "String_Node_Str".equalsIgnoreCase(sign.getLine(0))))   return;
  Location loc=block.getLocation();
  for (  AccountChest chest : dao.getChests()) {
    if (loc.equals(chest.sign.getBlock().getLocation())) {
      dao.destroyAccountChest(chest);
      Account account=chest.getAccount();
      account.owner.sendMessage("String_Node_Str" + account.balance());
    }
  }
}
Program: 50083
Project: 50083
Buggy source:
/** 
 * Attempts to add given amount to this chest.  If the amount is larger than available space, the space is filled and the actually added amount returned.
 * @return amount actually added
 */
public long add(long value){
  int stacksize=config.currency.getMaxStackSize();
  Inventory inv=chest.getInventory();
  long remaining=value;
  while (remaining > 0) {
    ItemStack stack=new ItemStack(config.currency);
    stack.setAmount(remaining > stacksize ? stacksize : (int)remaining);
    int returned=0;
    for (    ItemStack leftover : inv.addItem(stack).values())     returned+=leftover.getAmount();
    remaining-=stacksize - returned;
    if (returned > 0)     break;
  }
  return value - remaining;
}

Fixed version (ground truth):
/** 
 * Attempts to add given amount to this chest.  If the amount is larger than available space, the space is filled and the actually added amount returned.
 * @return amount actually added
 */
public long add(long value){
  int stacksize=config.currency.getMaxStackSize();
  Inventory inv=chest.getInventory();
  long remaining=value;
  while (remaining > 0) {
    ItemStack stack=new ItemStack(config.currency);
    int remainderStackSize=remaining > stacksize ? stacksize : (int)remaining;
    stack.setAmount(remainderStackSize);
    int returned=0;
    for (    ItemStack leftover : inv.addItem(stack).values())     returned+=leftover.getAmount();
    remaining-=remainderStackSize - returned;
    if (returned > 0)     break;
  }
  return value - remaining;
}
Program: 50084
Project: 50084
Buggy source:
/** 
 * Attempts to remove given amount from this chest. If the amount is larger than available items, everything is removed and the number of removed items returned.
 * @param value
 * @return amount actually removed from this chest
 */
public long remove(long value){
  int stacksize=config.currency.getMaxStackSize();
  Inventory inv=chest.getInventory();
  long remaining=value;
  while (remaining > 0) {
    ItemStack stack=new ItemStack(config.currency);
    stack.setAmount(remaining > stacksize ? stacksize : (int)remaining);
    int returned=0;
    for (    ItemStack leftover : inv.removeItem(stack).values())     returned+=leftover.getAmount();
    remaining-=stacksize - returned;
    if (returned > 0)     break;
  }
  return value - remaining;
}

Fixed version (ground truth):
/** 
 * Attempts to remove given amount from this chest. If the amount is larger than available items, everything is removed and the number of removed items returned.
 * @param value
 * @return amount actually removed from this chest
 */
public long remove(long value){
  int stacksize=config.currency.getMaxStackSize();
  Inventory inv=chest.getInventory();
  long remaining=value;
  while (remaining > 0) {
    ItemStack stack=new ItemStack(config.currency);
    int remainderStackSize=remaining > stacksize ? stacksize : (int)remaining;
    stack.setAmount(remainderStackSize);
    int returned=0;
    for (    ItemStack leftover : inv.removeItem(stack).values())     returned+=leftover.getAmount();
    remaining-=remainderStackSize - returned;
    if (returned > 0)     break;
  }
  return value - remaining;
}
Program: 50086
Project: 50086
Buggy source:
/** 
 * Gets the default expressions for function arguments (null where default is not provided).
 */
private List<MExpression> getDefaultValues(IASTFunctionDeclarator func) throws DOMException {
  IASTStandardFunctionDeclarator declarator=(IASTStandardFunctionDeclarator)func;
  IASTParameterDeclaration[] params=declarator.getParameters();
  List<MExpression> exprs=new ArrayList<MExpression>();
  for (  IASTParameterDeclaration param : params) {
    IASTDeclarator paramDeclarator=param.getDeclarator();
    IBinding binding=paramDeclarator.getName().resolveBinding();
    IType tp=ctx.converter.evalBindingReturnType(binding);
    if (paramDeclarator.getInitializer() != null) {
      exprs.add(ctx.initMngr.eval1Init(paramDeclarator.getInitializer(),tp,paramDeclarator.getName()));
    }
 else {
      exprs.add(null);
    }
  }
  return exprs;
}

Fixed version (ground truth):
/** 
 * Gets the default expressions for function arguments (null where default is not provided).
 */
private List<MExpression> getDefaultValues(IASTFunctionDeclarator func) throws DOMException {
  IASTStandardFunctionDeclarator declarator=(IASTStandardFunctionDeclarator)func;
  IASTParameterDeclaration[] params=declarator.getParameters();
  List<MExpression> exprs=new ArrayList<MExpression>();
  for (  IASTParameterDeclaration param : params) {
    IASTDeclarator paramDeclarator=param.getDeclarator();
    IBinding binding=paramDeclarator.getName().resolveBinding();
    IType tp=ctx.converter.evalBindingReturnType(binding);
    if (paramDeclarator.getInitializer() != null) {
      exprs.add(ctx.initMngr.eval1Init(paramDeclarator.getInitializer(),tp,paramDeclarator.getName(),InitType.WRAPPED));
    }
 else {
      exprs.add(null);
    }
  }
  return exprs;
}
Program: 50089
Project: 50089
Buggy source:
/** 
 * Given a declaration like: int a = 5; Returns an infix expression: a.set(5); Optionally the return expression is made into a boolean expression. Used to split up the declaration into two parts for if, while, switch and for condition declarations. Example: while (int a = 10) {} becomes: MInteger a = new MInteger(); while ((a.set(10)) != 0) {}
 */
MExpression makeInfixFromDecl(String varName,MExpression initExpr,IType tp,boolean makeBoolean) throws DOMException {
  MInfixExpression infix=null;
  if (TypeManager.isBasicType(tp)) {
    infix=new MInfixAssignmentWithNumberOnLeft();
    infix.left=ModelCreation.createNumberId(varName);
  }
 else {
    infix=new MInfixExpressionPlain();
    infix.left=ModelCreation.createLiteral(varName);
  }
  infix.right=initExpr;
  if (makeBoolean)   infix.right=ExpressionHelpers.makeExpressionBoolean(infix.right,tp);
 else   infix.right=ExpressionHelpers.bracket(infix.right);
  infix.operator="String_Node_Str";
  return infix;
}

Fixed version (ground truth):
/** 
 * Given a declaration like: int a = 5; Returns an infix expression: a.set(5); Optionally the return expression is made into a boolean expression. Used to split up the declaration into two parts for if, while, switch and for condition declarations. Example: while (int a = 10) {} becomes: MInteger a = new MInteger(); while ((a.set(10)) != 0) {}
 */
MExpression makeInfixFromDecl(String varName,MExpression initExpr,IType tp,boolean makeBoolean) throws DOMException {
  MInfixExpression infix=null;
  if (TypeManager.isBasicType(tp)) {
    infix=new MInfixAssignmentWithNumberOnLeft();
    infix.left=ModelCreation.createNumberId(varName);
  }
 else {
    infix=new MInfixExpressionPlain();
    infix.left=ModelCreation.createLiteral(varName);
  }
  infix.right=initExpr;
  if (TypeManager.isOneOf(tp,TypeEnum.BOOLEAN))   infix.right=ExpressionHelpers.makeExpressionBoolean(infix.right,tp);
 else   infix.right=ExpressionHelpers.bracket(infix.right);
  infix.operator="String_Node_Str";
  return (makeBoolean && !TypeManager.isOneOf(tp,TypeEnum.BOOLEAN)) ? ExpressionHelpers.makeExpressionBoolean(infix,tp) : ExpressionHelpers.bracket(infix);
}
Program: 50091
Project: 50091
Buggy source:
/** 
 * Given a declaration creates one Java declaration.
 */
MSimpleDecl eval1Decl(IASTDeclaration decla) throws DOMException {
  MyLogger.log("String_Node_Str");
  IASTSimpleDeclaration simpleDeclaration=(IASTSimpleDeclaration)decla;
  assert(simpleDeclaration.getDeclarators().length == 1);
  List<MExpression> inits=evaluateDeclarationReturnInitializers(simpleDeclaration);
  List<String> names=evaluateDeclarationReturnNames(simpleDeclaration);
  List<String> types=evaluateDeclarationReturnTypes(simpleDeclaration);
  MSimpleDecl dec=new MSimpleDecl();
  dec.name=names.get(0);
  dec.initExpr=inits.get(0);
  dec.type=types.get(0);
  return dec;
}

Fixed version (ground truth):
/** 
 * Given a declaration creates one Java declaration.
 */
MSimpleDecl eval1Decl(IASTDeclaration decla,InitType initType) throws DOMException {
  MyLogger.log("String_Node_Str");
  IASTSimpleDeclaration simpleDeclaration=(IASTSimpleDeclaration)decla;
  assert(simpleDeclaration.getDeclarators().length == 1);
  List<MExpression> inits=evaluateDeclarationReturnInitializers(simpleDeclaration,initType);
  List<String> names=evaluateDeclarationReturnNames(simpleDeclaration);
  List<String> types=evaluateDeclarationReturnTypes(simpleDeclaration);
  MSimpleDecl dec=new MSimpleDecl();
  dec.name=names.get(0);
  dec.initExpr=inits.get(0);
  dec.type=types.get(0);
  return dec;
}
Program: 50092
Project: 50092
Buggy source:
/** 
 * Returns one initializer for each declarator. This can be the provided C++ initializer or it can be a generated initializer for objects. Example: int i, j = 5, * p; returns: [MInteger.valueOf(0), MInteger.valueOf(5), MInteger.valueOf(0)]
 */
List<MExpression> evaluateDeclarationReturnInitializers(IASTSimpleDeclaration simple) throws DOMException {
  List<MExpression> exprs=new ArrayList<MExpression>();
  List<IType> types=evaluateDeclarationReturnCppTypes(simple);
  int i=0;
  for (  IASTDeclarator decl : simple.getDeclarators()) {
    exprs.add(ctx.initMngr.eval1Init(decl.getInitializer(),types.get(i),decl.getName()));
    i++;
  }
  return exprs;
}

Fixed version (ground truth):
/** 
 * Returns one initializer for each declarator. This can be the provided C++ initializer or it can be a generated initializer for objects. Example: int i, j = 5, * p; returns: [MInteger.valueOf(0), MInteger.valueOf(5), MInteger.valueOf(0)]
 */
List<MExpression> evaluateDeclarationReturnInitializers(IASTSimpleDeclaration simple,InitType initType) throws DOMException {
  List<MExpression> exprs=new ArrayList<MExpression>();
  List<IType> types=evaluateDeclarationReturnCppTypes(simple);
  int i=0;
  for (  IASTDeclarator decl : simple.getDeclarators()) {
    exprs.add(ctx.initMngr.eval1Init(decl.getInitializer(),types.get(i),decl.getName(),initType));
    i++;
  }
  return exprs;
}