Program: 121643
Project: 121643
Buggy source:
private JSONObject collectJobDetails() throws PersistenceException, JSONException {
  JSONObject jObject=new JSONObject();
  Project currentProject=ProjectManager.getInstance().getCurrentProject();
  final IProxyRepositoryFactory factory=CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
  int jobsNum=0;
  int componentsNum=0;
  int contextVarsNum=0;
  int businessModelsNum=0;
  int generatedJobDocsNum=0;
  int metadatasNum=0;
  Map<String,Integer> numComponentMap=new HashMap<String,Integer>();
  List<IRepositoryViewObject> all=factory.getAll(currentProject,ERepositoryObjectType.PROCESS);
  jobsNum+=all.size();
  for (  IRepositoryViewObject rvo : all) {
    Item item=rvo.getProperty().getItem();
    if (item.eClass() == PropertiesPackage.Literals.PROCESS_ITEM) {
      ProcessType processType=((ProcessItem)item).getProcess();
      componentsNum+=processType.getNode().size();
      for (      NodeType node : (List<NodeType>)processType.getNode()) {
        String componentName=node.getComponentName();
        Integer integer=numComponentMap.get(componentName);
        if (integer == null) {
          numComponentMap.put(componentName,1);
        }
 else {
          numComponentMap.put(componentName,integer + 1);
        }
      }
      EList contexts=processType.getContext();
      if (contexts.size() > 0) {
        ContextType contextType=(ContextType)contexts.get(0);
        contextVarsNum+=contextType.getContextParameter().size();
      }
    }
  }
  businessModelsNum+=factory.getAll(currentProject,ERepositoryObjectType.BUSINESS_PROCESS).size();
  generatedJobDocsNum+=factory.getAll(currentProject,ERepositoryObjectType.JOB_DOC).size();
  for (  DynaEnum type : ERepositoryObjectType.values()) {
    if (type instanceof ERepositoryObjectType) {
      ERepositoryObjectType repType=(ERepositoryObjectType)type;
      String folder=repType.getFolder();
      if (repType.isDIItemType() && repType.isResouce() && folder != null && folder.startsWith(ERepositoryObjectType.METADATA.getFolder())) {
        metadatasNum+=factory.getAll(currentProject,repType).size();
      }
    }
  }
  jObject.put(TOS_COUNT_JOBS.getKey(),jobsNum);
  jObject.put(TOS_COUNT_BUSINESS_MODELS.getKey(),businessModelsNum);
  jObject.put(TOS_COUNT_GENERATED_JOB_DOCS.getKey(),generatedJobDocsNum);
  jObject.put(TOS_COUNT_METADATAS.getKey(),metadatasNum);
  jObject.put(TOS_COUNT_CONTEXT_VARIABLES.getKey(),contextVarsNum);
  jObject.put(TOS_COUNT_COMPONENTS.getKey(),componentsNum);
  jObject.put(TOS_JOB_TOP20_COMPONENTS.getKey(),TokenInforUtil.convertTopComponents(numComponentMap,TOP_USED_COMPONENTS_MAX));
  return jObject;
}

Fixed version (ground truth):
private JSONObject collectJobDetails() throws PersistenceException, JSONException {
  JSONObject jObject=new JSONObject();
  Project currentProject=ProjectManager.getInstance().getCurrentProject();
  final IProxyRepositoryFactory factory=CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
  int jobsNum=0;
  int componentsNum=0;
  int contextVarsNum=0;
  int businessModelsNum=0;
  int generatedJobDocsNum=0;
  int metadatasNum=0;
  Map<String,Integer> numComponentMap=new HashMap<String,Integer>();
  ERepositoryObjectType jobType=ERepositoryObjectType.PROCESS;
  if (jobType != null) {
    List<IRepositoryViewObject> all=factory.getAll(currentProject,jobType);
    jobsNum+=all.size();
    for (    IRepositoryViewObject rvo : all) {
      Item item=rvo.getProperty().getItem();
      if (item.eClass() == PropertiesPackage.Literals.PROCESS_ITEM) {
        ProcessType processType=((ProcessItem)item).getProcess();
        componentsNum+=processType.getNode().size();
        for (        NodeType node : (List<NodeType>)processType.getNode()) {
          String componentName=node.getComponentName();
          Integer integer=numComponentMap.get(componentName);
          if (integer == null) {
            numComponentMap.put(componentName,1);
          }
 else {
            numComponentMap.put(componentName,integer + 1);
          }
        }
        EList contexts=processType.getContext();
        if (contexts.size() > 0) {
          ContextType contextType=(ContextType)contexts.get(0);
          contextVarsNum+=contextType.getContextParameter().size();
        }
      }
    }
  }
  ERepositoryObjectType bmType=ERepositoryObjectType.BUSINESS_PROCESS;
  if (bmType != null) {
    businessModelsNum+=factory.getAll(currentProject,bmType).size();
  }
  ERepositoryObjectType jobDocType=ERepositoryObjectType.JOB_DOC;
  if (jobDocType != null) {
    generatedJobDocsNum+=factory.getAll(currentProject,jobDocType).size();
  }
  for (  DynaEnum type : ERepositoryObjectType.values()) {
    if (type instanceof ERepositoryObjectType) {
      ERepositoryObjectType repType=(ERepositoryObjectType)type;
      String folder=repType.getFolder();
      if (repType.isDIItemType() && repType.isResouce() && folder != null && folder.startsWith(ERepositoryObjectType.METADATA.getFolder())) {
        metadatasNum+=factory.getAll(currentProject,repType).size();
      }
    }
  }
  jObject.put(TOS_COUNT_JOBS.getKey(),jobsNum);
  jObject.put(TOS_COUNT_BUSINESS_MODELS.getKey(),businessModelsNum);
  jObject.put(TOS_COUNT_GENERATED_JOB_DOCS.getKey(),generatedJobDocsNum);
  jObject.put(TOS_COUNT_METADATAS.getKey(),metadatasNum);
  jObject.put(TOS_COUNT_CONTEXT_VARIABLES.getKey(),contextVarsNum);
  jObject.put(TOS_COUNT_COMPONENTS.getKey(),componentsNum);
  jObject.put(TOS_JOB_TOP20_COMPONENTS.getKey(),TokenInforUtil.convertTopComponents(numComponentMap,TOP_USED_COMPONENTS_MAX));
  return jObject;
}