nus-yam/ex-repair huggingface dataset:
Program: 86399
Project: 86399
Buggy source:
/** 
 * Initializes a new <tt>ImageStream</tt> instance which is to have a specific <tt>FormatControl</tt>
 * @param dataSource the <tt>DataSource</tt> which is creating the newinstance so that it becomes one of its <tt>streams</tt>
 * @param formatControl the <tt>FormatControl</tt> of the new instance whichis to specify the format in which it is to provide its media data
 */
RtpdumpStream(DataSource dataSource,FormatControl formatControl){
  super(dataSource,formatControl);
  this.ivfFileReader=new RtpdumpFileReader(dataSource.getLocator().getRemainder());
}

Fixed version (ground truth):
/** 
 * Initializes a new <tt>ImageStream</tt> instance which is to have a specific <tt>FormatControl</tt>
 * @param dataSource the <tt>DataSource</tt> which is creating the newinstance so that it becomes one of its <tt>streams</tt>
 * @param formatControl the <tt>FormatControl</tt> of the new instance whichis to specify the format in which it is to provide its media data
 */
RtpdumpStream(DataSource dataSource,FormatControl formatControl){
  super(dataSource,formatControl);
  String rtpdumpFilePath=dataSource.getLocator().getRemainder();
  this.ivfFileReader=new RtpdumpFileReader(rtpdumpFilePath);
}
Program: 86400
Project: 86400
Buggy source:
/** 
 * Reads available media data from this instance into a specific <tt>Buffer</tt>.
 * @param buffer the <tt>Buffer</tt> to write the available media datainto
 * @throws IOException if an I/O error has prevented the reading ofavailable media data from this instance into the specified <tt>buffer</tt>
 */
@Override protected void doRead(Buffer buffer) throws IOException {
  long millis=0;
  VideoFormat format;
  format=(VideoFormat)buffer.getFormat();
  if (format == null) {
    format=(VideoFormat)getFormat();
    if (format != null)     buffer.setFormat(format);
  }
  RTPPacket rtpPacket=ivfFileReader.getNextPacket(true);
  byte[] data=rtpPacket.getPayload();
  buffer.setData(data);
  buffer.setOffset(0);
  buffer.setLength(data.length);
  buffer.setTimeStamp(System.nanoTime());
  buffer.setFlags(Buffer.FLAG_SYSTEM_TIME | Buffer.FLAG_LIVE_DATA);
  millis=System.currentTimeMillis() - this.timeLastRead;
  millis=(long)(1000.0 / 1) - millis;
  if (millis > 0) {
    try {
      Thread.sleep(millis);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
  this.timeLastRead=System.currentTimeMillis();
}

Fixed version (ground truth):
/** 
 * Reads available media data from this instance into a specific <tt>Buffer</tt>.
 * @param buffer the <tt>Buffer</tt> to write the available media datainto
 * @throws IOException if an I/O error has prevented the reading ofavailable media data from this instance into the specified <tt>buffer</tt>
 */
@Override protected void doRead(Buffer buffer) throws IOException {
  long millis=0;
  long timestamp=0;
  VideoFormat format;
  format=(VideoFormat)buffer.getFormat();
  if (format == null) {
    format=(VideoFormat)getFormat();
    if (format != null)     buffer.setFormat(format);
  }
  RTPPacket rtpPacket=ivfFileReader.getNextPacket(true);
  byte[] data=rtpPacket.getPayload();
  buffer.setData(data);
  buffer.setOffset(0);
  buffer.setLength(data.length);
  buffer.setFlags(Buffer.FLAG_SYSTEM_TIME | Buffer.FLAG_LIVE_DATA);
  if (lastReadWasMarked == true) {
    rtpTimestamp=System.nanoTime();
  }
  if ((lastReadWasMarked=rtpPacket.hasMarker()) == true) {
    buffer.setFlags(buffer.getFlags() | Buffer.FLAG_RTP_MARKER);
  }
  buffer.setTimeStamp(rtpTimestamp);
  millis=rtpPacket.getRtpdumpTimestamp() - this.timeLastRead;
  if (millis > 0) {
    try {
      Thread.sleep(millis);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
  this.timeLastRead=rtpPacket.getRtpdumpTimestamp();
}
Program: 86401
Project: 86401
Buggy source:
public SPARQLQuery(SailRepository rep){
  super(rep);
  queryResultVariants=Variant.mediaTypes(MediaType.valueOf(RDFMediaType.SPARQL_RESULTS_JSON),MediaType.valueOf(RDFMediaType.SPARQL_RESULTS_XML),MediaType.valueOf(RDFMediaType.SPARQL_RESULTS_CSV),MediaType.valueOf(RDFMediaType.SPARQL_RESULTS_TSV)).add().build();
  this.registry=RDFWriterRegistry.getInstance();
  this.qwfactory=QueryRewriterFactory.getInstance(rep);
  String sout=SPARQLExtensionProps.getProperty("String_Node_Str");
  this.timeout=Integer.parseInt(sout);
}

Fixed version (ground truth):
public SPARQLQuery(SailRepository rep){
  super(rep);
  queryResultVariants=Variant.mediaTypes(MediaType.valueOf(RDFMediaType.SPARQL_RESULTS_JSON),MediaType.valueOf(RDFMediaType.SPARQL_RESULTS_XML),MediaType.valueOf(RDFMediaType.SPARQL_RESULTS_CSV),MediaType.valueOf(RDFMediaType.SPARQL_RESULTS_TSV)).add().build();
  booleanResultVariants=Variant.mediaTypes(MediaType.valueOf(RDFMediaType.SPARQL_RESULTS_JSON),MediaType.valueOf(RDFMediaType.SPARQL_RESULTS_XML),MediaType.valueOf(MediaType.TEXT_PLAIN)).add().build();
  this.registry=RDFWriterRegistry.getInstance();
  this.qwfactory=QueryRewriterFactory.getInstance(rep);
  String sout=SPARQLExtensionProps.getProperty("String_Node_Str");
  this.timeout=Integer.parseInt(sout);
}
Program: 86403
Project: 86403
Buggy source:
public Query rewrite(QueryLanguage ql,String query,String baseuri) throws MalformedQueryException, RepositoryException, RuntimeException {
  QueryParserFactory f=QueryParserRegistry.getInstance().get(ql);
  QueryParser parser=f.getParser();
  ParsedQuery parsed=parser.parseQuery(query,baseuri);
  TupleExpr expr=parsed.getTupleExpr();
  RuleTransformationVisitor visitor=new RuleTransformationVisitor(vf,rules);
  expr.visit(visitor);
  return new SailTupleExprQuery(new ParsedTupleQuery(expr),conn);
}

Fixed version (ground truth):
public Query rewrite(QueryLanguage ql,String query,String baseuri) throws MalformedQueryException, RepositoryException, RuntimeException {
  QueryParserFactory f=QueryParserRegistry.getInstance().get(ql);
  QueryParser parser=f.getParser();
  ParsedQuery parsed=parser.parseQuery(query,baseuri);
  TupleExpr expr=parsed.getTupleExpr();
  RuleTransformationVisitor visitor=new RuleTransformationVisitor(vf,rules);
  expr.visit(visitor);
  return getExprQuery(parsed,expr);
}
Program: 86404
Project: 86404
Buggy source:
@Nullable private Url previewUrl(OpenInBrowserRequest request,VirtualFile virtualFile,GaugeSettingsModel settings) throws IOException, InterruptedException {
  ProcessBuilder builder=new ProcessBuilder(settings.getGaugePath(),Constants.DOCS,Spectacle.NAME,virtualFile.getPath());
  String projectName=request.getProject().getName();
  builder.environment().put("String_Node_Str",createOrGetTempDirectory(projectName).getPath() + "String_Node_Str");
  builder.directory(GaugeUtil.moduleDir(GaugeUtil.moduleForPsiElement(request.getFile())));
  GaugeUtil.setGaugeEnvironmentsTo(builder,settings);
  Process docsProcess=builder.start();
  int exitCode=docsProcess.waitFor();
  if (exitCode != 0) {
    String docsOutput=String.format("String_Node_Str",GaugeUtil.getOutput(docsProcess.getInputStream(),"String_Node_Str").replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str"));
    Notifications.Bus.notify(new Notification("String_Node_Str","String_Node_Str",docsOutput,NotificationType.ERROR));
    return null;
  }
  return new UrlImpl(FileUtil.join(createOrGetTempDirectory(projectName).getPath(),"String_Node_Str" + virtualFile.getNameWithoutExtension() + "String_Node_Str"));
}

Fixed version (ground truth):
@Nullable private Url previewUrl(OpenInBrowserRequest request,VirtualFile virtualFile,GaugeSettingsModel settings) throws IOException, InterruptedException {
  ProcessBuilder builder=new ProcessBuilder(settings.getGaugePath(),Constants.DOCS,Spectacle.NAME,virtualFile.getPath());
  String projectName=request.getProject().getName();
  builder.environment().put("String_Node_Str",FileUtil.join(createOrGetTempDirectory(projectName).getPath(),"String_Node_Str"));
  File gaugeModuleDir=GaugeUtil.moduleDir(GaugeUtil.moduleForPsiElement(request.getFile()));
  builder.directory(gaugeModuleDir);
  GaugeUtil.setGaugeEnvironmentsTo(builder,settings);
  Process docsProcess=builder.start();
  int exitCode=docsProcess.waitFor();
  if (exitCode != 0) {
    String docsOutput=String.format("String_Node_Str",GaugeUtil.getOutput(docsProcess.getInputStream(),"String_Node_Str").replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str"));
    Notifications.Bus.notify(new Notification("String_Node_Str","String_Node_Str",docsOutput,NotificationType.ERROR));
    return null;
  }
  String relativePath=FileUtil.getRelativePath(gaugeModuleDir,new File(virtualFile.getParent().getPath()));
  return new UrlImpl(FileUtil.join(createOrGetTempDirectory(projectName).getPath(),"String_Node_Str","String_Node_Str",relativePath,virtualFile.getNameWithoutExtension() + "String_Node_Str"));
}
Program: 86405
Project: 86405
Buggy source:
private void processElements(final ReferencesSearch.SearchParameters searchParameters,final Processor<PsiReference> processor){
  ApplicationManager.getApplication().runReadAction(() -> {
    StepCollector collector=helper.getStepCollector(searchParameters.getElementToSearch());
    collector.collect();
    final List<PsiElement> elements=helper.getPsiElements(collector,searchParameters.getElementToSearch());
    for (    PsiElement element : elements)     processor.process(element.getReference());
  }
);
}

Fixed version (ground truth):
private void processElements(final ReferencesSearch.SearchParameters searchParameters,final Processor<? super PsiReference> processor){
  ApplicationManager.getApplication().runReadAction(() -> {
    StepCollector collector=helper.getStepCollector(searchParameters.getElementToSearch());
    collector.collect();
    final List<PsiElement> elements=helper.getPsiElements(collector,searchParameters.getElementToSearch());
    for (    PsiElement element : elements)     processor.process(element.getReference());
  }
);
}
Program: 86406
Project: 86406
Buggy source:
@Override public void processQuery(@NotNull final ReferencesSearch.SearchParameters searchParameters,@NotNull final Processor<PsiReference> processor){
  ApplicationManager.getApplication().runReadAction(() -> {
    if (!helper.shouldFindReferences(searchParameters,searchParameters.getElementToSearch()))     return;
    if (EventQueue.isDispatchThread())     ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> processElements(searchParameters,processor),"String_Node_Str",true,searchParameters.getElementToSearch().getProject());
 else     processElements(searchParameters,processor);
  }
);
}

Fixed version (ground truth):
@Override public void processQuery(@NotNull ReferencesSearch.SearchParameters searchParameters,@NotNull Processor<? super PsiReference> processor){
  ApplicationManager.getApplication().runReadAction(() -> {
    if (!helper.shouldFindReferences(searchParameters,searchParameters.getElementToSearch()))     return;
    if (EventQueue.isDispatchThread())     ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> processElements(searchParameters,processor),"String_Node_Str",true,searchParameters.getElementToSearch().getProject());
 else     processElements(searchParameters,processor);
  }
);
}
Program: 86407
Project: 86407
Buggy source:
public boolean isImplicitUsage(PsiElement element){
  if (element instanceof PsiClassImpl) {
    for (    PsiMethod psiMethod : ((PsiClassImpl)element).getMethods())     if (StepUtil.getGaugeStepAnnotationValues(psiMethod).size() > 0)     return true;
    return false;
  }
  boolean isGaugeElement=GaugeUtil.isGaugeElement(element);
  if (!isGaugeElement)   return false;
  StepCollector collector=new StepCollector(element.getProject());
  collector.collect();
  return ReferenceSearch.getPsiElements(collector,element).size() > 0;
}

Fixed version (ground truth):
public boolean isImplicitUsage(PsiElement element){
  Module module=GaugeUtil.moduleForPsiElement(element);
  if (module == null || !GaugeUtil.isGaugeModule(module))   return false;
  if (element instanceof PsiClassImpl) {
    for (    PsiMethod psiMethod : ((PsiClassImpl)element).getMethods())     if (StepUtil.getGaugeStepAnnotationValues(psiMethod).size() > 0)     return true;
    return false;
  }
  boolean isGaugeElement=GaugeUtil.isGaugeElement(element);
  if (!isGaugeElement)   return false;
  StepCollector collector=new StepCollector(element.getProject());
  collector.collect();
  return ReferenceSearch.getPsiElements(collector,element).size() > 0;
}
Program: 86408
Project: 86408
Buggy source:
private void processElements(final ReferencesSearch.SearchParameters searchParameters,final Processor<PsiReference> processor){
  ApplicationManager.getApplication().runReadAction(new Runnable(){
    @Override public void run(){
      if (!shouldFindUsages(searchParameters,searchParameters.getElementToSearch()))       return;
      StepCollector collector=new StepCollector(searchParameters.getElementToSearch().getProject());
      collector.collect();
      final List<PsiElement> elements=getPsiElements(collector,searchParameters.getElementToSearch());
      for (      PsiElement element : elements)       processor.process(element.getReference());
    }
  }
);
}

Fixed version (ground truth):
private void processElements(final ReferencesSearch.SearchParameters searchParameters,final Processor<PsiReference> processor){
  ApplicationManager.getApplication().runReadAction(new Runnable(){
    @Override public void run(){
      StepCollector collector=new StepCollector(searchParameters.getElementToSearch().getProject());
      collector.collect();
      final List<PsiElement> elements=getPsiElements(collector,searchParameters.getElementToSearch());
      for (      PsiElement element : elements)       processor.process(element.getReference());
    }
  }
);
}
Program: 86409
Project: 86409
Buggy source:
@Override public void processQuery(@NotNull final ReferencesSearch.SearchParameters searchParameters,@NotNull final Processor<PsiReference> processor){
  if (EventQueue.isDispatchThread())   ProgressManager.getInstance().runProcessWithProgressSynchronously(new Runnable(){
    @Override public void run(){
      processElements(searchParameters,processor);
    }
  }
,"String_Node_Str",true,searchParameters.getElementToSearch().getProject());
 else   processElements(searchParameters,processor);
}

Fixed version (ground truth):
@Override public void processQuery(@NotNull final ReferencesSearch.SearchParameters searchParameters,@NotNull final Processor<PsiReference> processor){
  ApplicationManager.getApplication().runReadAction(new Runnable(){
    @Override public void run(){
      if (!shouldFindUsages(searchParameters,searchParameters.getElementToSearch()))       return;
      if (EventQueue.isDispatchThread())       ProgressManager.getInstance().runProcessWithProgressSynchronously(new Runnable(){
        @Override public void run(){
          processElements(searchParameters,processor);
        }
      }
,"String_Node_Str",true,searchParameters.getElementToSearch().getProject());
 else       processElements(searchParameters,processor);
    }
  }
);
}
Program: 86410
Project: 86410
Buggy source:
@Override public void run(){
  if (!shouldFindUsages(searchParameters,searchParameters.getElementToSearch()))   return;
  StepCollector collector=new StepCollector(searchParameters.getElementToSearch().getProject());
  collector.collect();
  final List<PsiElement> elements=getPsiElements(collector,searchParameters.getElementToSearch());
  for (  PsiElement element : elements)   processor.process(element.getReference());
}

Fixed version (ground truth):
@Override public void run(){
  StepCollector collector=new StepCollector(searchParameters.getElementToSearch().getProject());
  collector.collect();
  final List<PsiElement> elements=getPsiElements(collector,searchParameters.getElementToSearch());
  for (  PsiElement element : elements)   processor.process(element.getReference());
}
Program: 86411
Project: 86411
Buggy source:
private boolean shouldFindUsages(@NotNull ReferencesSearch.SearchParameters searchParameters,PsiElement element){
  return !searchParameters.getScope().getDisplayName().equals("String_Node_Str") && GaugeUtil.isGaugeElement(element);
}

Fixed version (ground truth):
private boolean shouldFindUsages(@NotNull ReferencesSearch.SearchParameters searchParameters,PsiElement element){
  Module module=GaugeUtil.moduleForPsiElement(element);
  return module != null && GaugeUtil.isGaugeModule(module) && !searchParameters.getScope().getDisplayName().equals("String_Node_Str") && GaugeUtil.isGaugeElement(element);
}
Program: 86412
Project: 86412
Buggy source:
@Override public PopupStep onChosen(final PsiFile selectedValue,boolean finalChoice){
  return doFinalStep(new Runnable(){
    public void run(){
      if (selectedValue == NEW_FILE_HOLDER) {
        createFileAndAddImpl(editor);
      }
 else {
        addImpl(project,selectedValue.getVirtualFile());
      }
    }
  }
);
}

Fixed version (ground truth):
@Override public PopupStep onChosen(final PsiFile selectedValue,boolean finalChoice){
  return doFinalStep(() -> {
    if (selectedValue == NEW_FILE_HOLDER) {
      createFileAndAddImpl(editor);
    }
 else {
      addImpl(project,selectedValue.getVirtualFile());
    }
  }
);
}
Program: 86414
Project: 86414
Buggy source:
public static List<PsiFile> getAllConceptFiles(Project project){
  Collection<VirtualFile> virtualFiles=FileBasedIndex.getInstance().getContainingFiles(FileTypeIndex.NAME,ConceptFileType.INSTANCE,GlobalSearchScope.projectScope(project));
  List<PsiFile> files=new ArrayList<PsiFile>();
  for (  VirtualFile ConceptVFile : virtualFiles) {
    PsiFile file=PsiManager.getInstance(project).findFile(ConceptVFile);
    if (file != null) {
      files.add(file);
    }
  }
  Collections.sort(files,new Comparator<PsiFile>(){
    @Override public int compare(    PsiFile o1,    PsiFile o2){
      return o1.getName().compareToIgnoreCase(o2.getName());
    }
  }
);
  return files;
}

Fixed version (ground truth):
public static List<PsiFile> getAllConceptFiles(Project project){
  Collection<VirtualFile> virtualFiles=FileBasedIndex.getInstance().getContainingFiles(FileTypeIndex.NAME,ConceptFileType.INSTANCE,GlobalSearchScope.projectScope(project));
  List<PsiFile> files=new ArrayList<>();
  for (  VirtualFile ConceptVFile : virtualFiles) {
    PsiFile file=PsiManager.getInstance(project).findFile(ConceptVFile);
    if (file != null) {
      files.add(file);
    }
  }
  Collections.sort(files,(o1,o2) -> o1.getName().compareToIgnoreCase(o2.getName()));
  return files;
}
Program: 86415
Project: 86415
Buggy source:
public static List<VirtualFile> getConceptFiles(Project project){
  Collection<VirtualFile> virtualFiles=FileBasedIndex.getInstance().getContainingFiles(FileTypeIndex.NAME,ConceptFileType.INSTANCE,GlobalSearchScope.projectScope(project));
  return new ArrayList<VirtualFile>(virtualFiles);
}

Fixed version (ground truth):
public static List<VirtualFile> getConceptFiles(Project project){
  Collection<VirtualFile> virtualFiles=FileBasedIndex.getInstance().getContainingFiles(FileTypeIndex.NAME,ConceptFileType.INSTANCE,GlobalSearchScope.projectScope(project));
  return new ArrayList<>(virtualFiles);
}
Program: 86416
Project: 86416
Buggy source:
public static List<String> getDirNamesUnderSpecs(Project project){
  File dir=new File(project.getBasePath() + File.separator + Constants.SPECS_DIR);
  File[] files=dir.listFiles();
  List<String> dirs=new ArrayList<String>();
  dirs.add(String.format("String_Node_Str",File.separator,Constants.SPECS_DIR,File.separator));
  if (files != null)   getDirectories(files,dirs,project.getBasePath());
  return dirs;
}

Fixed version (ground truth):
public static List<String> getDirNamesUnderSpecs(Project project){
  File dir=new File(project.getBasePath() + File.separator + Constants.SPECS_DIR);
  File[] files=dir.listFiles();
  List<String> dirs=new ArrayList<>();
  dirs.add(String.format("String_Node_Str",File.separator,Constants.SPECS_DIR,File.separator));
  if (files != null)   getDirectories(files,dirs,project.getBasePath());
  return dirs;
}
Program: 86417
Project: 86417
Buggy source:
public static List<VirtualFile> getAllSpecFiles(Project project){
  Collection<VirtualFile> virtualFiles=FileBasedIndex.getInstance().getContainingFiles(FileTypeIndex.NAME,SpecFileType.INSTANCE,GlobalSearchScope.projectScope(project));
  return new ArrayList<VirtualFile>(virtualFiles);
}

Fixed version (ground truth):
public static List<VirtualFile> getAllSpecFiles(Project project){
  Collection<VirtualFile> virtualFiles=FileBasedIndex.getInstance().getContainingFiles(FileTypeIndex.NAME,SpecFileType.INSTANCE,GlobalSearchScope.projectScope(project));
  return new ArrayList<>(virtualFiles);
}
Program: 86418
Project: 86418
Buggy source:
public static List<PsiFile> getAllJavaFiles(Module module){
  Collection<VirtualFile> javaVirtualFiles=FileBasedIndex.getInstance().getContainingFiles(FileTypeIndex.NAME,JavaFileType.INSTANCE,moduleScope(module));
  List<PsiFile> javaFiles=new ArrayList<PsiFile>();
  for (  VirtualFile javaVFile : javaVirtualFiles) {
    PsiFile file=PsiManager.getInstance(module.getProject()).findFile(javaVFile);
    if (file != null) {
      javaFiles.add(file);
    }
  }
  Collections.sort(javaFiles,new Comparator<PsiFile>(){
    @Override public int compare(    PsiFile o1,    PsiFile o2){
      return FileManager.getJavaFileName(o1).compareToIgnoreCase(FileManager.getJavaFileName(o2));
    }
  }
);
  return javaFiles;
}

Fixed version (ground truth):
public static List<PsiFile> getAllJavaFiles(Module module){
  Collection<VirtualFile> javaVirtualFiles=FileBasedIndex.getInstance().getContainingFiles(FileTypeIndex.NAME,JavaFileType.INSTANCE,moduleScope(module));
  List<PsiFile> javaFiles=new ArrayList<>();
  for (  VirtualFile javaVFile : javaVirtualFiles) {
    PsiFile file=PsiManager.getInstance(module.getProject()).findFile(javaVFile);
    if (file != null) {
      javaFiles.add(file);
    }
  }
  Collections.sort(javaFiles,(o1,o2) -> FileManager.getJavaFileName(o1).compareToIgnoreCase(FileManager.getJavaFileName(o2)));
  return javaFiles;
}
Program: 86419
Project: 86419
Buggy source:
@Override public PsiDirectory[] getDirectories(){
  List<PsiDirectory> psiDirectories=new ArrayList<PsiDirectory>();
  PsiManager psiManager=PsiManager.getInstance(project);
  for (  VirtualFile root : ProjectRootManager.getInstance(psiManager.getProject()).getContentSourceRoots()) {
    PsiDirectory directory=psiManager.findDirectory(root);
    if (directory != null) {
      psiDirectories.add(directory);
    }
  }
  return psiDirectories.toArray(new PsiDirectory[]{});
}

Fixed version (ground truth):
@Override public PsiDirectory[] getDirectories(){
  List<PsiDirectory> psiDirectories=new ArrayList<>();
  PsiManager psiManager=PsiManager.getInstance(project);
  for (  VirtualFile root : ProjectRootManager.getInstance(psiManager.getProject()).getContentSourceRoots()) {
    PsiDirectory directory=psiManager.findDirectory(root);
    if (directory != null) {
      psiDirectories.add(directory);
    }
  }
  return psiDirectories.toArray(new PsiDirectory[]{});
}
Program: 86420
Project: 86420
Buggy source:
private Set<String> getArgsFromSteps(List<SpecStep> steps){
  Set<String> staticArgs=new HashSet<String>();
  for (  SpecStep step : steps) {
    List<SpecStaticArg> args=step.getStaticArgList();
    for (    SpecStaticArg arg : args) {
      if (arg.getText() != null)       staticArgs.add(arg.getText());
    }
  }
  return staticArgs;
}

Fixed version (ground truth):
private Set<String> getArgsFromSteps(List<SpecStep> steps){
  Set<String> staticArgs=new HashSet<>();
  for (  SpecStep step : steps) {
    List<SpecStaticArg> args=step.getStaticArgList();
    args.stream().filter(arg -> arg.getText() != null).forEach((arg) -> staticArgs.add(arg.getText()));
  }
  return staticArgs;
}
Program: 86421
Project: 86421
Buggy source:
@Override protected void addCompletions(@NotNull CompletionParameters parameters,ProcessingContext context,@NotNull CompletionResultSet resultSet){
  String prefix=getPrefix(parameters);
  resultSet=resultSet.withPrefixMatcher(new PlainPrefixMatcher(prefix));
  PsiFile specFile=parameters.getOriginalFile();
  SpecDetail specDetail=PsiTreeUtil.getChildOfType(specFile,SpecDetail.class);
  List<SpecStep> stepsInFile=new ArrayList<SpecStep>();
  addContextSteps(specDetail,stepsInFile);
  addStepsInScenarios(specFile,stepsInFile);
  Set<String> staticArgs=getArgsFromSteps(stepsInFile);
  for (  String arg : staticArgs) {
    if (arg != null) {
      LookupElementBuilder item=LookupElementBuilder.create(arg);
      resultSet.addElement(item);
    }
  }
}

Fixed version (ground truth):
@Override protected void addCompletions(@NotNull CompletionParameters parameters,ProcessingContext context,@NotNull CompletionResultSet resultSet){
  String prefix=getPrefix(parameters);
  resultSet=resultSet.withPrefixMatcher(new PlainPrefixMatcher(prefix));
  PsiFile specFile=parameters.getOriginalFile();
  SpecDetail specDetail=PsiTreeUtil.getChildOfType(specFile,SpecDetail.class);
  List<SpecStep> stepsInFile=new ArrayList<>();
  addContextSteps(specDetail,stepsInFile);
  addStepsInScenarios(specFile,stepsInFile);
  Set<String> staticArgs=getArgsFromSteps(stepsInFile);
  for (  String arg : staticArgs) {
    if (arg != null) {
      LookupElementBuilder item=LookupElementBuilder.create(arg);
      resultSet.addElement(item);
    }
  }
}
Program: 86422
Project: 86422
Buggy source:
@Override public void addCompletions(@NotNull final CompletionParameters parameters,ProcessingContext context,@NotNull CompletionResultSet resultSet){
  resultSet.stopHere();
  final String prefix=getPrefix(parameters);
  resultSet=resultSet.withPrefixMatcher(new GaugePrefixMatcher(prefix));
  Module moduleForPsiElement=GaugeUtil.moduleForPsiElement(parameters.getPosition());
  if (moduleForPsiElement == null) {
    return;
  }
  for (  Type item : getStepsInModule(moduleForPsiElement)) {
    LookupElementBuilder element=LookupElementBuilder.create(item.getText()).withTypeText(item.getType(),true);
    element=element.withInsertHandler(new InsertHandler<LookupElement>(){
      @Override public void handleInsert(      InsertionContext context,      LookupElement item){
        if (context.getCompletionChar() == '\t') {
          context.getDocument().insertString(context.getEditor().getCaretModel().getOffset(),"String_Node_Str");
          PsiDocumentManager.getInstance(context.getProject()).commitDocument(context.getDocument());
        }
        PsiElement stepElement=context.getFile().findElementAt(context.getStartOffset()).getParent();
        TemplateBuilder templateBuilder=getTemplateBuilder(stepElement,prefix);
        templateBuilder.run(context.getEditor(),false);
      }
    }
);
    resultSet.addElement(element);
  }
}

Fixed version (ground truth):
@Override public void addCompletions(@NotNull final CompletionParameters parameters,ProcessingContext context,@NotNull CompletionResultSet resultSet){
  resultSet.stopHere();
  final String prefix=getPrefix(parameters);
  resultSet=resultSet.withPrefixMatcher(new GaugePrefixMatcher(prefix));
  Module moduleForPsiElement=GaugeUtil.moduleForPsiElement(parameters.getPosition());
  if (moduleForPsiElement == null) {
    return;
  }
  for (  Type item : getStepsInModule(moduleForPsiElement)) {
    LookupElementBuilder element=LookupElementBuilder.create(item.getText()).withTypeText(item.getType(),true);
    element=element.withInsertHandler((context1,item1) -> {
      if (context1.getCompletionChar() == '\t') {
        context1.getDocument().insertString(context1.getEditor().getCaretModel().getOffset(),"String_Node_Str");
        PsiDocumentManager.getInstance(context1.getProject()).commitDocument(context1.getDocument());
      }
      PsiElement stepElement=context1.getFile().findElementAt(context1.getStartOffset()).getParent();
      TemplateBuilder templateBuilder=getTemplateBuilder(stepElement,prefix);
      templateBuilder.run(context1.getEditor(),false);
    }
);
    resultSet.addElement(element);
  }
}
Program: 86423
Project: 86423
Buggy source:
private List<String> getFilledParams(String prefix){
  Pattern filledParamPattern=Pattern.compile("String_Node_Str");
  Matcher matcher=filledParamPattern.matcher(prefix);
  List<String> filledParams=new ArrayList<String>();
  while (matcher.find()) {
    filledParams.add(matcher.group());
  }
  return filledParams;
}

Fixed version (ground truth):
private List<String> getFilledParams(String prefix){
  Pattern filledParamPattern=Pattern.compile("String_Node_Str");
  Matcher matcher=filledParamPattern.matcher(prefix);
  List<String> filledParams=new ArrayList<>();
  while (matcher.find()) {
    filledParams.add(matcher.group());
  }
  return filledParams;
}
Program: 86424
Project: 86424
Buggy source:
private List<Type> getStepsInModule(Module module){
  List<Type> steps=new ArrayList<Type>();
  try {
    GaugeService gaugeService=Gauge.getGaugeService(module,true);
    if (gaugeService == null)     return steps;
    GaugeConnection gaugeConnection=gaugeService.getGaugeConnection();
    if (gaugeConnection != null) {
      for (      StepValue stepValue : gaugeConnection.fetchAllSteps())       addStep(steps,stepValue);
      for (      ConceptInfo conceptInfo : gaugeConnection.fetchAllConcepts())       addStep(steps,conceptInfo.getStepValue());
      return steps;
    }
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  return steps;
}

Fixed version (ground truth):
private List<Type> getStepsInModule(Module module){
  List<Type> steps=new ArrayList<>();
  try {
    GaugeService gaugeService=Gauge.getGaugeService(module,true);
    if (gaugeService == null)     return steps;
    GaugeConnection gaugeConnection=gaugeService.getGaugeConnection();
    if (gaugeConnection != null) {
      for (      StepValue stepValue : gaugeConnection.fetchAllSteps())       addStep(steps,stepValue);
      for (      ConceptInfo conceptInfo : gaugeConnection.fetchAllConcepts())       addStep(steps,conceptInfo.getStepValue());
      return steps;
    }
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  return steps;
}
Program: 86425
Project: 86425
Buggy source:
public static HashSet<Module> getSubModules(Module module){
  String value=getProjectGroupValue(module);
  HashSet<Module> modules=linkedModulesMap.get(value);
  if (modules != null)   return modules;
  modules=new HashSet<Module>();
  for (  Module m : ModuleManager.getInstance(module.getProject()).getModules())   if (getProjectGroupValue(m).equals(value)) {
    modules.add(m);
    addToModulesMap(m,value);
  }
  return modules;
}

Fixed version (ground truth):
public static HashSet<Module> getSubModules(Module module){
  String value=getProjectGroupValue(module);
  HashSet<Module> modules=linkedModulesMap.get(value);
  if (modules != null)   return modules;
  modules=new HashSet<>();
  for (  Module m : ModuleManager.getInstance(module.getProject()).getModules())   if (getProjectGroupValue(m).equals(value)) {
    modules.add(m);
    addToModulesMap(m,value);
  }
  return modules;
}
Program: 86426
Project: 86426
Buggy source:
private static void addToModulesMap(Module module,String name){
  if (!linkedModulesMap.containsKey(name))   linkedModulesMap.put(name,new HashSet<Module>());
  linkedModulesMap.get(name).add(module);
}

Fixed version (ground truth):
private static void addToModulesMap(Module module,String name){
  if (!linkedModulesMap.containsKey(name))   linkedModulesMap.put(name,new HashSet<>());
  linkedModulesMap.get(name).add(module);
}
Program: 86427
Project: 86427
Buggy source:
@Override public boolean isConfigurationFromContext(RunConfiguration configuration,ConfigurationContext context){
  if (configuration.getType() != getConfigurationType())   return false;
  final Location location=context.getLocation();
  if (location == null || location.getVirtualFile() == null) {
    return false;
  }
  final String specsToExecute=((GaugeRunConfiguration)configuration).getSpecsToExecute();
  if (specsToExecute == null) {
    return false;
  }
  return (specsToExecute.contains(location.getVirtualFile().getName()));
}

Fixed version (ground truth):
@Override public boolean isConfigurationFromContext(RunConfiguration configuration,ConfigurationContext context){
  if (configuration.getType() != getConfigurationType())   return false;
  final Location location=context.getLocation();
  if (location == null || location.getVirtualFile() == null) {
    return false;
  }
  final String specsToExecute=((GaugeRunConfiguration)configuration).getSpecsToExecute();
  return specsToExecute != null && (specsToExecute.contains(location.getVirtualFile().getName()));
}
Program: 86428
Project: 86428
Buggy source:
@Override public void readExternal(Element element) throws InvalidDataException {
  super.readExternal(element);
  environment=JDOMExternalizer.readString(element,"String_Node_Str");
  specsToExecute=JDOMExternalizer.readString(element,"String_Node_Str");
  tags=JDOMExternalizer.readString(element,"String_Node_Str");
  parallelNodes=JDOMExternalizer.readString(element,"String_Node_Str");
  execInParallel=JDOMExternalizer.readBoolean(element,"String_Node_Str");
  programParameters.setProgramParameters(JDOMExternalizer.readString(element,"String_Node_Str"));
  programParameters.setWorkingDirectory(JDOMExternalizer.readString(element,"String_Node_Str"));
  this.moduleName=JDOMExternalizer.readString(element,"String_Node_Str");
  HashMap<String,String> envMap=new HashMap<String,String>();
  JDOMExternalizer.readMap(element,envMap,"String_Node_Str","String_Node_Str");
  programParameters.setEnvs(envMap);
  rowsRange=JDOMExternalizer.readString(element,"String_Node_Str");
}

Fixed version (ground truth):
@Override public void readExternal(Element element) throws InvalidDataException {
  super.readExternal(element);
  environment=JDOMExternalizer.readString(element,"String_Node_Str");
  specsToExecute=JDOMExternalizer.readString(element,"String_Node_Str");
  tags=JDOMExternalizer.readString(element,"String_Node_Str");
  parallelNodes=JDOMExternalizer.readString(element,"String_Node_Str");
  execInParallel=JDOMExternalizer.readBoolean(element,"String_Node_Str");
  programParameters.setProgramParameters(JDOMExternalizer.readString(element,"String_Node_Str"));
  programParameters.setWorkingDirectory(JDOMExternalizer.readString(element,"String_Node_Str"));
  this.moduleName=JDOMExternalizer.readString(element,"String_Node_Str");
  HashMap<String,String> envMap=new HashMap<>();
  JDOMExternalizer.readMap(element,envMap,"String_Node_Str","String_Node_Str");
  programParameters.setEnvs(envMap);
  rowsRange=JDOMExternalizer.readString(element,"String_Node_Str");
}
Program: 86429
Project: 86429
Buggy source:
private static void launchDebugger(final Project project,final GaugeRunConfiguration.DebugInfo debugInfo){
  Runnable runnable=new Runnable(){
    @Override public void run(){
      final long startTime=System.currentTimeMillis();
      GenericDebuggerRunner basicProgramRunner=new GenericDebuggerRunner();
      ProjectPropertiesComponentImpl propertiesComponent=new ProjectPropertiesComponentImpl();
      RunManagerImpl manager=new RunManagerImpl(project,propertiesComponent);
      ConfigurationFactory configFactory=RemoteConfigurationType.getInstance().getConfigurationFactories()[0];
      RemoteConfiguration remoteConfig=new RemoteConfiguration(project,configFactory);
      remoteConfig.PORT=debugInfo.getPort();
      remoteConfig.HOST=debugInfo.getHost();
      remoteConfig.USE_SOCKET_TRANSPORT=true;
      remoteConfig.SERVER_MODE=false;
      RunnerAndConfigurationSettingsImpl configuration=new RunnerAndConfigurationSettingsImpl(manager,remoteConfig,false);
      ExecutionEnvironment environment=new ExecutionEnvironment(new DefaultDebugExecutor(),basicProgramRunner,configuration,project);
      boolean debuggerConnected=false;
      while (!debuggerConnected && ((System.currentTimeMillis() - startTime) < 25000)) {
        try {
          Thread.sleep(5000);
          basicProgramRunner.execute(environment);
          debuggerConnected=true;
        }
 catch (        Exception e) {
          System.err.println("String_Node_Str" + e.getMessage());
          continue;
        }
      }
    }
  }
;
  ApplicationManager.getApplication().invokeAndWait(runnable,ModalityState.any());
}

Fixed version (ground truth):
private static void launchDebugger(final Project project,final GaugeRunConfiguration.DebugInfo debugInfo){
  Runnable runnable=() -> {
    final long startTime=System.currentTimeMillis();
    GenericDebuggerRunner basicProgramRunner=new GenericDebuggerRunner();
    ProjectPropertiesComponentImpl propertiesComponent=new ProjectPropertiesComponentImpl();
    RunManagerImpl manager=new RunManagerImpl(project,propertiesComponent);
    ConfigurationFactory configFactory=RemoteConfigurationType.getInstance().getConfigurationFactories()[0];
    RemoteConfiguration remoteConfig=new RemoteConfiguration(project,configFactory);
    remoteConfig.PORT=debugInfo.getPort();
    remoteConfig.HOST=debugInfo.getHost();
    remoteConfig.USE_SOCKET_TRANSPORT=true;
    remoteConfig.SERVER_MODE=false;
    RunnerAndConfigurationSettingsImpl configuration=new RunnerAndConfigurationSettingsImpl(manager,remoteConfig,false);
    ExecutionEnvironment environment=new ExecutionEnvironment(new DefaultDebugExecutor(),basicProgramRunner,configuration,project);
    boolean debuggerConnected=false;
    while (!debuggerConnected && ((System.currentTimeMillis() - startTime) < 25000)) {
      try {
        Thread.sleep(5000);
        basicProgramRunner.execute(environment);
        debuggerConnected=true;
      }
 catch (      Exception e) {
        System.err.println("String_Node_Str" + e.getMessage());
      }
    }
  }
;
  ApplicationManager.getApplication().invokeAndWait(runnable,ModalityState.any());
}
Program: 86430
Project: 86430
Buggy source:
@Override protected boolean setupConfigurationFromContext(RunConfiguration configuration,ConfigurationContext configurationContext,Ref ref){
  VirtualFile[] selectedFiles=CommonDataKeys.VIRTUAL_FILE_ARRAY.getData(configurationContext.getDataContext());
  Module module=configurationContext.getModule();
  if (selectedFiles == null || module == null)   return false;
  if (selectedFiles.length == 1) {
    if (!selectedFiles[0].isDirectory()) {
      return false;
    }
 else     if (selectedFiles[0].equals(configurationContext.getProject().getBaseDir())) {
      configuration.setName(DEFAULT_CONFIGURATION_NAME);
      ((GaugeRunConfiguration)configuration).setModule(module);
      ((GaugeRunConfiguration)configuration).setSpecsToExecute(projectSpecsDirectory(configurationContext.getProject()));
      return true;
    }
  }
  ArrayList<String> specsToExecute=new ArrayList<String>();
  for (  VirtualFile selectedFile : selectedFiles) {
    if (isSpecFile(selectedFile)) {
      specsToExecute.add(selectedFile.getPath());
    }
 else     if (selectedFile.isDirectory() && shouldAddDirToExecute(selectedFile)) {
      specsToExecute.add(selectedFile.getPath());
    }
  }
  if (specsToExecute.size() == 0) {
    return false;
  }
  configuration.setName(DEFAULT_CONFIGURATION_NAME);
  ((GaugeRunConfiguration)configuration).setModule(module);
  ((GaugeRunConfiguration)configuration).setSpecsArrayToExecute(specsToExecute);
  return true;
}

Fixed version (ground truth):
@Override protected boolean setupConfigurationFromContext(RunConfiguration configuration,ConfigurationContext configurationContext,Ref ref){
  VirtualFile[] selectedFiles=CommonDataKeys.VIRTUAL_FILE_ARRAY.getData(configurationContext.getDataContext());
  Module module=configurationContext.getModule();
  if (selectedFiles == null || module == null)   return false;
  if (selectedFiles.length == 1) {
    if (!selectedFiles[0].isDirectory()) {
      return false;
    }
 else     if (selectedFiles[0].equals(configurationContext.getProject().getBaseDir())) {
      configuration.setName(DEFAULT_CONFIGURATION_NAME);
      ((GaugeRunConfiguration)configuration).setModule(module);
      ((GaugeRunConfiguration)configuration).setSpecsToExecute(projectSpecsDirectory(configurationContext.getProject()));
      return true;
    }
  }
  ArrayList<String> specsToExecute=new ArrayList<>();
  for (  VirtualFile selectedFile : selectedFiles) {
    if (isSpecFile(selectedFile)) {
      specsToExecute.add(selectedFile.getPath());
    }
 else     if (selectedFile.isDirectory() && shouldAddDirToExecute(selectedFile)) {
      specsToExecute.add(selectedFile.getPath());
    }
  }
  if (specsToExecute.size() == 0) {
    return false;
  }
  configuration.setName(DEFAULT_CONFIGURATION_NAME);
  ((GaugeRunConfiguration)configuration).setModule(module);
  ((GaugeRunConfiguration)configuration).setSpecsArrayToExecute(specsToExecute);
  return true;
}
Program: 86431
Project: 86431
Buggy source:
@Override public void run(){
  Collection<ConceptStepImpl> conceptSteps=getConceptSteps(searchParameters.getElementToSearch());
  Collection<SpecStep> specSteps=getSpecSteps(searchParameters.getElementToSearch());
  Class<? extends PsiElement> elementClass=searchParameters.getElementToSearch().getClass();
  if (elementClass.equals(ConceptStepImpl.class))   handleConceptStep(conceptSteps,specSteps,searchParameters,processor);
 else   if (elementClass.equals(PsiAnnotationImpl.class) || elementClass.equals(PsiMethodImpl.class))   handleAnnotation(conceptSteps,specSteps,searchParameters,processor);
 else   if (elementClass.equals(SpecStepImpl.class))   handleSpecStep(conceptSteps,specSteps,searchParameters,processor);
}

Fixed version (ground truth):
@Override public void run(){
  Collection<ConceptStepImpl> conceptSteps=getConceptSteps(searchParameters.getElementToSearch(),searchParameters.getScopeDeterminedByUser().getDisplayName());
  Collection<SpecStep> specSteps=getSpecSteps(searchParameters.getElementToSearch(),searchParameters.getScopeDeterminedByUser().getDisplayName());
  Class<? extends PsiElement> elementClass=searchParameters.getElementToSearch().getClass();
  if (elementClass.equals(ConceptStepImpl.class))   handleConceptStep(conceptSteps,specSteps,searchParameters,processor);
 else   if (elementClass.equals(PsiAnnotationImpl.class) || elementClass.equals(PsiMethodImpl.class))   handleAnnotation(conceptSteps,specSteps,searchParameters,processor);
 else   if (elementClass.equals(SpecStepImpl.class))   handleSpecStep(conceptSteps,specSteps,searchParameters,processor);
}
Program: 86432
Project: 86432
Buggy source:
private Collection<ConceptStepImpl> getConceptSteps(PsiElement element){
  return PsiTreeUtil.collectElementsOfType(getPsiDirectory(element,element.getContainingFile().getContainingDirectory()),ConceptStepImpl.class);
}

Fixed version (ground truth):
private Collection<ConceptStepImpl> getConceptSteps(PsiElement element,String displayName){
  PsiElement psiDirectory=getDirectorySearchScope(element,displayName);
  return PsiTreeUtil.collectElementsOfType(psiDirectory,ConceptStepImpl.class);
}
Program: 86433
Project: 86433
Buggy source:
private Collection<SpecStep> getSpecSteps(PsiElement element){
  return PsiTreeUtil.collectElementsOfType(getPsiDirectory(element,element.getContainingFile().getContainingDirectory()),SpecStep.class);
}

Fixed version (ground truth):
private Collection<SpecStep> getSpecSteps(PsiElement element,String displayName){
  PsiElement psiDirectory=getDirectorySearchScope(element,displayName);
  return PsiTreeUtil.collectElementsOfType(psiDirectory,SpecStep.class);
}
Program: 86434
Project: 86434
Buggy source:
@Override public void processQuery(@NotNull final ReferencesSearch.SearchParameters searchParameters,@NotNull final Processor<PsiReference> processor){
  ApplicationManager.getApplication().runReadAction(new Runnable(){
    @Override public void run(){
      Collection<ConceptStepImpl> conceptSteps=getConceptSteps(searchParameters.getElementToSearch());
      Collection<SpecStep> specSteps=getSpecSteps(searchParameters.getElementToSearch());
      Class<? extends PsiElement> elementClass=searchParameters.getElementToSearch().getClass();
      if (elementClass.equals(ConceptStepImpl.class))       handleConceptStep(conceptSteps,specSteps,searchParameters,processor);
 else       if (elementClass.equals(PsiAnnotationImpl.class) || elementClass.equals(PsiMethodImpl.class))       handleAnnotation(conceptSteps,specSteps,searchParameters,processor);
 else       if (elementClass.equals(SpecStepImpl.class))       handleSpecStep(conceptSteps,specSteps,searchParameters,processor);
    }
  }
);
}

Fixed version (ground truth):
@Override public void processQuery(@NotNull final ReferencesSearch.SearchParameters searchParameters,@NotNull final Processor<PsiReference> processor){
  ApplicationManager.getApplication().runReadAction(new Runnable(){
    @Override public void run(){
      Collection<ConceptStepImpl> conceptSteps=getConceptSteps(searchParameters.getElementToSearch(),searchParameters.getScopeDeterminedByUser().getDisplayName());
      Collection<SpecStep> specSteps=getSpecSteps(searchParameters.getElementToSearch(),searchParameters.getScopeDeterminedByUser().getDisplayName());
      Class<? extends PsiElement> elementClass=searchParameters.getElementToSearch().getClass();
      if (elementClass.equals(ConceptStepImpl.class))       handleConceptStep(conceptSteps,specSteps,searchParameters,processor);
 else       if (elementClass.equals(PsiAnnotationImpl.class) || elementClass.equals(PsiMethodImpl.class))       handleAnnotation(conceptSteps,specSteps,searchParameters,processor);
 else       if (elementClass.equals(SpecStepImpl.class))       handleSpecStep(conceptSteps,specSteps,searchParameters,processor);
    }
  }
);
}
Program: 86435
Project: 86435
Buggy source:
@Override public void run(){
  Collection<ConceptStepImpl> conceptSteps=getConceptSteps(searchParameters.getElementToSearch(),searchParameters.getScopeDeterminedByUser().getDisplayName());
  Collection<SpecStep> specSteps=getSpecSteps(searchParameters.getElementToSearch(),searchParameters.getScopeDeterminedByUser().getDisplayName());
  Class<? extends PsiElement> elementClass=searchParameters.getElementToSearch().getClass();
  if (elementClass.equals(ConceptStepImpl.class))   handleConceptStep(conceptSteps,specSteps,searchParameters,processor);
 else   if (elementClass.equals(PsiAnnotationImpl.class) || elementClass.equals(PsiMethodImpl.class))   handleAnnotation(conceptSteps,specSteps,searchParameters,processor);
 else   if (elementClass.equals(SpecStepImpl.class))   handleSpecStep(conceptSteps,specSteps,searchParameters,processor);
}

Fixed version (ground truth):
@Override public void run(){
  Collection<ConceptStepImpl> conceptSteps=getConceptSteps(searchParameters.getElementToSearch());
  Collection<SpecStep> specSteps=getSpecSteps(searchParameters.getElementToSearch());
  Class<? extends PsiElement> elementClass=searchParameters.getElementToSearch().getClass();
  if (elementClass.equals(ConceptStepImpl.class))   handleConceptStep(conceptSteps,specSteps,processor,(ConceptStepImpl)searchParameters.getElementToSearch());
 else   if (elementClass.equals(PsiAnnotationImpl.class) || elementClass.equals(PsiMethodImpl.class))   handleAnnotation(conceptSteps,specSteps,processor,searchParameters.getElementToSearch());
 else   if (elementClass.equals(SpecStepImpl.class))   handleSpecStep(conceptSteps,specSteps,processor,(SpecStepImpl)searchParameters.getElementToSearch());
}
Program: 86436
Project: 86436
Buggy source:
private Collection<ConceptStepImpl> getConceptSteps(PsiElement element,String displayName){
  PsiElement psiDirectory=getDirectorySearchScope(element,displayName);
  return PsiTreeUtil.collectElementsOfType(psiDirectory,ConceptStepImpl.class);
}

Fixed version (ground truth):
private Collection<ConceptStepImpl> getConceptSteps(PsiElement element){
  return PsiTreeUtil.collectElementsOfType(getPsiDirectory(element,element.getContainingFile().getContainingDirectory()),ConceptStepImpl.class);
}
Program: 86437
Project: 86437
Buggy source:
private Collection<SpecStep> getSpecSteps(PsiElement element,String displayName){
  PsiElement psiDirectory=getDirectorySearchScope(element,displayName);
  return PsiTreeUtil.collectElementsOfType(psiDirectory,SpecStep.class);
}

Fixed version (ground truth):
private Collection<SpecStep> getSpecSteps(PsiElement element){
  return PsiTreeUtil.collectElementsOfType(getPsiDirectory(element,element.getContainingFile().getContainingDirectory()),SpecStep.class);
}