Program: 124099
Project: 124099
Buggy source:
public static List<IComponent> filterNeededComponents(Item item,RepositoryNode seletetedNode,ERepositoryObjectType type){
  EDatabaseComponentName name=EDatabaseComponentName.getCorrespondingComponentName(item,type);
  List<IComponent> neededComponents=new ArrayList<IComponent>();
  if (name == null) {
    return neededComponents;
  }
  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;
    }
  }
  MdmConceptType mdmType=null;
  if (item instanceof MDMConnectionItem) {
    MDMConnectionItem mdmItem=(MDMConnectionItem)item;
    if (seletetedNode != null && seletetedNode.getObject() instanceof MetadataTableRepositoryObject) {
      MetadataTableRepositoryObject object=(MetadataTableRepositoryObject)seletetedNode.getObject();
      if (mdmItem.getConnection() instanceof MDMConnection) {
        MDMConnection connection=(MDMConnection)mdmItem.getConnection();
        for (        Object obj : connection.getSchemas()) {
          if (obj instanceof Concept && object.getLabel().equals(((Concept)obj).getLabel())) {
            mdmType=((Concept)obj).getConceptType();
          }
        }
      }
    }
  }
  Set<IComponent> components=ComponentsFactoryProvider.getInstance().getComponents();
  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) {
        if (item instanceof MDMConnectionItem) {
          if (MdmConceptType.INPUT.equals(mdmType) && emfComponent.getName().endsWith(INPUT)) {
            neededComponents.add(emfComponent);
          }
 else           if (MdmConceptType.OUTPUT.equals(mdmType) && emfComponent.getName().endsWith(OUTPUT)) {
            neededComponents.add(emfComponent);
          }
 else           if (MdmConceptType.RECEIVE.equals(mdmType) && emfComponent.getName().endsWith(RECEIVE)) {
            neededComponents.add(emfComponent);
          }
        }
 else {
          neededComponents.add(emfComponent);
        }
      }
    }
  }
  return sortFilteredComponnents(item,seletetedNode,type,neededComponents);
}

Fixed version (ground truth):
public static List<IComponent> filterNeededComponents(Item item,RepositoryNode seletetedNode,ERepositoryObjectType type){
  EDatabaseComponentName name=EDatabaseComponentName.getCorrespondingComponentName(item,type);
  List<IComponent> neededComponents=new ArrayList<IComponent>();
  if (name == null) {
    return neededComponents;
  }
  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;
    }
  }
  MdmConceptType mdmType=null;
  if (item instanceof MDMConnectionItem) {
    MDMConnectionItem mdmItem=(MDMConnectionItem)item;
    if (seletetedNode != null && seletetedNode.getObject() instanceof MetadataTableRepositoryObject) {
      MetadataTableRepositoryObject object=(MetadataTableRepositoryObject)seletetedNode.getObject();
      if (mdmItem.getConnection() instanceof MDMConnection) {
        MDMConnection connection=(MDMConnection)mdmItem.getConnection();
        for (        Object obj : connection.getSchemas()) {
          if (obj instanceof Concept && object.getLabel().equals(((Concept)obj).getLabel())) {
            mdmType=((Concept)obj).getConceptType();
          }
        }
      }
    }
  }
  Set<IComponent> components=ComponentsFactoryProvider.getInstance().getComponents();
  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) {
        Pattern pattern=Pattern.compile("String_Node_Str",Pattern.CASE_INSENSITIVE);
        if (pattern.matcher(name.getDBType()).matches() && (emfComponent.getName().equals("String_Node_Str") || emfComponent.getName().equals("String_Node_Str"))) {
          continue;
        }
        if (item instanceof MDMConnectionItem) {
          if (MdmConceptType.INPUT.equals(mdmType) && emfComponent.getName().endsWith(INPUT)) {
            neededComponents.add(emfComponent);
          }
 else           if (MdmConceptType.OUTPUT.equals(mdmType) && emfComponent.getName().endsWith(OUTPUT)) {
            neededComponents.add(emfComponent);
          }
 else           if (MdmConceptType.RECEIVE.equals(mdmType) && emfComponent.getName().endsWith(RECEIVE)) {
            neededComponents.add(emfComponent);
          }
        }
 else {
          neededComponents.add(emfComponent);
        }
      }
    }
  }
  return sortFilteredComponnents(item,seletetedNode,type,neededComponents);
}