Program: 123703
Project: 123703
Buggy source:
/** 
 * Create the "Shapes" drawer. 
 */
private static void createComponentsDrawer(final IComponentsFactory compFac,boolean needHiddenComponent,boolean isFavorite,int a){
  clearGroup();
  LinkedList<CreationToolEntry> nodeList=new LinkedList<CreationToolEntry>();
  PaletteDrawer componentsDrawer;
  String name, longName;
  String family;
  String oraFamily;
  List<String> families=new ArrayList<String>();
  HashMap<String,String> familyMap=new HashMap<String,String>();
  boolean favoriteFlag;
  List listName=new ArrayList();
  CombinedTemplateCreationEntry component;
  Hashtable<String,PaletteDrawer> ht=new Hashtable<String,PaletteDrawer>();
  paletteState=isFavorite;
  if (a == 0) {
    componentsDrawer=new PaletteDrawer(Messages.getString("String_Node_Str"));
  }
  List<IComponent> componentList=new ArrayList<IComponent>(compFac.getComponents());
  IProcess process=ActiveProcessTracker.getCurrentProcess();
  ERepositoryObjectType type=null;
  if (process != null && process instanceof IProcess2 && ((IProcess2)process).getProperty() != null) {
    type=ERepositoryObjectType.getItemType(((IProcess2)process).getProperty().getItem());
  }
  if (type == null) {
    return;
  }
  Iterator<IComponent> iterator=componentList.iterator();
  while (iterator.hasNext()) {
    IComponent comp=iterator.next();
    if (!ArrayUtils.contains(type.getProducts(),comp.getPaletteType())) {
      iterator.remove();
    }
  }
  Collections.sort(componentList,new Comparator<IComponent>(){
    public int compare(    IComponent component1,    IComponent component2){
      return component1.getName().compareTo(component2.getName());
    }
  }
);
  for (int i=0; i < componentList.size(); i++) {
    IComponent xmlComponent=componentList.get(i);
    if (xmlComponent.isTechnical()) {
      continue;
    }
    if (xmlComponent.isLoaded()) {
      family=xmlComponent.getTranslatedFamilyName();
      oraFamily=xmlComponent.getOriginalFamilyName();
      String[] strings=family.split(ComponentsFactoryProvider.FAMILY_SEPARATOR_REGEX);
      String[] oraStrings=oraFamily.split(ComponentsFactoryProvider.FAMILY_SEPARATOR_REGEX);
      for (int j=0; j < strings.length; j++) {
        if (!needHiddenComponent && !xmlComponent.isVisible(oraStrings[j])) {
          continue;
        }
        String key=null;
        key=xmlComponent.getName() + "String_Node_Str" + oraStrings[j];
        if (a == 0) {
          if (!oraStrings[j].equals("String_Node_Str")) {
            if (isFavorite && !DesignerPlugin.getDefault().getPreferenceStore().getBoolean(key)) {
              continue;
            }
          }
        }
        families.add(strings[j]);
        familyMap.put(strings[j],oraStrings[j]);
      }
    }
  }
  Collections.sort(families);
  if (a == 0) {
    for (Iterator iter=families.iterator(); iter.hasNext(); ) {
      family=(String)iter.next();
      String oraFam=familyMap.get(family);
      componentsDrawer=ht.get(family);
      if (componentsDrawer == null) {
        componentsDrawer=createComponentDrawer(ht,family);
        if (componentsDrawer instanceof IPaletteFilter) {
          ((IPaletteFilter)componentsDrawer).setOriginalName(oraFam);
        }
      }
    }
  }
  boolean noteAeeded=false;
  boolean needAddNote=true;
  boolean needToAdd=false;
  for (int i=0; i < componentList.size(); i++) {
    IComponent xmlComponent=componentList.get(i);
    if (xmlComponent.isTechnical()) {
      continue;
    }
    family=xmlComponent.getTranslatedFamilyName();
    oraFamily=xmlComponent.getOriginalFamilyName();
    if (filter != null && !filter.contains("String_Node_Str") && !filter.contains("String_Node_Str") && !filter.contains("String_Node_Str") && !filter.contains("String_Node_Str")) {
      String regex=getFilterRegex();
      needAddNote="String_Node_Str".toLowerCase().matches(regex);
    }
    if ((oraFamily.equals("String_Node_Str") || oraFamily.equals("String_Node_Str")) && !noteAeeded && needAddNote) {
      CreationToolEntry noteCreationToolEntry=new CreationToolEntry(Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"),new NoteCreationFactory(),ImageProvider.getImageDesc(ECoreImage.CODE_ICON),ImageProvider.getImageDesc(ECoreImage.CODE_ICON));
      if (a == 0) {
        PaletteDrawer drawer=ht.get(family);
        if (drawer != null) {
          noteCreationToolEntry.setParent(drawer);
          drawer.add(noteCreationToolEntry);
        }
      }
 else       if ((a == 1)) {
        for (        String s : families) {
          if (s.equals(family)) {
            needToAdd=true;
          }
        }
        if (needToAdd == true)         nodeList.add(0,noteCreationToolEntry);
      }
      noteAeeded=true;
    }
    if (filter != null && !filter.contains("String_Node_Str") && !filter.contains("String_Node_Str") && !filter.contains("String_Node_Str") && !filter.contains("String_Node_Str")) {
      String regex=getFilterRegex();
      if (!xmlComponent.getName().toLowerCase().matches(regex) && !xmlComponent.getLongName().toLowerCase().matches(regex)) {
        continue;
      }
    }
    if (!needHiddenComponent && !xmlComponent.isVisible()) {
      continue;
    }
    family=xmlComponent.getTranslatedFamilyName();
    oraFamily=xmlComponent.getOriginalFamilyName();
    String[] keys=family.split(ComponentsFactoryProvider.FAMILY_SEPARATOR_REGEX);
    String[] oraKeys=oraFamily.split(ComponentsFactoryProvider.FAMILY_SEPARATOR_REGEX);
    for (int j=0; j < keys.length; j++) {
      String key=null;
      key=xmlComponent.getName() + "String_Node_Str" + oraKeys[j];
      if (isFavorite && !DesignerPlugin.getDefault().getPreferenceStore().getBoolean(key)) {
        continue;
      }
    }
    if (xmlComponent.isLoaded()) {
      name=xmlComponent.getName();
      longName=xmlComponent.getLongName();
      ImageDescriptor imageSmall=xmlComponent.getIcon16();
      IPreferenceStore store=DesignerPlugin.getDefault().getPreferenceStore();
      ImageDescriptor imageLarge;
      final String string=store.getString(TalendDesignerPrefConstants.LARGE_ICONS_SIZE);
      if (string.equals("String_Node_Str")) {
        imageLarge=xmlComponent.getIcon24();
      }
 else {
        imageLarge=xmlComponent.getIcon32();
      }
      String[] strings=family.split(ComponentsFactoryProvider.FAMILY_SEPARATOR_REGEX);
      String[] oraStrings=oraFamily.split(ComponentsFactoryProvider.FAMILY_SEPARATOR_REGEX);
      for (int j=0; j < strings.length; j++) {
        if (!needHiddenComponent && !xmlComponent.isVisible(oraStrings[j])) {
          continue;
        }
        String key=null;
        key=xmlComponent.getName() + "String_Node_Str" + oraStrings[j];
        if (isFavorite && !DesignerPlugin.getDefault().getPreferenceStore().getBoolean(key)) {
          continue;
        }
        component=new CombinedTemplateCreationEntry(name,name,Node.class,new PaletteComponentFactory(xmlComponent),imageSmall,imageLarge);
        component.setDescription(longName);
        if (a == 0) {
          componentsDrawer=ht.get(strings[j]);
          component.setParent(componentsDrawer);
          componentsDrawer.add(component);
        }
 else         if (a == 1) {
          boolean canAdd=true;
          for (int z=0; z < nodeList.size(); z++) {
            if ((nodeList.get(z).getLabel()).equals(component.getLabel())) {
              canAdd=false;
            }
          }
          if (canAdd == true) {
            nodeList.add(component);
          }
        }
      }
    }
  }
  if (a == 1) {
    for (    CreationToolEntry entryComponent : nodeList) {
      entryComponent.setParent(paGroup);
      paGroup.add(entryComponent);
    }
    palette.add(paGroup);
  }
  setFilter("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Create the "Shapes" drawer. 
 */
private static void createComponentsDrawer(final IComponentsFactory compFac,boolean needHiddenComponent,boolean isFavorite,int a){
  clearGroup();
  LinkedList<CreationToolEntry> nodeList=new LinkedList<CreationToolEntry>();
  PaletteDrawer componentsDrawer;
  String name, longName;
  String family;
  String oraFamily;
  List<String> families=new ArrayList<String>();
  HashMap<String,String> familyMap=new HashMap<String,String>();
  boolean favoriteFlag;
  List listName=new ArrayList();
  CombinedTemplateCreationEntry component;
  Hashtable<String,PaletteDrawer> ht=new Hashtable<String,PaletteDrawer>();
  paletteState=isFavorite;
  if (a == 0) {
    componentsDrawer=new PaletteDrawer(Messages.getString("String_Node_Str"));
  }
  List<IComponent> componentList=new ArrayList<IComponent>(compFac.getComponents());
  IProcess process=ActiveProcessTracker.getCurrentProcess();
  ERepositoryObjectType type=null;
  if (process != null && process instanceof IProcess2 && ((IProcess2)process).getProperty() != null) {
    type=ERepositoryObjectType.getItemType(((IProcess2)process).getProperty().getItem());
  }
  if (type == null) {
    return;
  }
  Iterator<IComponent> iterator=componentList.iterator();
  while (iterator.hasNext()) {
    IComponent comp=iterator.next();
    if (!ArrayUtils.contains(type.getProducts(),comp.getPaletteType())) {
      iterator.remove();
    }
  }
  Collections.sort(componentList,new Comparator<IComponent>(){
    public int compare(    IComponent component1,    IComponent component2){
      return component1.getName().compareTo(component2.getName());
    }
  }
);
  for (int i=0; i < componentList.size(); i++) {
    IComponent xmlComponent=componentList.get(i);
    if (xmlComponent.isTechnical()) {
      continue;
    }
    if (xmlComponent.isLoaded()) {
      family=xmlComponent.getTranslatedFamilyName();
      oraFamily=xmlComponent.getOriginalFamilyName();
      String[] strings=family.split(ComponentsFactoryProvider.FAMILY_SEPARATOR_REGEX);
      String[] oraStrings=oraFamily.split(ComponentsFactoryProvider.FAMILY_SEPARATOR_REGEX);
      for (int j=0; j < strings.length; j++) {
        if (!needHiddenComponent && !xmlComponent.isVisible(oraStrings[j])) {
          continue;
        }
        String key=null;
        key=xmlComponent.getName() + "String_Node_Str" + oraStrings[j];
        if (a == 0) {
          if (!oraStrings[j].equals("String_Node_Str")) {
            if (isFavorite && !DesignerPlugin.getDefault().getPreferenceStore().getBoolean(key)) {
              continue;
            }
          }
        }
        families.add(strings[j]);
        familyMap.put(strings[j],oraStrings[j]);
      }
    }
  }
  Collections.sort(families);
  if (a == 0) {
    for (Iterator iter=families.iterator(); iter.hasNext(); ) {
      family=(String)iter.next();
      String oraFam=familyMap.get(family);
      componentsDrawer=ht.get(family);
      if (componentsDrawer == null) {
        componentsDrawer=createComponentDrawer(ht,family);
        if (componentsDrawer instanceof IPaletteFilter) {
          ((IPaletteFilter)componentsDrawer).setOriginalName(oraFam);
        }
      }
    }
  }
  boolean noteAeeded=false;
  boolean needAddNote=true;
  boolean needToAdd=false;
  for (int i=0; i < componentList.size(); i++) {
    IComponent xmlComponent=componentList.get(i);
    if (xmlComponent.isTechnical()) {
      continue;
    }
    family=xmlComponent.getTranslatedFamilyName();
    oraFamily=xmlComponent.getOriginalFamilyName();
    if (filter != null) {
      Pattern pattern=Pattern.compile("String_Node_Str");
      Matcher matcher=pattern.matcher(filter);
      if (matcher.matches()) {
        String regex=getFilterRegex();
        needAddNote="String_Node_Str".toLowerCase().matches(regex);
      }
    }
    if ((oraFamily.equals("String_Node_Str") || oraFamily.equals("String_Node_Str")) && !noteAeeded && needAddNote) {
      CreationToolEntry noteCreationToolEntry=new CreationToolEntry(Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"),new NoteCreationFactory(),ImageProvider.getImageDesc(ECoreImage.CODE_ICON),ImageProvider.getImageDesc(ECoreImage.CODE_ICON));
      if (a == 0) {
        PaletteDrawer drawer=ht.get(family);
        if (drawer != null) {
          noteCreationToolEntry.setParent(drawer);
          drawer.add(noteCreationToolEntry);
        }
      }
 else       if ((a == 1)) {
        for (        String s : families) {
          if (s.equals(family)) {
            needToAdd=true;
          }
        }
        if (needToAdd == true)         nodeList.add(0,noteCreationToolEntry);
      }
      noteAeeded=true;
    }
    if (filter != null) {
      Pattern pattern=Pattern.compile("String_Node_Str");
      Matcher matcher=pattern.matcher(filter);
      if (matcher.matches()) {
        String regex=getFilterRegex();
        if (!xmlComponent.getName().toLowerCase().matches(regex) && !xmlComponent.getLongName().toLowerCase().matches(regex)) {
          continue;
        }
      }
    }
    if (!needHiddenComponent && !xmlComponent.isVisible()) {
      continue;
    }
    family=xmlComponent.getTranslatedFamilyName();
    oraFamily=xmlComponent.getOriginalFamilyName();
    String[] keys=family.split(ComponentsFactoryProvider.FAMILY_SEPARATOR_REGEX);
    String[] oraKeys=oraFamily.split(ComponentsFactoryProvider.FAMILY_SEPARATOR_REGEX);
    for (int j=0; j < keys.length; j++) {
      String key=null;
      key=xmlComponent.getName() + "String_Node_Str" + oraKeys[j];
      if (isFavorite && !DesignerPlugin.getDefault().getPreferenceStore().getBoolean(key)) {
        continue;
      }
    }
    if (xmlComponent.isLoaded()) {
      name=xmlComponent.getName();
      longName=xmlComponent.getLongName();
      ImageDescriptor imageSmall=xmlComponent.getIcon16();
      IPreferenceStore store=DesignerPlugin.getDefault().getPreferenceStore();
      ImageDescriptor imageLarge;
      final String string=store.getString(TalendDesignerPrefConstants.LARGE_ICONS_SIZE);
      if (string.equals("String_Node_Str")) {
        imageLarge=xmlComponent.getIcon24();
      }
 else {
        imageLarge=xmlComponent.getIcon32();
      }
      String[] strings=family.split(ComponentsFactoryProvider.FAMILY_SEPARATOR_REGEX);
      String[] oraStrings=oraFamily.split(ComponentsFactoryProvider.FAMILY_SEPARATOR_REGEX);
      for (int j=0; j < strings.length; j++) {
        if (!needHiddenComponent && !xmlComponent.isVisible(oraStrings[j])) {
          continue;
        }
        String key=null;
        key=xmlComponent.getName() + "String_Node_Str" + oraStrings[j];
        if (isFavorite && !DesignerPlugin.getDefault().getPreferenceStore().getBoolean(key)) {
          continue;
        }
        component=new CombinedTemplateCreationEntry(name,name,Node.class,new PaletteComponentFactory(xmlComponent),imageSmall,imageLarge);
        component.setDescription(longName);
        if (a == 0) {
          componentsDrawer=ht.get(strings[j]);
          component.setParent(componentsDrawer);
          componentsDrawer.add(component);
        }
 else         if (a == 1) {
          boolean canAdd=true;
          for (int z=0; z < nodeList.size(); z++) {
            if ((nodeList.get(z).getLabel()).equals(component.getLabel())) {
              canAdd=false;
            }
          }
          if (canAdd == true) {
            nodeList.add(component);
          }
        }
      }
    }
  }
  if (a == 1) {
    for (    CreationToolEntry entryComponent : nodeList) {
      entryComponent.setParent(paGroup);
      paGroup.add(entryComponent);
    }
    palette.add(paGroup);
  }
  setFilter("String_Node_Str");
}