Program: 117938
Project: 117938
Buggy source:
public static List<IComponent> filterNeededComponents(Item item,ERepositoryObjectType type){
  EDatabaseComponentName name=EDatabaseComponentName.getCorrespondingComponentName(item,type);
  String productNameWanted=filterProductNameWanted(name,item);
  boolean hl7Related=false;
  boolean hl7Output=false;
  if (item instanceof HL7ConnectionItem) {
    hl7Related=true;
    EList list=((HL7Connection)((HL7ConnectionItem)item).getConnection()).getRoot();
    if (list != null && list.size() > 0) {
      hl7Output=true;
    }
  }
  Set<IComponent> components=ComponentsFactoryProvider.getInstance().getComponents();
  List<IComponent> neededComponents=new ArrayList<IComponent>();
  EmfComponent emfComponent=null;
  for (  IComponent component : components) {
    if (component instanceof EmfComponent) {
      emfComponent=(EmfComponent)component;
      String componentProductname=emfComponent.getRepositoryType();
      boolean value=true;
      if (type == ERepositoryObjectType.METADATA_CON_TABLE) {
        if (emfComponent.getName().toUpperCase().endsWith(MAP)) {
          value=false;
        }
      }
      if (hl7Output && !component.getName().equals("String_Node_Str")) {
        value=false;
      }
 else       if (hl7Related && !hl7Output && !component.getName().equals("String_Node_Str")) {
        value=false;
      }
      boolean flag=filterComponent(component,name,type);
      if (((componentProductname != null && productNameWanted.endsWith(componentProductname)) && value) || flag) {
        neededComponents.add(emfComponent);
      }
    }
  }
  return sortFilteredComponnents(item,type,neededComponents);
}

Fixed version (ground truth):
public static List<IComponent> filterNeededComponents(Item item,ERepositoryObjectType type){
  EDatabaseComponentName name=EDatabaseComponentName.getCorrespondingComponentName(item,type);
  String productNameWanted=filterProductNameWanted(name,item);
  boolean hl7Related=false;
  boolean hl7Output=false;
  if (item instanceof HL7ConnectionItem) {
    hl7Related=true;
    EList list=((HL7Connection)((HL7ConnectionItem)item).getConnection()).getRoot();
    if (list != null && list.size() > 0) {
      hl7Output=true;
    }
  }
  Collection<IComponent> components=ComponentsFactoryProvider.getInstance().readComponents();
  List<IComponent> neededComponents=new ArrayList<IComponent>();
  EmfComponent emfComponent=null;
  for (  IComponent component : components) {
    if (component instanceof EmfComponent) {
      emfComponent=(EmfComponent)component;
      String componentProductname=emfComponent.getRepositoryType();
      boolean value=true;
      if (type == ERepositoryObjectType.METADATA_CON_TABLE) {
        if (emfComponent.getName().toUpperCase().endsWith(MAP)) {
          value=false;
        }
      }
      if (hl7Output && !component.getName().equals("String_Node_Str")) {
        value=false;
      }
 else       if (hl7Related && !hl7Output && !component.getName().equals("String_Node_Str")) {
        value=false;
      }
      boolean flag=filterComponent(component,name,type);
      if (((componentProductname != null && productNameWanted.endsWith(componentProductname)) && value) || flag) {
        neededComponents.add(emfComponent);
      }
    }
  }
  return sortFilteredComponnents(item,type,neededComponents);
}