Program: 29053
Project: 29053
Buggy source:
@Override public BeanDeploymentArchive loadBeanDeploymentArchive(Class<?> beanClass){
  logger.log(FINE,"String_Node_Str" + beanClass);
  List<BeanDeploymentArchive> beanDeploymentArchives=getBeanDeploymentArchives();
  ListIterator<BeanDeploymentArchive> lIter=beanDeploymentArchives.listIterator();
  while (lIter.hasNext()) {
    BeanDeploymentArchive bda=lIter.next();
    logger.log(FINE,"String_Node_Str" + beanClass + "String_Node_Str"+ bda.getId());
    if (((BeanDeploymentArchiveImpl)bda).getModuleBeanClassObjects().contains(beanClass)) {
      logger.log(FINE,"String_Node_Str" + "String_Node_Str" + beanClass.getName() + "String_Node_Str"+ "String_Node_Str"+ bda);
      logger.log(FINE,"String_Node_Str" + bda);
      return bda;
    }
    if (bda.getBeanDeploymentArchives().size() > 0) {
      for (      BeanDeploymentArchive subBda : bda.getBeanDeploymentArchives()) {
        Collection<Class<?>> moduleBeanClasses=((BeanDeploymentArchiveImpl)subBda).getModuleBeanClassObjects();
        logger.log(FINE,"String_Node_Str" + beanClass + "String_Node_Str"+ subBda.getId());
        boolean match=moduleBeanClasses.contains(beanClass);
        if (match) {
          logger.log(FINE,"String_Node_Str" + "String_Node_Str" + beanClass.getName() + "String_Node_Str"+ "String_Node_Str"+ subBda);
          logger.log(FINE,"String_Node_Str" + subBda);
          return subBda;
        }
      }
    }
  }
  logger.log(FINE,"String_Node_Str" + beanClass + "String_Node_Str"+ "String_Node_Str");
  List<Class<?>> beanClasses=new ArrayList<Class<?>>();
  Set<URI> beanXMLUris=new CopyOnWriteArraySet<URI>();
  Set<EjbDescriptor> ejbs=new HashSet<EjbDescriptor>();
  beanClasses.add(beanClass);
  WeldGFExtension gfExtension=beanClass.getAnnotation(WeldGFExtension.class);
  if (gfExtension != null)   beanClasses.addAll(java.util.Arrays.asList(gfExtension.beans()));
  BeanDeploymentArchive newBda=new BeanDeploymentArchiveImpl(beanClass.getName(),beanClasses,beanXMLUris,ejbs,context);
  logger.log(FINE,"String_Node_Str" + newBda + "String_Node_Str"+ "String_Node_Str");
  lIter=beanDeploymentArchives.listIterator();
  while (lIter.hasNext()) {
    BeanDeploymentArchive bda=lIter.next();
    bda.getBeanDeploymentArchives().add(newBda);
  }
  logger.log(FINE,"String_Node_Str" + beanClass + "String_Node_Str"+ "String_Node_Str"+ newBda);
  return newBda;
}

Fixed version (ground truth):
@Override public BeanDeploymentArchive loadBeanDeploymentArchive(Class<?> beanClass){
  logger.log(FINE,"String_Node_Str" + beanClass);
  List<BeanDeploymentArchive> beanDeploymentArchives=getBeanDeploymentArchives();
  ListIterator<BeanDeploymentArchive> lIter=beanDeploymentArchives.listIterator();
  while (lIter.hasNext()) {
    BeanDeploymentArchive bda=lIter.next();
    logger.log(FINE,"String_Node_Str" + beanClass + "String_Node_Str"+ bda.getId());
    if (((BeanDeploymentArchiveImpl)bda).getModuleBeanClassObjects().contains(beanClass)) {
      logger.log(FINE,"String_Node_Str" + "String_Node_Str" + beanClass.getName() + "String_Node_Str"+ "String_Node_Str"+ bda);
      logger.log(FINE,"String_Node_Str" + bda);
      return bda;
    }
    if (bda.getBeanDeploymentArchives().size() > 0) {
      for (      BeanDeploymentArchive subBda : bda.getBeanDeploymentArchives()) {
        Collection<Class<?>> moduleBeanClasses=((BeanDeploymentArchiveImpl)subBda).getModuleBeanClassObjects();
        logger.log(FINE,"String_Node_Str" + beanClass + "String_Node_Str"+ subBda.getId());
        boolean match=moduleBeanClasses.contains(beanClass);
        if (match) {
          logger.log(FINE,"String_Node_Str" + "String_Node_Str" + beanClass.getName() + "String_Node_Str"+ "String_Node_Str"+ subBda);
          logger.log(FINE,"String_Node_Str" + subBda);
          return subBda;
        }
      }
    }
  }
  logger.log(FINE,"String_Node_Str" + beanClass + "String_Node_Str"+ "String_Node_Str");
  List<Class<?>> beanClasses=new ArrayList<Class<?>>();
  List<URL> beanXMLUrls=new CopyOnWriteArrayList<URL>();
  Set<EjbDescriptor> ejbs=new HashSet<EjbDescriptor>();
  beanClasses.add(beanClass);
  WeldGFExtension gfExtension=beanClass.getAnnotation(WeldGFExtension.class);
  if (gfExtension != null)   beanClasses.addAll(java.util.Arrays.asList(gfExtension.beans()));
  BeanDeploymentArchive newBda=new BeanDeploymentArchiveImpl(beanClass.getName(),beanClasses,beanXMLUrls,ejbs,context);
  logger.log(FINE,"String_Node_Str" + newBda + "String_Node_Str"+ "String_Node_Str");
  lIter=beanDeploymentArchives.listIterator();
  while (lIter.hasNext()) {
    BeanDeploymentArchive bda=lIter.next();
    bda.getBeanDeploymentArchives().add(newBda);
  }
  logger.log(FINE,"String_Node_Str" + beanClass + "String_Node_Str"+ "String_Node_Str"+ newBda);
  return newBda;
}