Program: 125999
Project: 125999
Buggy source:
private static List<ModuleNeeded> collectModuleNeeded(List<IRepositoryViewObject> routineItems,Set<String> routineIdOrNames,boolean system){
  List<ModuleNeeded> importNeedsList=new ArrayList<ModuleNeeded>();
  if (!routineItems.isEmpty()) {
    for (    IRepositoryViewObject object : routineItems) {
      if (routineIdOrNames.contains(object.getLabel()) && system || routineIdOrNames.contains(object.getId()) && !system) {
        Item item=object.getProperty().getItem();
        if (item instanceof RoutineItem) {
          RoutineItem routine=(RoutineItem)item;
          importNeedsList.addAll(createModuleNeededFromRoutine(routine));
        }
      }
    }
  }
  if (system) {
    if (GlobalServiceRegister.getDefault().isServiceRegistered(ILibraryManagerUIService.class)) {
      ILibraryManagerUIService libUiService=(ILibraryManagerUIService)GlobalServiceRegister.getDefault().getService(ILibraryManagerUIService.class);
      Set<String> routinesName=new HashSet<>();
      for (      IRoutinesProvider routineProvider : libUiService.getRoutinesProviders(ECodeLanguage.JAVA)) {
        for (        URL url : routineProvider.getSystemRoutines()) {
          String[] fragments=url.toString().split("String_Node_Str");
          String label=fragments[fragments.length - 1];
          String[] tmp=label.split("String_Node_Str");
          String routineName=tmp[0];
          routinesName.add(routineName);
        }
        for (        URL url : routineProvider.getTalendRoutines()) {
          String[] fragments=url.toString().split("String_Node_Str");
          String label=fragments[fragments.length - 1];
          String[] tmp=label.split("String_Node_Str");
          String routineName=tmp[0];
          routinesName.add(routineName);
        }
      }
      Map<String,List<LibraryInfo>> routineAndJars=libUiService.getRoutineAndJars();
      Iterator<Map.Entry<String,List<LibraryInfo>>> iter=routineAndJars.entrySet().iterator();
      while (iter.hasNext()) {
        Map.Entry<String,List<LibraryInfo>> entry=iter.next();
        String routineName=entry.getKey();
        if (!routinesName.contains(routineName)) {
          continue;
        }
        List<LibraryInfo> needJars=entry.getValue();
        for (        LibraryInfo jar : needJars) {
          ModuleNeeded toAdd=new ModuleNeeded("String_Node_Str" + routineName,jar.getLibName(),"String_Node_Str",true);
          String bundleId=jar.getBundleId();
          if (bundleId != null) {
            String bundleName=null;
            String bundleVersion=null;
            if (bundleId.contains("String_Node_Str")) {
              String[] nameAndVersion=bundleId.split("String_Node_Str");
              bundleName=nameAndVersion[0];
              bundleVersion=nameAndVersion[1];
            }
 else {
              bundleName=bundleId;
            }
            toAdd.setBundleName(bundleName);
            toAdd.setBundleVersion(bundleVersion);
          }
          importNeedsList.add(toAdd);
        }
      }
    }
  }
  return importNeedsList;
}

Fixed version (ground truth):
private static List<ModuleNeeded> collectModuleNeeded(List<IRepositoryViewObject> routineItems,Set<String> routineIdOrNames,boolean system){
  List<ModuleNeeded> importNeedsList=new ArrayList<ModuleNeeded>();
  if (org.talend.commons.utils.platform.PluginChecker.isOnlyTopLoaded()) {
    return importNeedsList;
  }
  if (!routineItems.isEmpty()) {
    for (    IRepositoryViewObject object : routineItems) {
      if (routineIdOrNames.contains(object.getLabel()) && system || routineIdOrNames.contains(object.getId()) && !system) {
        Item item=object.getProperty().getItem();
        if (item instanceof RoutineItem) {
          RoutineItem routine=(RoutineItem)item;
          importNeedsList.addAll(createModuleNeededFromRoutine(routine));
        }
      }
    }
  }
  if (system) {
    if (GlobalServiceRegister.getDefault().isServiceRegistered(ILibraryManagerUIService.class)) {
      ILibraryManagerUIService libUiService=(ILibraryManagerUIService)GlobalServiceRegister.getDefault().getService(ILibraryManagerUIService.class);
      Set<String> routinesName=new HashSet<>();
      for (      IRoutinesProvider routineProvider : libUiService.getRoutinesProviders(ECodeLanguage.JAVA)) {
        for (        URL url : routineProvider.getSystemRoutines()) {
          String[] fragments=url.toString().split("String_Node_Str");
          String label=fragments[fragments.length - 1];
          String[] tmp=label.split("String_Node_Str");
          String routineName=tmp[0];
          routinesName.add(routineName);
        }
        for (        URL url : routineProvider.getTalendRoutines()) {
          String[] fragments=url.toString().split("String_Node_Str");
          String label=fragments[fragments.length - 1];
          String[] tmp=label.split("String_Node_Str");
          String routineName=tmp[0];
          routinesName.add(routineName);
        }
      }
      Map<String,List<LibraryInfo>> routineAndJars=libUiService.getRoutineAndJars();
      Iterator<Map.Entry<String,List<LibraryInfo>>> iter=routineAndJars.entrySet().iterator();
      while (iter.hasNext()) {
        Map.Entry<String,List<LibraryInfo>> entry=iter.next();
        String routineName=entry.getKey();
        if (!routinesName.contains(routineName)) {
          continue;
        }
        List<LibraryInfo> needJars=entry.getValue();
        for (        LibraryInfo jar : needJars) {
          ModuleNeeded toAdd=new ModuleNeeded("String_Node_Str" + routineName,jar.getLibName(),"String_Node_Str",true);
          String bundleId=jar.getBundleId();
          if (bundleId != null) {
            String bundleName=null;
            String bundleVersion=null;
            if (bundleId.contains("String_Node_Str")) {
              String[] nameAndVersion=bundleId.split("String_Node_Str");
              bundleName=nameAndVersion[0];
              bundleVersion=nameAndVersion[1];
            }
 else {
              bundleName=bundleId;
            }
            toAdd.setBundleName(bundleName);
            toAdd.setBundleVersion(bundleVersion);
          }
          importNeedsList.add(toAdd);
        }
      }
    }
  }
  return importNeedsList;
}