Program: 122490
Project: 122490
Buggy source:
private void loadComponentsFromFolder(String pathSource,AbstractComponentsProvider provider){
  if (pathSource != null) {
    Path userComponent=new Path(pathSource);
    Path templatePath=new Path(IComponentsFactory.COMPONENTS_INNER_FOLDER + File.separatorChar + IComponentsFactory.EXTERNAL_COMPONENTS_INNER_FOLDER+ File.separatorChar+ ComponentUtilities.getExtFolder(OLD_COMPONENTS_USER_INNER_FOLDER));
    if (userComponent.equals(templatePath)) {
      this.userComponentList=new ArrayList<IComponent>();
    }
  }
  boolean isCustom=false;
  if ("String_Node_Str".equals(provider.getId()) || "String_Node_Str".equals(provider.getId())) {
    isCustom=true;
  }
  File source;
  try {
    source=provider.getInstallationFolder();
  }
 catch (  IOException e1) {
    ExceptionHandler.process(e1);
    return;
  }
  File[] childDirectories;
  FileFilter fileFilter=new FileFilter(){
    public boolean accept(    final File file){
      return file.isDirectory() && file.getName().charAt(0) != '.' && !file.getName().equals(IComponentsFactory.EXTERNAL_COMPONENTS_INNER_FOLDER) && isComponentVisible(file.getName());
    }
  }
;
  if (source == null) {
    ExceptionHandler.process(new Exception(Messages.getString("String_Node_Str") + pathSource));
    return;
  }
  childDirectories=source.listFiles(fileFilter);
  IBrandingService service=(IBrandingService)GlobalServiceRegister.getDefault().getService(IBrandingService.class);
  String[] availableComponents=service.getBrandingConfiguration().getAvailableComponents();
  FileFilter skeletonFilter=new FileFilter(){
    public boolean accept(    final File file){
      String fileName=file.getName();
      return file.isFile() && fileName.charAt(0) != '.' && (fileName.endsWith(SKELETON_SUFFIX) || fileName.endsWith(INCLUDEFILEINJET_SUFFIX));
    }
  }
;
  BundleContext context=null;
  if (Platform.getProduct() != null) {
    final Bundle definingBundle=Platform.getProduct().getDefiningBundle();
    if (definingBundle != null) {
      context=definingBundle.getBundleContext();
    }
  }
  if (context == null) {
    context=CodeGeneratorActivator.getDefault().getBundle().getBundleContext();
  }
  ServiceReference sref=context.getServiceReference(PackageAdmin.class.getName());
  PackageAdmin admin=(PackageAdmin)context.getService(sref);
  if (childDirectories != null) {
    if (monitor != null) {
      this.subMonitor=SubMonitor.convert(monitor,Messages.getString("String_Node_Str"),childDirectories.length);
    }
    if (skeletonList != null) {
      skeletonList.ensureCapacity(childDirectories.length);
      for (      File currentFolder : childDirectories) {
        File[] skeletonFiles=currentFolder.listFiles(skeletonFilter);
        if (skeletonFiles != null) {
          for (          File file : skeletonFiles) {
            skeletonList.add(file.getAbsolutePath());
          }
        }
        try {
          ComponentFileChecker.checkComponentFolder(currentFolder,getCodeLanguageSuffix());
          File xmlMainFile=new File(currentFolder,ComponentFilesNaming.getInstance().getMainXMLFileName(currentFolder.getName(),getCodeLanguageSuffix()));
          if (CommonsPlugin.isHeadless() && componentsCache.containsKey(xmlMainFile.getAbsolutePath())) {
            componentList.add(componentsCache.get(xmlMainFile.getAbsolutePath()));
            if (isCustom) {
              customComponentList.add(componentsCache.get(xmlMainFile.getAbsolutePath()));
            }
            continue;
          }
          String pathName=xmlMainFile.getAbsolutePath();
          String bundleName;
          if (!isCustom) {
            bundleName=admin.getBundle(provider.getClass()).getSymbolicName();
          }
 else {
            bundleName=IComponentsFactory.COMPONENTS_LOCATION;
          }
          String applicationPath;
          try {
            applicationPath=FileLocator.getBundleFile(Platform.getBundle(bundleName)).getPath();
            applicationPath=(new Path(applicationPath)).toPortableString();
          }
 catch (          IOException e2) {
            ExceptionHandler.process(e2);
            return;
          }
          pathName=(new Path(pathName)).toPortableString();
          pathName=pathName.replace(applicationPath,"String_Node_Str");
          EmfComponent currentComp=new EmfComponent(pathName,bundleName,xmlMainFile.getParentFile().getName(),pathSource,ComponentManager.getInstance(),isCreated);
          currentComp.isVisibleInComponentDefinition();
          currentComp.isTechnical();
          currentComp.getOriginalFamilyName();
          currentComp.getTranslatedFamilyName();
          currentComp.getPluginExtension();
          currentComp.getVersion();
          currentComp.getModulesNeeded();
          currentComp.getPluginDependencies();
          if (availableComponents != null && !ArrayUtils.contains(availableComponents,currentComp.getName()) && !(ArrayUtils.contains(COMPONENTS_ALWAYS_NEEDED,currentComp.getName()) || currentComp.getOriginalFamilyName().contains("String_Node_Str") || currentComp.isTechnical())) {
            continue;
          }
          componentToProviderMap.put(currentComp,provider);
          if (availableComponents != null && !ArrayUtils.contains(availableComponents,currentComp.getName()) && (ArrayUtils.contains(COMPONENTS_ALWAYS_NEEDED,currentComp.getName()) || currentComp.getOriginalFamilyName().contains("String_Node_Str") || currentComp.isTechnical())) {
            currentComp.setVisible(false);
            currentComp.setTechnical(true);
          }
          if (provider.getId().contains("String_Node_Str")) {
            currentComp.setPaletteType("String_Node_Str");
          }
 else {
            currentComp.setPaletteType("String_Node_Str");
          }
          if (componentList.contains(currentComp)) {
            log.warn("String_Node_Str" + currentComp.getName() + "String_Node_Str");
          }
 else {
            currentComp.setResourceBundle(getComponentResourceBundle(currentComp,source.toString(),null,provider));
            loadIcons(currentFolder,currentComp);
            componentList.add(currentComp);
            if (isCustom) {
              customComponentList.add(currentComp);
            }
            if (pathSource != null) {
              Path userComponent=new Path(pathSource);
              Path templatePath=new Path(IComponentsFactory.COMPONENTS_INNER_FOLDER + File.separatorChar + IComponentsFactory.EXTERNAL_COMPONENTS_INNER_FOLDER+ File.separatorChar+ ComponentUtilities.getExtFolder(OLD_COMPONENTS_USER_INNER_FOLDER));
              if (userComponent.equals(templatePath)) {
                userComponentList.add(currentComp);
              }
            }
          }
          if (CommonsPlugin.isHeadless()) {
            componentsCache.put(xmlMainFile.getAbsolutePath(),currentComp);
          }
        }
 catch (        MissingMainXMLComponentFileException e) {
          log.trace(currentFolder.getName() + "String_Node_Str" + getCodeLanguageSuffix()+ "String_Node_Str",e);
        }
catch (        BusinessException e) {
          BusinessException ex=new BusinessException("String_Node_Str" + currentFolder.getName() + "String_Node_Str"+ e.getMessage(),e);
          ExceptionHandler.process(ex,Level.WARN);
        }
        if (this.subMonitor != null) {
          this.subMonitor.worked(1);
        }
        if (this.monitor != null && this.monitor.isCanceled()) {
          return;
        }
      }
      skeletonList.trimToSize();
    }
  }
}

Fixed version (ground truth):
private void loadComponentsFromFolder(String pathSource,AbstractComponentsProvider provider){
  if (pathSource != null) {
    Path userComponent=new Path(pathSource);
    Path templatePath=new Path(IComponentsFactory.COMPONENTS_INNER_FOLDER + File.separatorChar + IComponentsFactory.EXTERNAL_COMPONENTS_INNER_FOLDER+ File.separatorChar+ ComponentUtilities.getExtFolder(OLD_COMPONENTS_USER_INNER_FOLDER));
    if (userComponent.equals(templatePath)) {
      this.userComponentList=new ArrayList<IComponent>();
    }
  }
  boolean isCustom=false;
  if ("String_Node_Str".equals(provider.getId()) || "String_Node_Str".equals(provider.getId())) {
    isCustom=true;
  }
  File source;
  try {
    source=provider.getInstallationFolder();
  }
 catch (  IOException e1) {
    ExceptionHandler.process(e1);
    return;
  }
  File[] childDirectories;
  FileFilter fileFilter=new FileFilter(){
    @Override public boolean accept(    final File file){
      return file.isDirectory() && file.getName().charAt(0) != '.' && !file.getName().equals(IComponentsFactory.EXTERNAL_COMPONENTS_INNER_FOLDER) && isComponentVisible(file.getName());
    }
  }
;
  if (source == null) {
    ExceptionHandler.process(new Exception(Messages.getString("String_Node_Str") + pathSource));
    return;
  }
  childDirectories=source.listFiles(fileFilter);
  IBrandingService service=(IBrandingService)GlobalServiceRegister.getDefault().getService(IBrandingService.class);
  String[] availableComponents=service.getBrandingConfiguration().getAvailableComponents();
  FileFilter skeletonFilter=new FileFilter(){
    @Override public boolean accept(    final File file){
      String fileName=file.getName();
      return file.isFile() && fileName.charAt(0) != '.' && (fileName.endsWith(SKELETON_SUFFIX) || fileName.endsWith(INCLUDEFILEINJET_SUFFIX));
    }
  }
;
  BundleContext context=null;
  if (Platform.getProduct() != null) {
    final Bundle definingBundle=Platform.getProduct().getDefiningBundle();
    if (definingBundle != null) {
      context=definingBundle.getBundleContext();
    }
  }
  if (context == null) {
    context=CodeGeneratorActivator.getDefault().getBundle().getBundleContext();
  }
  ServiceReference sref=context.getServiceReference(PackageAdmin.class.getName());
  PackageAdmin admin=(PackageAdmin)context.getService(sref);
  if (childDirectories != null) {
    if (monitor != null) {
      this.subMonitor=SubMonitor.convert(monitor,Messages.getString("String_Node_Str"),childDirectories.length);
    }
    if (skeletonList != null) {
      skeletonList.ensureCapacity(childDirectories.length);
      for (      File currentFolder : childDirectories) {
        File[] skeletonFiles=currentFolder.listFiles(skeletonFilter);
        if (skeletonFiles != null) {
          for (          File file : skeletonFiles) {
            skeletonList.add(file.getAbsolutePath());
          }
        }
        try {
          ComponentFileChecker.checkComponentFolder(currentFolder,getCodeLanguageSuffix());
          File xmlMainFile=new File(currentFolder,ComponentFilesNaming.getInstance().getMainXMLFileName(currentFolder.getName(),getCodeLanguageSuffix()));
          if (CommonsPlugin.isHeadless() && componentsCache.containsKey(xmlMainFile.getAbsolutePath())) {
            componentList.add(componentsCache.get(xmlMainFile.getAbsolutePath()));
            if (isCustom) {
              customComponentList.add(componentsCache.get(xmlMainFile.getAbsolutePath()));
            }
            continue;
          }
          String pathName=xmlMainFile.getAbsolutePath();
          String bundleName;
          if (!isCustom) {
            bundleName=admin.getBundle(provider.getClass()).getSymbolicName();
          }
 else {
            bundleName=IComponentsFactory.COMPONENTS_LOCATION;
          }
          String applicationPath;
          try {
            applicationPath=FileLocator.getBundleFile(Platform.getBundle(bundleName)).getPath();
            applicationPath=(new Path(applicationPath)).toPortableString();
          }
 catch (          IOException e2) {
            ExceptionHandler.process(e2);
            return;
          }
          pathName=(new Path(pathName)).toPortableString();
          pathName=pathName.replace(applicationPath,"String_Node_Str");
          EmfComponent currentComp=new EmfComponent(pathName,bundleName,xmlMainFile.getParentFile().getName(),pathSource,ComponentManager.getInstance(),isCreated);
          currentComp.isVisibleInComponentDefinition();
          currentComp.isTechnical();
          currentComp.getOriginalFamilyName();
          currentComp.getTranslatedFamilyName();
          currentComp.getPluginExtension();
          currentComp.getVersion();
          currentComp.getModulesNeeded();
          currentComp.getPluginDependencies();
          if (availableComponents != null && !ArrayUtils.contains(availableComponents,currentComp.getName()) && !(ArrayUtils.contains(COMPONENTS_ALWAYS_NEEDED,currentComp.getName()) || currentComp.getOriginalFamilyName().contains("String_Node_Str") || currentComp.isTechnical())) {
            continue;
          }
          componentToProviderMap.put(currentComp,provider);
          if (availableComponents != null && !ArrayUtils.contains(availableComponents,currentComp.getName()) && (ArrayUtils.contains(COMPONENTS_ALWAYS_NEEDED,currentComp.getName()) || currentComp.getOriginalFamilyName().contains("String_Node_Str") || currentComp.isTechnical())) {
            currentComp.setVisible(false);
            currentComp.setTechnical(true);
          }
          if (provider.getId().contains("String_Node_Str")) {
            currentComp.setPaletteType("String_Node_Str");
          }
 else {
            currentComp.setPaletteType("String_Node_Str");
          }
          if (componentList.contains(currentComp)) {
            log.warn("String_Node_Str" + currentComp.getName() + "String_Node_Str");
          }
 else {
            currentComp.setResourceBundle(getComponentResourceBundle(currentComp,source.toString(),null,provider));
            loadIcons(currentFolder,currentComp);
            componentList.add(currentComp);
            if (isCustom) {
              customComponentList.add(currentComp);
            }
            if (pathSource != null) {
              Path userComponent=new Path(pathSource);
              Path templatePath=new Path(IComponentsFactory.COMPONENTS_INNER_FOLDER + File.separatorChar + IComponentsFactory.EXTERNAL_COMPONENTS_INNER_FOLDER+ File.separatorChar+ ComponentUtilities.getExtFolder(OLD_COMPONENTS_USER_INNER_FOLDER));
              if (userComponent.equals(templatePath)) {
                userComponentList.add(currentComp);
              }
            }
          }
          if (CommonsPlugin.isHeadless()) {
            componentsCache.put(xmlMainFile.getAbsolutePath(),currentComp);
          }
        }
 catch (        MissingMainXMLComponentFileException e) {
          log.trace(currentFolder.getName() + "String_Node_Str" + getCodeLanguageSuffix()+ "String_Node_Str",e);
        }
catch (        BusinessException e) {
          BusinessException ex=new BusinessException("String_Node_Str" + currentFolder.getName() + "String_Node_Str"+ e.getMessage(),e);
          ExceptionHandler.process(ex,Level.WARN);
        }
        if (this.subMonitor != null) {
          this.subMonitor.worked(1);
        }
        if (this.monitor != null && this.monitor.isCanceled()) {
          return;
        }
      }
      skeletonList.trimToSize();
    }
  }
}