nus-yam/ex-repair huggingface dataset:
Program: 109577
Project: 109577
Buggy source:
@Override public Configuration getConfiguration(GraphContext context){
  FreeMarkerOperation generateReportOperation=FreeMarkerOperation.create(TEMPLATE_PATH,OUTPUT_FILENAME,VAR_APPLICATION_REPORTS);
  return ConfigurationBuilder.begin().addRule().when(Query.find(ApplicationReportModel.class).as(VAR_APPLICATION_REPORTS)).perform(generateReportOperation);
}

Fixed version (ground truth):
@Override public Configuration getConfiguration(GraphContext context){
  FreeMarkerOperation generateReportOperation=FreeMarkerOperation.create(furnace,TEMPLATE_PATH,OUTPUT_FILENAME,VAR_APPLICATION_REPORTS);
  return ConfigurationBuilder.begin().addRule().when(Query.find(ApplicationReportModel.class).as(VAR_APPLICATION_REPORTS)).perform(generateReportOperation);
}
Program: 109578
Project: 109578
Buggy source:
private String resolveClassname(String sourceClassname){
  if (!StringUtils.contains(sourceClassname,"String_Node_Str")) {
    if (classNameLookedUp.contains(sourceClassname)) {
      String qualifiedName=classNameToFQCN.get(sourceClassname);
      if (qualifiedName != null) {
        return qualifiedName;
      }
 else {
        return sourceClassname;
      }
    }
 else {
      classNameLookedUp.add(sourceClassname);
      for (      String wildcardImport : wildcardImports) {
        String candidateQualifiedName=wildcardImport + "String_Node_Str" + sourceClassname;
        Iterable<JavaClassModel> models=javaClassDao.findAllByProperty(JavaClassModel.PROPERTY_QUALIFIED_NAME,candidateQualifiedName);
        if (models.iterator().hasNext()) {
          classNameToFQCN.put(sourceClassname,candidateQualifiedName);
          return candidateQualifiedName;
        }
 else {
          javaClassDao.getOrCreate(candidateQualifiedName);
        }
      }
      return sourceClassname;
    }
  }
 else {
    return sourceClassname;
  }
}

Fixed version (ground truth):
private String resolveClassname(String sourceClassname){
  if (!StringUtils.contains(sourceClassname,"String_Node_Str")) {
    if (classNameLookedUp.contains(sourceClassname)) {
      String qualifiedName=classNameToFQCN.get(sourceClassname);
      if (qualifiedName != null) {
        return qualifiedName;
      }
 else {
        return sourceClassname;
      }
    }
 else {
      classNameLookedUp.add(sourceClassname);
      for (      String wildcardImport : wildcardImports) {
        String candidateQualifiedName=wildcardImport + "String_Node_Str" + sourceClassname;
        Iterable<JavaClassModel> models=javaClassService.findAllByProperty(JavaClassModel.PROPERTY_QUALIFIED_NAME,candidateQualifiedName);
        if (models.iterator().hasNext()) {
          classNameToFQCN.put(sourceClassname,candidateQualifiedName);
          return candidateQualifiedName;
        }
      }
      return sourceClassname;
    }
  }
 else {
    return sourceClassname;
  }
}
Program: 109580
Project: 109580
Buggy source:
@Override public URL getResource(String name){
  for (  ClassLoader classLoader : loaders) {
    return classLoader.getResource(name);
  }
  ClassLoader contextLoader=Thread.currentThread().getContextClassLoader();
  if (contextLoader != null) {
    return contextLoader.getResource(name);
  }
 else {
    return super.getResource(name);
  }
}

Fixed version (ground truth):
@Override public URL getResource(String name){
  for (  ClassLoader classLoader : loaders) {
    URL resource=classLoader.getResource(name);
    if (resource != null) {
      return resource;
    }
  }
  ClassLoader contextLoader=Thread.currentThread().getContextClassLoader();
  if (contextLoader != null) {
    return contextLoader.getResource(name);
  }
 else {
    return super.getResource(name);
  }
}
Program: 109581
Project: 109581
Buggy source:
@Override public Configuration getConfiguration(GraphContext context){
  Configuration configuration=ConfigurationBuilder.begin().addRule().when(GraphSearchConditionBuilder.create("String_Node_Str").ofType(XmlMetaFacetModel.class)).perform(Iteration.over(XmlMetaFacetModel.class,"String_Node_Str").as("String_Node_Str").perform(TypeOperation.addType("String_Node_Str",MavenProjectModel.class)).endIteration()).addRule().when(GraphSearchConditionBuilder.create("String_Node_Str").ofType(MavenProjectModel.class)).perform(Iteration.over(MavenProjectModel.class,"String_Node_Str").as("String_Node_Str").perform(new GraphOperation(){
    @Override public void perform(    GraphRewrite event,    EvaluationContext context){
      VarStack varStack=VarStack.instance(event);
      MavenProjectModel mavenFacetModel=varStack.getCurrentPayload(MavenProjectModel.class,"String_Node_Str");
      results.add(mavenFacetModel);
    }
  }
).endIteration());
  return configuration;
}

Fixed version (ground truth):
@Override public Configuration getConfiguration(GraphContext context){
  Configuration configuration=ConfigurationBuilder.begin().addRule().when(GraphSearchConditionBuilder.create("String_Node_Str").ofType(XmlMetaFacetModel.class)).perform(Iteration.over(XmlMetaFacetModel.class,"String_Node_Str").as("String_Node_Str").perform(TypeOperation.addType("String_Node_Str",MavenProjectModel.class)).endIteration()).addRule().when(GraphSearchConditionBuilder.create("String_Node_Str").ofType(MavenProjectModel.class)).perform(Iteration.over(MavenProjectModel.class,"String_Node_Str").as("String_Node_Str").perform(new GraphOperation(){
    @Override public void perform(    GraphRewrite event,    EvaluationContext context){
      VarStack varStack=VarStack.instance(event);
      MavenProjectModel mavenFacetModel=Iteration.getCurrentPayload(varStack,MavenProjectModel.class,"String_Node_Str");
      results.add(mavenFacetModel);
    }
  }
).endIteration());
  return configuration;
}
Program: 109582
Project: 109582
Buggy source:
@Override public void perform(GraphRewrite event,EvaluationContext context){
  VarStack varStack=VarStack.instance(event);
  MavenProjectModel mavenFacetModel=varStack.getCurrentPayload(MavenProjectModel.class,"String_Node_Str");
  results.add(mavenFacetModel);
}

Fixed version (ground truth):
@Override public void perform(GraphRewrite event,EvaluationContext context){
  VarStack varStack=VarStack.instance(event);
  MavenProjectModel mavenFacetModel=Iteration.getCurrentPayload(varStack,MavenProjectModel.class,"String_Node_Str");
  results.add(mavenFacetModel);
}
Program: 109583
Project: 109583
Buggy source:
@Override public Configuration getConfiguration(GraphContext context){
  Configuration configuration=ConfigurationBuilder.begin().addRule().when(GraphSearchConditionBuilder.create("String_Node_Str").withProperty(XmlMetaFacetModel.PROPERTY_ROOT_TAG_NAME,GraphSearchPropertyComparisonType.EQUALS,"String_Node_Str")).perform(Iteration.over(XmlMetaFacetModel.class,"String_Node_Str").as("String_Node_Str").perform(new GraphOperation(){
    @Override public void perform(    GraphRewrite event,    EvaluationContext context){
      VarStack varStack=VarStack.instance(event);
      XmlMetaFacetModel xmlFacetModel=varStack.getCurrentPayload(XmlMetaFacetModel.class,"String_Node_Str");
      typeSearchResults.add(xmlFacetModel);
    }
  }
).endIteration());
  return configuration;
}

Fixed version (ground truth):
@Override public Configuration getConfiguration(GraphContext context){
  Configuration configuration=ConfigurationBuilder.begin().addRule().when(GraphSearchConditionBuilder.create("String_Node_Str").withProperty(XmlMetaFacetModel.PROPERTY_ROOT_TAG_NAME,GraphSearchPropertyComparisonType.EQUALS,"String_Node_Str")).perform(Iteration.over(XmlMetaFacetModel.class,"String_Node_Str").as("String_Node_Str").perform(new GraphOperation(){
    @Override public void perform(    GraphRewrite event,    EvaluationContext context){
      VarStack varStack=org.jboss.windup.config.runner.VarStack.instance(event);
      XmlMetaFacetModel xmlFacetModel=Iteration.getCurrentPayload(varStack,XmlMetaFacetModel.class,"String_Node_Str");
      typeSearchResults.add(xmlFacetModel);
    }
  }
).endIteration());
  return configuration;
}
Program: 109584
Project: 109584
Buggy source:
@Override public void perform(GraphRewrite event,EvaluationContext context){
  VarStack varStack=VarStack.instance(event);
  XmlMetaFacetModel xmlFacetModel=varStack.getCurrentPayload(XmlMetaFacetModel.class,"String_Node_Str");
  typeSearchResults.add(xmlFacetModel);
}

Fixed version (ground truth):
@Override public void perform(GraphRewrite event,EvaluationContext context){
  VarStack varStack=org.jboss.windup.config.runner.VarStack.instance(event);
  XmlMetaFacetModel xmlFacetModel=Iteration.getCurrentPayload(varStack,XmlMetaFacetModel.class,"String_Node_Str");
  typeSearchResults.add(xmlFacetModel);
}
Program: 109585
Project: 109585
Buggy source:
@Override public Configuration getConfiguration(GraphContext context){
  Configuration configuration=ConfigurationBuilder.begin().addRule().when(GraphSearchConditionBuilder.create("String_Node_Str").ofType(XmlMetaFacetModel.class).withProperty(XmlMetaFacetModel.PROPERTY_ROOT_TAG_NAME,GraphSearchPropertyComparisonType.EQUALS,"String_Node_Str")).perform(Iteration.over(XmlMetaFacetModel.class,"String_Node_Str").as("String_Node_Str").perform(new GraphOperation(){
    @Override public void perform(    GraphRewrite event,    EvaluationContext context){
      VarStack varStack=VarStack.instance(event);
      XmlMetaFacetModel xmlFacetModel=varStack.getCurrentPayload(XmlMetaFacetModel.class,"String_Node_Str");
      typeSearchResults.add(xmlFacetModel);
    }
  }
).endIteration());
  return configuration;
}

Fixed version (ground truth):
@Override public Configuration getConfiguration(GraphContext context){
  Configuration configuration=ConfigurationBuilder.begin().addRule().when(GraphSearchConditionBuilder.create("String_Node_Str").ofType(XmlMetaFacetModel.class).withProperty(XmlMetaFacetModel.PROPERTY_ROOT_TAG_NAME,GraphSearchPropertyComparisonType.EQUALS,"String_Node_Str")).perform(Iteration.over(XmlMetaFacetModel.class,"String_Node_Str").as("String_Node_Str").perform(new GraphOperation(){
    @Override public void perform(    GraphRewrite event,    EvaluationContext context){
      VarStack varStack=VarStack.instance(event);
      XmlMetaFacetModel xmlFacetModel=Iteration.getCurrentPayload(varStack,XmlMetaFacetModel.class,"String_Node_Str");
      typeSearchResults.add(xmlFacetModel);
    }
  }
).endIteration());
  return configuration;
}
Program: 109586
Project: 109586
Buggy source:
@Override public void perform(GraphRewrite event,EvaluationContext context){
  VarStack varStack=VarStack.instance(event);
  XmlMetaFacetModel xmlFacetModel=varStack.getCurrentPayload(XmlMetaFacetModel.class,"String_Node_Str");
  typeSearchResults.add(xmlFacetModel);
}

Fixed version (ground truth):
@Override public void perform(GraphRewrite event,EvaluationContext context){
  VarStack varStack=VarStack.instance(event);
  XmlMetaFacetModel xmlFacetModel=Iteration.getCurrentPayload(varStack,XmlMetaFacetModel.class,"String_Node_Str");
  typeSearchResults.add(xmlFacetModel);
}
Program: 109587
Project: 109587
Buggy source:
public void init(CompilationUnit cu,FileModel fileModel){
  this.cu=cu;
  this.fileModel=fileModel;
  this.wildcardImports.clear();
  this.classNameLookedUp.clear();
  this.classNameToFQCN.clear();
  this.names.clear();
  this.nameInstance.clear();
  String packageName=cu.getPackage().getName().getFullyQualifiedName();
  List types=cu.types();
  if (!types.isEmpty()) {
    TypeDeclaration typeDeclaration=(TypeDeclaration)types.get(0);
    String className=typeDeclaration.getName().getFullyQualifiedName();
    String fqcn=packageName + "String_Node_Str" + className;
    this.names.add("String_Node_Str");
    this.nameInstance.put("String_Node_Str",fqcn);
  }
}

Fixed version (ground truth):
public void init(CompilationUnit cu,FileModel fileModel){
  this.cu=cu;
  this.fileModel=fileModel;
  this.wildcardImports.clear();
  this.classNameLookedUp.clear();
  this.classNameToFQCN.clear();
  this.names.clear();
  this.nameInstance.clear();
  String packageName=cu.getPackage().getName().getFullyQualifiedName();
  @SuppressWarnings("String_Node_Str") List<TypeDeclaration> types=cu.types();
  if (!types.isEmpty()) {
    TypeDeclaration typeDeclaration=(TypeDeclaration)types.get(0);
    String className=typeDeclaration.getName().getFullyQualifiedName();
    String fqcn=packageName + "String_Node_Str" + className;
    this.names.add("String_Node_Str");
    this.nameInstance.put("String_Node_Str",fqcn);
  }
}
Program: 109588
Project: 109588
Buggy source:
private String resolveClassname(String sourceClassname){
  if (!StringUtils.contains(sourceClassname,"String_Node_Str")) {
    if (classNameLookedUp.contains(sourceClassname)) {
      String qualifiedName=classNameToFQCN.get(sourceClassname);
      if (qualifiedName != null) {
        return qualifiedName;
      }
 else {
        return sourceClassname;
      }
    }
 else {
      classNameLookedUp.add(sourceClassname);
      for (      String wildcardImport : wildcardImports) {
        String candidateQualifiedName=wildcardImport + "String_Node_Str" + sourceClassname;
        Iterable<JavaClassModel> javaClassModels=javaClassDao.findByJavaPackage(wildcardImport);
        for (        JavaClassModel javaClassModel : javaClassModels) {
          if (candidateQualifiedName.equals(javaClassModel.getQualifiedName())) {
            classNameToFQCN.put(sourceClassname,candidateQualifiedName);
            return candidateQualifiedName;
          }
        }
      }
      return sourceClassname;
    }
  }
 else {
    return sourceClassname;
  }
}

Fixed version (ground truth):
private String resolveClassname(String sourceClassname){
  if (!StringUtils.contains(sourceClassname,"String_Node_Str")) {
    if (classNameLookedUp.contains(sourceClassname)) {
      String qualifiedName=classNameToFQCN.get(sourceClassname);
      if (qualifiedName != null) {
        return qualifiedName;
      }
 else {
        return sourceClassname;
      }
    }
 else {
      classNameLookedUp.add(sourceClassname);
      for (      String wildcardImport : wildcardImports) {
        String candidateQualifiedName=wildcardImport + "String_Node_Str" + sourceClassname;
        JavaClassModel jcm=javaClassDao.getJavaClass(candidateQualifiedName);
        if (jcm != null) {
          classNameToFQCN.put(sourceClassname,candidateQualifiedName);
          return candidateQualifiedName;
        }
      }
      return sourceClassname;
    }
  }
 else {
    return sourceClassname;
  }
}
Program: 109589
Project: 109589
Buggy source:
@Test public void testGraphTypeHandling() throws Exception {
  Assert.assertNotNull(context);
  BaseMetaModel baseMetaModel=context.getFramed().addVertex(null,BaseMetaModel.class);
  GraphUtil.addTypeToModel(context,baseMetaModel,XmlResourceModel.class);
  Iterable<Vertex> vertices=context.getFramed().query().has("String_Node_Str",Text.CONTAINS,BaseMetaModel.class.getAnnotation(TypeValue.class).value()).vertices();
  for (  Vertex v : vertices) {
    WindupVertexFrame framed=context.getFramed().frame(v,WindupVertexFrame.class);
    Assert.assertTrue(framed instanceof BaseMetaModel);
    Assert.assertTrue(framed instanceof XmlResourceModel);
  }
}

Fixed version (ground truth):
@Test public void testGraphTypeHandling() throws Exception {
  Assert.assertNotNull(context);
  BaseMetaModel baseMetaModel=context.getFramed().addVertex(null,BaseMetaModel.class);
  GraphUtil.addTypeToModel(context,baseMetaModel,XmlResourceModel.class);
  Iterable<Vertex> vertices=context.getFramed().query().has("String_Node_Str",Text.CONTAINS,BaseMetaModel.class.getAnnotation(TypeValue.class).value()).vertices();
  int numberFound=0;
  for (  Vertex v : vertices) {
    numberFound++;
    WindupVertexFrame framed=context.getFramed().frame(v,WindupVertexFrame.class);
    Assert.assertTrue(framed instanceof BaseMetaModel);
    Assert.assertTrue(framed instanceof XmlResourceModel);
  }
  Assert.assertEquals(1,numberFound);
}
Program: 109590
Project: 109590
Buggy source:
public void addTypeToElement(Class<? extends VertexFrame> kind,Element element){
  Class<?> typeHoldingTypeField=typeRegistry.getTypeHoldingTypeField(kind);
  if (typeHoldingTypeField != null) {
    TypeValue typeValueAnnotation=kind.getAnnotation(TypeValue.class);
    if (typeValueAnnotation != null) {
      String typeFieldName=typeHoldingTypeField.getAnnotation(TypeField.class).value();
      String typeValue=typeValueAnnotation.value();
      if (typeValue.contains(DELIMITER)) {
        throw new IllegalArgumentException("String_Node_Str" + kind.getCanonicalName() + "String_Node_Str"+ typeValue+ "String_Node_Str"+ DELIMITER+ "String_Node_Str");
      }
 else {
        for (int p=0; p < typeValue.length(); p++) {
          if (!Character.isLetterOrDigit(typeValue.charAt(p))) {
            throw new IllegalArgumentException("String_Node_Str" + kind.getCanonicalName() + "String_Node_Str"+ typeValue+ "String_Node_Str");
          }
        }
      }
      String currentPropertyValue=element.getProperty(typeValue);
      if (currentPropertyValue == null) {
        element.setProperty(typeFieldName,DELIMITER + typeValue + DELIMITER);
      }
 else       if (!currentPropertyValue.contains(DELIMITER + typeValue + DELIMITER)) {
        element.setProperty(typeFieldName,currentPropertyValue + typeValue + DELIMITER);
      }
    }
  }
}

Fixed version (ground truth):
public void addTypeToElement(Class<? extends VertexFrame> kind,Element element){
  Class<?> typeHoldingTypeField=typeRegistry.getTypeHoldingTypeField(kind);
  if (typeHoldingTypeField != null) {
    TypeValue typeValueAnnotation=kind.getAnnotation(TypeValue.class);
    if (typeValueAnnotation != null) {
      String typeFieldName=typeHoldingTypeField.getAnnotation(TypeField.class).value();
      String typeValue=typeValueAnnotation.value();
      if (typeValue.contains(DELIMITER)) {
        throw new IllegalArgumentException("String_Node_Str" + kind.getCanonicalName() + "String_Node_Str"+ typeValue+ "String_Node_Str"+ DELIMITER+ "String_Node_Str");
      }
 else {
        for (int p=0; p < typeValue.length(); p++) {
          if (!Character.isLetterOrDigit(typeValue.charAt(p))) {
            throw new IllegalArgumentException("String_Node_Str" + kind.getCanonicalName() + "String_Node_Str"+ typeValue+ "String_Node_Str");
          }
        }
      }
      String currentPropertyValue=element.getProperty(typeFieldName);
      if (currentPropertyValue == null) {
        element.setProperty(typeFieldName,DELIMITER + typeValue + DELIMITER);
      }
 else       if (!currentPropertyValue.contains(DELIMITER + typeValue + DELIMITER)) {
        element.setProperty(typeFieldName,currentPropertyValue + typeValue + DELIMITER);
      }
    }
  }
}
Program: 109591
Project: 109591
Buggy source:
/** 
 * Asks given IServerType what version is in the given directory. TODO: Make method of IServerType?
 * @deprecated  Use IServerType.recognizeVersion();
 */
private VersionRange recognizeVersion(Class<? extends IServerType> typeClass,File serverRootDir) throws WindupException {
  IServerType type=instantiate(typeClass);
  return type.recognizeVersion(serverRootDir);
}

Fixed version (ground truth):
/** 
 * Asks given IServerType what version is in the given directory. TODO: Make method of IServerType?
 * @deprecated Use IServerType.recognizeVersion();
 */
private VersionRange recognizeVersion(Class<? extends IServerType> typeClass,File serverRootDir) throws WindupException {
  IServerType type=instantiate(typeClass);
  return type.recognizeVersion(serverRootDir);
}
Program: 109592
Project: 109592
Buggy source:
@Override public void query(FramedGraphQuery q){
switch (searchType) {
case EQUALS:
    q.has(this.propertyName,this.searchValue);
  break;
case CONTAINS_TOKEN:
q.has(this.propertyName,Text.CONTAINS,searchValue);
break;
case REGEX:
q.has(this.propertyName,Text.REGEX,searchValue);
default :
throw new IllegalArgumentException("String_Node_Str" + q);
}
}

Fixed version (ground truth):
@Override public void query(FramedGraphQuery q){
switch (searchType) {
case EQUALS:
    q.has(this.propertyName,this.searchValue);
  break;
case CONTAINS_TOKEN:
q.has(this.propertyName,Text.CONTAINS,searchValue);
break;
case REGEX:
q.has(this.propertyName,Text.REGEX,searchValue);
break;
default :
throw new IllegalArgumentException("String_Node_Str" + searchType);
}
}
Program: 109594
Project: 109594
Buggy source:
@Override public List<Class<? extends GraphVisitor>> getDependencies(){
  return super.generateDependencies(ZipArchiveGraphVisitor.class);
}

Fixed version (ground truth):
@Override public List<Class<? extends GraphVisitor>> getDependencies(){
  return super.generateDependencies(ZipArchiveGraphVisitor.class,DirectoryVisitor.class);
}
Program: 109596
Project: 109596
Buggy source:
protected Collection<ModuleVO> findModulesContainingArchive(ArchiveVO archive) throws ModuleIndexReaderException {
  Set<ModuleVO> modules=new HashSet<ModuleVO>();
  IndexReader reader=null;
  try {
    reader=DirectoryReader.open(moduleIndexDir);
    IndexSearcher searcher=new IndexSearcher(reader);
    BooleanQuery query=new BooleanQuery();
    query.add(new TermQuery(new Term(ModuleTransformer.MODULE_ARCHIVE,archive.getSha1())),BooleanClause.Occur.MUST);
    int numResults=100;
    ScoreDoc[] hits=searcher.search(query,numResults).scoreDocs;
    for (int i=0; i < hits.length; i++) {
      Document doc=searcher.doc(hits[i].doc);
      modules.add(ModuleTransformer.fromDocument(doc));
    }
  }
 catch (  Exception e) {
    throw new ModuleIndexReaderException("String_Node_Str" + archive.toString(),e);
  }
 finally {
    IOUtils.closeQuietly(reader);
  }
  return modules;
}

Fixed version (ground truth):
protected Collection<ModuleVO> findModulesContainingArchive(Collection<ArchiveVO> archives) throws ModuleIndexReaderException {
  Set<ModuleVO> modules=new HashSet<ModuleVO>();
  IndexReader reader=null;
  try {
    reader=DirectoryReader.open(moduleIndexDir);
    IndexSearcher searcher=new IndexSearcher(reader);
    BooleanQuery query=new BooleanQuery();
    for (    ArchiveVO archive : archives) {
      query.add(new TermQuery(new Term(ModuleTransformer.MODULE_ARCHIVE,archive.getSha1())),BooleanClause.Occur.SHOULD);
    }
    query.setMinimumNumberShouldMatch(1);
    int numResults=100;
    ScoreDoc[] hits=searcher.search(query,numResults).scoreDocs;
    for (int i=0; i < hits.length; i++) {
      Document doc=searcher.doc(hits[i].doc);
      modules.add(ModuleTransformer.fromDocument(doc));
    }
  }
 catch (  Exception e) {
    throw new ModuleIndexReaderException("String_Node_Str",e);
  }
 finally {
    IOUtils.closeQuietly(reader);
  }
  return modules;
}
Program: 109597
Project: 109597
Buggy source:
@Override public Collection<ModuleVO> findModuleProvidingClass(String clz) throws ModuleIndexReaderException {
  Set<ModuleVO> modules=new HashSet<ModuleVO>();
  try {
    Collection<ArchiveVO> archives=archiveIndexer.findArchiveByQualifiedClassName(clz);
    for (    ArchiveVO archive : archives) {
      modules.addAll(findModulesContainingArchive(archive));
    }
  }
 catch (  ArchiveIndexReaderException e) {
    throw new ModuleIndexReaderException("String_Node_Str" + clz,e);
  }
  return modules;
}

Fixed version (ground truth):
@Override public Collection<ModuleVO> findModuleProvidingClass(String clz) throws ModuleIndexReaderException {
  Set<ModuleVO> modules=new HashSet<ModuleVO>();
  try {
    Collection<ArchiveVO> archives=archiveIndexer.findArchiveByQualifiedClassName(clz);
    modules.addAll(findModulesContainingArchive(archives));
  }
 catch (  ArchiveIndexReaderException e) {
    throw new ModuleIndexReaderException("String_Node_Str" + clz,e);
  }
  return modules;
}
Program: 109598
Project: 109598
Buggy source:
@Override public void addModule(ModuleVO module) throws ModuleIndexWriteException {
  Document document=ModuleTransformer.toDocument(module);
  IndexWriter writer=null;
  try {
    writer=new IndexWriter(moduleIndexDir,iwc);
    writer.updateDocument(new Term(ModuleTransformer.MODULE_ID),document);
    writer.commit();
  }
 catch (  Exception e) {
    throw new ModuleIndexWriteException("String_Node_Str" + module.toString(),e);
  }
 finally {
    IOUtils.closeQuietly(writer);
  }
}

Fixed version (ground truth):
@Override public void addModule(ModuleVO module) throws ModuleIndexWriteException {
  Document document=ModuleTransformer.toDocument(module);
  IndexWriter writer=null;
  try {
    writer=new IndexWriter(moduleIndexDir,iwc);
    writer.updateDocument(new Term(ModuleTransformer.MODULE_ID,document.get(ModuleTransformer.MODULE_ID)),document);
    writer.commit();
  }
 catch (  Exception e) {
    throw new ModuleIndexWriteException("String_Node_Str" + module.toString(),e);
  }
 finally {
    IOUtils.closeQuietly(writer);
  }
}
Program: 109599
Project: 109599
Buggy source:
public static ModuleVO fromDocument(Document doc){
  ModuleVO module=new ModuleVO();
  module.setName(doc.get(MODULE_NAME));
  module.setSlot(doc.get(MODULE_SLOT));
  for (  IndexableField field : doc.getFields(MODULE_DEPENDENCY)) {
    String[] vals=StringUtils.split(field.stringValue(),"String_Node_Str");
    ModuleVO dep=new ModuleVO();
    dep.setName(vals[0]);
    dep.setSlot(vals[1]);
    module.getDependencies().add(dep);
  }
  return module;
}

Fixed version (ground truth):
public static ModuleVO fromDocument(Document doc){
  ModuleVO module=new ModuleVO();
  module.setName(doc.get(MODULE_NAME));
  module.setSlot(doc.get(MODULE_SLOT));
  PlatformVO platform=new PlatformVO();
  platform.setName(doc.get(PLATFORM_NAME));
  platform.setVersion(doc.get(PLATFORM_VERSION));
  module.setPlatform(platform);
  for (  IndexableField field : doc.getFields(MODULE_DEPENDENCY)) {
    String[] vals=StringUtils.split(field.stringValue(),"String_Node_Str");
    ModuleVO dep=new ModuleVO();
    dep.setName(vals[0]);
    dep.setSlot(vals[1]);
    module.getDependencies().add(dep);
  }
  return module;
}
Program: 109600
Project: 109600
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + name + "String_Node_Str"+ slot+ "String_Node_Str"+ dependencies+ "String_Node_Str";
}

Fixed version (ground truth):
@Override public String toString(){
  return "String_Node_Str" + platform + "String_Node_Str"+ name+ "String_Node_Str"+ slot+ "String_Node_Str"+ dependencies+ "String_Node_Str"+ archives+ "String_Node_Str";
}
Program: 109603
Project: 109603
Buggy source:
public void onDateSet(DatePicker view,int year,int month,int day){
  Log.v(TAG,"String_Node_Str" + year + "String_Node_Str"+ month+ "String_Node_Str"+ day);
  mInputEditText.setText("String_Node_Str" + day + "String_Node_Str"+ (month + 1)+ "String_Node_Str"+ year);
  mPickableInstance.onPickerDismissed();
}

Fixed version (ground truth):
public void onDateSet(DatePicker view,int year,int month,int day){
  Log.v(TAG,"String_Node_Str" + year + "String_Node_Str"+ month+ "String_Node_Str"+ day);
  month=month + 1;
  mInputEditText.setText("String_Node_Str" + (day < 10 ? "String_Node_Str" + day : day) + "String_Node_Str"+ (month < 10 ? "String_Node_Str" + month : month)+ "String_Node_Str"+ year);
  mPickableInstance.onPickerDismissed();
}
Program: 109604
Project: 109604
Buggy source:
public void onTimeSet(TimePicker view,int hour,int minute){
  Log.v(TAG,"String_Node_Str" + hour + "String_Node_Str"+ minute);
  mInputEditText.setText("String_Node_Str" + hour + "String_Node_Str"+ minute);
  mPickableInstance.onPickerDismissed();
}

Fixed version (ground truth):
public void onTimeSet(TimePicker view,int hour,int minute){
  Log.v(TAG,"String_Node_Str" + (hour < 10 ? "String_Node_Str" + hour : hour) + "String_Node_Str"+ (minute < 10 ? "String_Node_Str" + minute : minute));
  mInputEditText.setText("String_Node_Str" + (hour < 10 ? "String_Node_Str" + hour : hour) + "String_Node_Str"+ (minute < 10 ? "String_Node_Str" + minute : minute));
  mPickableInstance.onPickerDismissed();
}
Program: 109605
Project: 109605
Buggy source:
@Override protected void onCreate(@Nullable Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.a_provider_credentials);
  providerAPIBroadcastReceiver=new ProviderAPIBroadcastReceiver();
  IntentFilter updateIntentFilter=new IntentFilter(BROADCAST_PROVIDER_API_EVENT);
  updateIntentFilter.addCategory(Intent.CATEGORY_DEFAULT);
  LocalBroadcastManager.getInstance(this).registerReceiver(providerAPIBroadcastReceiver,updateIntentFilter);
  setUpListeners();
  if (savedInstanceState != null) {
    restoreState(savedInstanceState);
  }
  String userMessageString=getIntent().getStringExtra(USER_MESSAGE);
  if (userMessageString != null) {
    userMessage.setText(userMessageString);
    userMessage.setVisibility(VISIBLE);
  }
}

Fixed version (ground truth):
@Override protected void onCreate(@Nullable Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.a_provider_credentials);
  providerAPIBroadcastReceiver=new ProviderAPIBroadcastReceiver();
  IntentFilter updateIntentFilter=new IntentFilter(BROADCAST_PROVIDER_API_EVENT);
  updateIntentFilter.addCategory(Intent.CATEGORY_DEFAULT);
  LocalBroadcastManager.getInstance(this).registerReceiver(providerAPIBroadcastReceiver,updateIntentFilter);
  setUpListeners();
  restoreState(savedInstanceState);
  String userMessageString=getIntent().getStringExtra(USER_MESSAGE);
  if (userMessageString != null) {
    userMessage.setText(userMessageString);
    userMessage.setVisibility(VISIBLE);
  }
}
Program: 109606
Project: 109606
Buggy source:
private void restoreState(Bundle savedInstance){
  if (savedInstance.getString(USER_MESSAGE) != null) {
    userMessage.setText(savedInstance.getString(USER_MESSAGE));
    userMessage.setVisibility(VISIBLE);
  }
  usernameError.setError(savedInstance.getString(USERNAME_ERROR));
  passwordError.setError(savedInstance.getString(PASSWORD_ERROR));
  passwordVerificationError.setError(savedInstance.getString(PASSWORD_VERIFICATION_ERROR));
  if (savedInstance.getString(ACTIVITY_STATE) != null) {
    mConfigState.setAction(savedInstance.getString(ACTIVITY_STATE));
  }
}

Fixed version (ground truth):
protected void restoreState(Bundle savedInstance){
  super.restoreState(savedInstance);
  if (savedInstance == null) {
    return;
  }
  if (savedInstance.getString(USER_MESSAGE) != null) {
    userMessage.setText(savedInstance.getString(USER_MESSAGE));
    userMessage.setVisibility(VISIBLE);
  }
  usernameError.setError(savedInstance.getString(USERNAME_ERROR));
  passwordError.setError(savedInstance.getString(PASSWORD_ERROR));
  passwordVerificationError.setError(savedInstance.getString(PASSWORD_VERIFICATION_ERROR));
  if (savedInstance.getString(ACTIVITY_STATE) != null) {
    mConfigState.setAction(savedInstance.getString(ACTIVITY_STATE));
  }
}
Program: 109607
Project: 109607
Buggy source:
private void restoreState(Bundle savedInstanceState){
  provider=savedInstanceState.getParcelable(Provider.KEY);
  mConfigState.setAction(savedInstanceState.getString(ACTIVITY_STATE,PROVIDER_NOT_SET));
  reasonToFail=savedInstanceState.getString(REASON_TO_FAIL);
  if (reasonToFail != null) {
    showDownloadFailedDialog();
  }
  if (SETTING_UP_PROVIDER.equals(mConfigState.getAction()) || PENDING_SHOW_FAILED_DIALOG.equals(mConfigState.getAction())) {
    showProgressBar();
  }
}

Fixed version (ground truth):
protected void restoreState(Bundle savedInstanceState){
  super.restoreState(savedInstanceState);
  if (savedInstanceState == null) {
    return;
  }
  mConfigState.setAction(savedInstanceState.getString(ACTIVITY_STATE,PROVIDER_NOT_SET));
  if (savedInstanceState.containsKey(REASON_TO_FAIL)) {
    reasonToFail=savedInstanceState.getString(REASON_TO_FAIL);
  }
}
Program: 109608
Project: 109608
Buggy source:
/** 
 * Shows an error dialog, if configuring of a provider failed.
 */
public void showDownloadFailedDialog(){
  try {
    FragmentTransaction fragmentTransaction=fragmentManager.removePreviousFragment(ProviderSetupFailedDialog.TAG);
    DialogFragment newFragment;
    try {
      JSONObject errorJson=new JSONObject(reasonToFail);
      newFragment=ProviderSetupFailedDialog.newInstance(provider,errorJson);
    }
 catch (    JSONException e) {
      e.printStackTrace();
      newFragment=ProviderSetupFailedDialog.newInstance(provider,reasonToFail);
    }
    newFragment.show(fragmentTransaction,ProviderSetupFailedDialog.TAG);
  }
 catch (  IllegalStateException e) {
    e.printStackTrace();
    mConfigState.setAction(PENDING_SHOW_FAILED_DIALOG);
    mConfigState.putExtra(REASON_TO_FAIL,reasonToFail);
  }
}

Fixed version (ground truth):
/** 
 * Shows an error dialog, if configuring of a provider failed.
 */
public void showDownloadFailedDialog(){
  try {
    mConfigState.setAction(SHOW_FAILED_DIALOG);
    FragmentTransaction fragmentTransaction=fragmentManager.removePreviousFragment(ProviderSetupFailedDialog.TAG);
    DialogFragment newFragment;
    try {
      JSONObject errorJson=new JSONObject(reasonToFail);
      newFragment=ProviderSetupFailedDialog.newInstance(provider,errorJson);
    }
 catch (    JSONException e) {
      e.printStackTrace();
      newFragment=ProviderSetupFailedDialog.newInstance(provider,reasonToFail);
    }
catch (    NullPointerException e) {
      return;
    }
    newFragment.show(fragmentTransaction,ProviderSetupFailedDialog.TAG);
  }
 catch (  IllegalStateException e) {
    e.printStackTrace();
    mConfigState.setAction(PENDING_SHOW_FAILED_DIALOG);
  }
}
Program: 109609
Project: 109609
Buggy source:
@Override public void onBackPressed(){
  if (SETTING_UP_PROVIDER.equals(mConfigState.getAction()) || PENDING_SHOW_FAILED_DIALOG.equals(mConfigState.getAction())) {
    stopSettingUpProvider();
  }
 else {
    askDashboardToQuitApp();
    super.onBackPressed();
  }
}

Fixed version (ground truth):
@Override public void onBackPressed(){
  if (SETTING_UP_PROVIDER.equals(mConfigState.getAction()) || SHOW_FAILED_DIALOG.equals(mConfigState.getAction())) {
    stopSettingUpProvider();
  }
 else {
    super.onBackPressed();
  }
}
Program: 109610
Project: 109610
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  fragmentManager=new FragmentManagerEnhanced(getSupportFragmentManager());
  providerManager=ProviderManager.getInstance(getAssets(),getExternalFilesDir(null));
  setUpInitialUI();
  initProviderList();
  if (savedInstanceState != null)   restoreState(savedInstanceState);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  fragmentManager=new FragmentManagerEnhanced(getSupportFragmentManager());
  providerManager=ProviderManager.getInstance(getAssets(),getExternalFilesDir(null));
  setUpInitialUI();
  initProviderList();
  restoreState(savedInstanceState);
}
Program: 109611
Project: 109611
Buggy source:
@Override public void cancelSettingUpProvider(){
  mConfigState.setAction(PROVIDER_NOT_SET);
  hideProgressBar();
}

Fixed version (ground truth):
@Override public void cancelSettingUpProvider(){
  mConfigState.setAction(PROVIDER_NOT_SET);
  provider=null;
  hideProgressBar();
}
Program: 109612
Project: 109612
Buggy source:
@Override public void updateProviderDetails(){
  ProviderAPICommand.execute(this,UPDATE_PROVIDER_DETAILS,provider);
}

Fixed version (ground truth):
@Override public void updateProviderDetails(){
  mConfigState.setAction(SETTING_UP_PROVIDER);
  ProviderAPICommand.execute(this,UPDATE_PROVIDER_DETAILS,provider);
}
Program: 109613
Project: 109613
Buggy source:
@Override protected void onResume(){
  Log.d(TAG,"String_Node_Str" + mConfigState.getAction());
  super.onResume();
  setUpProviderAPIResultReceiver();
  hideProgressBar();
  isActivityShowing=true;
  if (SETTING_UP_PROVIDER.equals(mConfigState.getAction())) {
    showProgressBar();
    checkProviderSetUp();
  }
 else   if (PENDING_SHOW_FAILED_DIALOG.equals(mConfigState.getAction())) {
    showDownloadFailedDialog();
  }
 else   if (SHOWING_PROVIDER_DETAILS.equals(mConfigState.getAction())) {
    cancelAndShowAllProviders();
  }
}

Fixed version (ground truth):
@Override protected void onResume(){
  Log.d(TAG,"String_Node_Str" + mConfigState.getAction());
  super.onResume();
  setUpProviderAPIResultReceiver();
  isActivityShowing=true;
  if (SETTING_UP_PROVIDER.equals(mConfigState.getAction())) {
    showProgressBar();
    checkProviderSetUp();
  }
 else   if (PENDING_SHOW_FAILED_DIALOG.equals(mConfigState.getAction())) {
    showProgressBar();
    showDownloadFailedDialog();
  }
 else   if (SHOW_FAILED_DIALOG.equals(mConfigState.getAction())) {
    showProgressBar();
  }
 else   if (SHOWING_PROVIDER_DETAILS.equals(mConfigState.getAction())) {
    cancelSettingUpProvider();
  }
}
Program: 109614
Project: 109614
Buggy source:
@OnItemClick(R.id.provider_list) void onItemSelected(int position){
  if (SETTING_UP_PROVIDER.equals(mConfigState.getAction()) || PENDING_SHOW_FAILED_DIALOG.equals(mConfigState.getAction())) {
    return;
  }
  provider=adapter.getItem(position);
  if (provider != null && !provider.isDefault()) {
    mConfigState.setAction(SETTING_UP_PROVIDER);
    showProgressBar();
    onItemSelectedLogic();
  }
 else {
    addAndSelectNewProvider();
  }
}

Fixed version (ground truth):
@OnItemClick(R.id.provider_list) void onItemSelected(int position){
  if (SETTING_UP_PROVIDER.equals(mConfigState.getAction()) || SHOW_FAILED_DIALOG.equals(mConfigState.getAction())) {
    return;
  }
  provider=adapter.getItem(position);
  if (provider != null && !provider.isDefault()) {
    mConfigState.setAction(SETTING_UP_PROVIDER);
    showProgressBar();
    onItemSelectedLogic();
  }
 else {
    addAndSelectNewProvider();
  }
}
Program: 109615
Project: 109615
Buggy source:
@Override protected void onSaveInstanceState(@NotNull Bundle outState){
  outState.putString(ACTIVITY_STATE,mConfigState.getAction());
  outState.putParcelable(PROVIDER_KEY,provider);
  DialogFragment dialogFragment=(DialogFragment)fragmentManager.findFragmentByTag(ProviderSetupFailedDialog.TAG);
  if (dialogFragment != null) {
    outState.putString(REASON_TO_FAIL,reasonToFail);
    dialogFragment.dismiss();
  }
  super.onSaveInstanceState(outState);
}

Fixed version (ground truth):
@Override public void onSaveInstanceState(@NotNull Bundle outState){
  outState.putString(ACTIVITY_STATE,mConfigState.getAction());
  outState.putString(REASON_TO_FAIL,reasonToFail);
  super.onSaveInstanceState(outState);
}
Program: 109616
Project: 109616
Buggy source:
@Override @NonNull public Dialog onCreateDialog(Bundle savedInstanceState){
  AlertDialog.Builder builder=new AlertDialog.Builder(getActivity());
  builder.setMessage(reasonToFail).setNegativeButton(R.string.cancel,new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int id){
      interfaceWithConfigurationWizard.cancelSettingUpProvider();
      dialog.dismiss();
    }
  }
);
switch (downloadError) {
case ERROR_CORRUPTED_PROVIDER_JSON:
    builder.setPositiveButton(R.string.update_provider_details,new DialogInterface.OnClickListener(){
      @Override public void onClick(      DialogInterface dialog,      int which){
        dismiss();
        interfaceWithConfigurationWizard.updateProviderDetails();
      }
    }
);
  break;
case ERROR_CERTIFICATE_PINNING:
case ERROR_INVALID_CERTIFICATE:
builder.setPositiveButton(R.string.update_certificate,new DialogInterface.OnClickListener(){
  @Override public void onClick(  DialogInterface dialog,  int which){
    dismiss();
    interfaceWithConfigurationWizard.updateProviderDetails();
  }
}
);
break;
default :
builder.setPositiveButton(R.string.retry,new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog,int id){
dismiss();
interfaceWithConfigurationWizard.retrySetUpProvider(provider);
}
}
);
break;
}
return builder.create();
}

Fixed version (ground truth):
@Override @NonNull public Dialog onCreateDialog(Bundle savedInstanceState){
  AlertDialog.Builder builder=new AlertDialog.Builder(getActivity());
  builder.setMessage(reasonToFail).setNegativeButton(R.string.cancel,new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int id){
      interfaceWithConfigurationWizard.cancelSettingUpProvider();
    }
  }
);
switch (downloadError) {
case ERROR_CORRUPTED_PROVIDER_JSON:
    builder.setPositiveButton(R.string.update_provider_details,new DialogInterface.OnClickListener(){
      @Override public void onClick(      DialogInterface dialog,      int which){
        interfaceWithConfigurationWizard.updateProviderDetails();
      }
    }
);
  break;
case ERROR_CERTIFICATE_PINNING:
case ERROR_INVALID_CERTIFICATE:
builder.setPositiveButton(R.string.update_certificate,new DialogInterface.OnClickListener(){
  @Override public void onClick(  DialogInterface dialog,  int which){
    interfaceWithConfigurationWizard.updateProviderDetails();
  }
}
);
break;
default :
builder.setPositiveButton(R.string.retry,new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog,int id){
interfaceWithConfigurationWizard.retrySetUpProvider(provider);
}
}
);
break;
}
return builder.create();
}
Program: 109617
Project: 109617
Buggy source:
public void onClick(DialogInterface dialog,int id){
  dismiss();
  interfaceWithConfigurationWizard.retrySetUpProvider(provider);
}

Fixed version (ground truth):
public void onClick(DialogInterface dialog,int id){
  interfaceWithConfigurationWizard.retrySetUpProvider(provider);
}
Program: 109618
Project: 109618
Buggy source:
@Override public void retrySetUpProvider(@NonNull Provider provider){
  ProviderAPICommand.execute(this,SET_UP_PROVIDER,provider);
}

Fixed version (ground truth):
@Override public void retrySetUpProvider(@NonNull Provider provider){
  mConfigState.setAction(SETTING_UP_PROVIDER);
  ProviderAPICommand.execute(this,SET_UP_PROVIDER,provider);
}
Program: 109619
Project: 109619
Buggy source:
/** 
 * Fragment managing the behaviors, interactions and presentation of the navigation drawer.
 */
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  setSupportActionBar((Toolbar)findViewById(R.id.toolbar));
  mainActivityBroadcastReceiver=new MainActivityBroadcastReceiver();
  setUpBroadcastReceiver();
  navigationDrawerFragment=(NavigationDrawerFragment)getSupportFragmentManager().findFragmentById(R.id.navigation_drawer);
  preferences=getSharedPreferences(SHARED_PREFERENCES,MODE_PRIVATE);
  provider=ConfigHelper.getSavedProviderFromSharedPreferences(preferences);
  navigationDrawerFragment.setUp(R.id.navigation_drawer,(DrawerLayout)findViewById(R.id.drawer_layout));
  eipStatus=EipStatus.getInstance();
  handleIntentAction(getIntent());
  if (savedInstanceState != null) {
    restoreState(savedInstanceState);
  }
}

Fixed version (ground truth):
/** 
 * Fragment managing the behaviors, interactions and presentation of the navigation drawer.
 */
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  setSupportActionBar((Toolbar)findViewById(R.id.toolbar));
  mainActivityBroadcastReceiver=new MainActivityBroadcastReceiver();
  setUpBroadcastReceiver();
  navigationDrawerFragment=(NavigationDrawerFragment)getSupportFragmentManager().findFragmentById(R.id.navigation_drawer);
  preferences=getSharedPreferences(SHARED_PREFERENCES,MODE_PRIVATE);
  provider=ConfigHelper.getSavedProviderFromSharedPreferences(preferences);
  navigationDrawerFragment.setUp(R.id.navigation_drawer,(DrawerLayout)findViewById(R.id.drawer_layout));
  eipStatus=EipStatus.getInstance();
}
Program: 109620
Project: 109620
Buggy source:
@Override protected void onResume(){
  super.onResume();
  bindOpenVpnService();
  String action=mConfigState.getAction();
  if (action.equalsIgnoreCase(SHOW_DIALOG_STATE)) {
    showDownloadFailedDialog(reasonToFail);
  }
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  bindOpenVpnService();
}
Program: 109621
Project: 109621
Buggy source:
private void handleEIPEvent(int resultCode,Bundle resultData){
  String request=resultData.getString(EIP_REQUEST);
  if (request == null) {
    return;
  }
switch (request) {
case EIP_ACTION_START:
switch (resultCode) {
case RESULT_OK:
      break;
case RESULT_CANCELED:
    String error=resultData.getString(ERRORS);
  if (LeapSRPSession.loggedIn() || provider.allowsAnonymous()) {
    showDownloadFailedDialog(error);
  }
 else {
    askUserToLogIn(getString(vpn_certificate_user_message));
  }
break;
}
break;
case EIP_ACTION_STOP:
switch (resultCode) {
case RESULT_OK:
stop();
break;
case RESULT_CANCELED:
break;
}
break;
}
}

Fixed version (ground truth):
private void handleEIPEvent(int resultCode,Bundle resultData){
  String request=resultData.getString(EIP_REQUEST);
  if (request == null) {
    return;
  }
switch (request) {
case EIP_ACTION_START:
switch (resultCode) {
case RESULT_OK:
      break;
case RESULT_CANCELED:
    String error=resultData.getString(ERRORS);
  if (LeapSRPSession.loggedIn() || provider.allowsAnonymous()) {
    showMainActivityErrorDialog(error);
  }
 else {
    askUserToLogIn(getString(vpn_certificate_user_message));
  }
break;
}
break;
case EIP_ACTION_STOP:
switch (resultCode) {
case RESULT_OK:
stop();
break;
case RESULT_CANCELED:
break;
}
break;
}
}
Program: 109622
Project: 109622
Buggy source:
public void handleProviderApiEvent(int resultCode,Bundle resultData){
switch (resultCode) {
case CORRECTLY_DOWNLOADED_EIP_SERVICE:
    provider=resultData.getParcelable(PROVIDER_KEY);
  EipCommand.startVPN(this);
break;
case INCORRECTLY_DOWNLOADED_EIP_SERVICE:
break;
case CORRECTLY_DOWNLOADED_VPN_CERTIFICATE:
provider=resultData.getParcelable(PROVIDER_KEY);
ConfigHelper.storeProviderInPreferences(preferences,provider);
EipCommand.startVPN(this);
break;
case INCORRECTLY_DOWNLOADED_VPN_CERTIFICATE:
if (LeapSRPSession.loggedIn() || provider.allowsAnonymous()) {
showDownloadFailedDialog(getString(downloading_vpn_certificate_failed));
}
 else {
askUserToLogIn(getString(vpn_certificate_user_message));
}
break;
}
}

Fixed version (ground truth):
public void handleProviderApiEvent(int resultCode,Bundle resultData){
switch (resultCode) {
case CORRECTLY_DOWNLOADED_EIP_SERVICE:
    provider=resultData.getParcelable(PROVIDER_KEY);
  EipCommand.startVPN(this);
break;
case INCORRECTLY_DOWNLOADED_EIP_SERVICE:
break;
case CORRECTLY_DOWNLOADED_VPN_CERTIFICATE:
provider=resultData.getParcelable(PROVIDER_KEY);
ConfigHelper.storeProviderInPreferences(preferences,provider);
EipCommand.startVPN(this);
break;
case INCORRECTLY_DOWNLOADED_VPN_CERTIFICATE:
if (LeapSRPSession.loggedIn() || provider.allowsAnonymous()) {
showMainActivityErrorDialog(getString(downloading_vpn_certificate_failed));
}
 else {
askUserToLogIn(getString(vpn_certificate_user_message));
}
break;
}
}
Program: 109623
Project: 109623
Buggy source:
@Override @NonNull public Dialog onCreateDialog(Bundle savedInstanceState){
  AlertDialog.Builder builder=new AlertDialog.Builder(getActivity());
  builder.setMessage(reasonToFail).setNegativeButton(R.string.cancel,new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int id){
      dialog.dismiss();
      callbackInterface.onDialogDismissed();
    }
  }
);
switch (downloadError) {
case ERROR_INVALID_VPN_CERTIFICATE:
    builder.setPositiveButton(R.string.update_certificate,new DialogInterface.OnClickListener(){
      @Override public void onClick(      DialogInterface dialog,      int which){
        dismiss();
        ProviderAPICommand.execute(getContext(),DOWNLOAD_VPN_CERTIFICATE,provider);
        callbackInterface.onDialogDismissed();
      }
    }
);
  break;
default :
builder.setPositiveButton(R.string.retry,new DialogInterface.OnClickListener(){
  public void onClick(  DialogInterface dialog,  int id){
    dismiss();
    callbackInterface.onDialogDismissed();
  }
}
);
break;
}
return builder.create();
}

Fixed version (ground truth):
@Override @NonNull public Dialog onCreateDialog(Bundle savedInstanceState){
  AlertDialog.Builder builder=new AlertDialog.Builder(getActivity());
  builder.setMessage(reasonToFail).setNegativeButton(R.string.cancel,new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int id){
    }
  }
);
switch (downloadError) {
case ERROR_INVALID_VPN_CERTIFICATE:
    builder.setPositiveButton(R.string.update_certificate,new DialogInterface.OnClickListener(){
      @Override public void onClick(      DialogInterface dialog,      int which){
        ProviderAPICommand.execute(getContext(),DOWNLOAD_VPN_CERTIFICATE,provider);
      }
    }
);
  break;
default :
break;
}
return builder.create();
}