Program: 125327
Project: 125327
Buggy source:
private static List<ModuleNeeded> getModulesNeededForComponents(){
  initCache();
  if (isCreated) {
    List<ModuleNeeded> importNeedsList=new ArrayList<ModuleNeeded>();
    ComponentsCache cache=ComponentManager.getComponentCache();
    EMap<String,EList<ComponentInfo>> map=cache.getComponentEntryMap();
    Set<String> set=map.keySet();
    Iterator it=set.iterator();
    Map<String,Boolean> bundlesAvailable=new HashMap<String,Boolean>();
    while (it.hasNext()) {
      String key=(String)it.next();
      EList<ComponentInfo> value=map.get(key);
      for (      ComponentInfo info : value) {
        Boolean available=bundlesAvailable.get(info.getSourceBundleName());
        if (available == null) {
          available=Platform.getBundle(info.getSourceBundleName()) != null;
          bundlesAvailable.put(info.getSourceBundleName(),available);
        }
        if (!available) {
          continue;
        }
        EList emfImportList=info.getImportType();
        for (int i=0; i < emfImportList.size(); i++) {
          IMPORTType importType=(IMPORTType)emfImportList.get(i);
          collectModuleNeeded(key,importType,importNeedsList);
        }
      }
    }
    return importNeedsList;
  }
 else {
    List<ModuleNeeded> importNeedsList=new ArrayList<ModuleNeeded>();
    if (GlobalServiceRegister.getDefault().isServiceRegistered(IComponentsService.class)) {
      IComponentsService service=(IComponentsService)GlobalServiceRegister.getDefault().getService(IComponentsService.class);
      IComponentsFactory compFac=service.getComponentsFactory();
      Set<IComponent> componentList=compFac.getComponents();
      for (      IComponent comp : componentList.toArray(new IComponent[0])) {
        importNeedsList.addAll(comp.getModulesNeeded());
      }
    }
    return importNeedsList;
  }
}

Fixed version (ground truth):
private static List<ModuleNeeded> getModulesNeededForComponents(){
  initCache();
  if (isCreated) {
    List<ModuleNeeded> importNeedsList=new ArrayList<ModuleNeeded>();
    ComponentsCache cache=ComponentManager.getComponentCache();
    EMap<String,EList<ComponentInfo>> map=cache.getComponentEntryMap();
    Set<String> set=map.keySet();
    Iterator it=set.iterator();
    Map<String,Boolean> bundlesAvailable=new HashMap<String,Boolean>();
    while (it.hasNext()) {
      String key=(String)it.next();
      EList<ComponentInfo> value=map.get(key);
      for (      ComponentInfo info : value) {
        Boolean available=bundlesAvailable.get(info.getSourceBundleName());
        if (available == null) {
          available=Platform.getBundle(info.getSourceBundleName()) != null;
          bundlesAvailable.put(info.getSourceBundleName(),available);
        }
        if (!available) {
          continue;
        }
        EList emfImportList=info.getImportType();
        for (int i=0; i < emfImportList.size(); i++) {
          IMPORTType importType=(IMPORTType)emfImportList.get(i);
          collectModuleNeeded(key,importType,importNeedsList);
        }
      }
    }
    return importNeedsList;
  }
 else {
    List<ModuleNeeded> importNeedsList=new ArrayList<ModuleNeeded>();
    if (GlobalServiceRegister.getDefault().isServiceRegistered(IComponentsService.class)) {
      IComponentsService service=(IComponentsService)GlobalServiceRegister.getDefault().getService(IComponentsService.class);
      IComponentsFactory compFac=service.getComponentsFactory();
      for (      IComponent comp : compFac.readComponents()) {
        importNeedsList.addAll(comp.getModulesNeeded());
      }
    }
    return importNeedsList;
  }
}