Program: 121355
Project: 121355
Buggy source:
/** 
 * yzhang Comment method "getCategories".
 * @param elem
 * @return
 */
private EComponentCategory[] getCategories(Element elem){
  if (elem instanceof Connection) {
    EComponentCategory[] categories=EElementType.CONNECTION.getCategories();
    if (PluginChecker.isTeamEdition()) {
      Object propertyValue=elem.getPropertyValue(Connection.LINESTYLE_PROP);
      if (propertyValue instanceof EConnectionType && ((EConnectionType)propertyValue).hasConnectionCategory(IConnectionCategory.FLOW)) {
        final List<EComponentCategory> list=new ArrayList<EComponentCategory>(Arrays.asList(categories));
        list.add(EComponentCategory.BREAKPOINT);
        if (elem.getElementParameter(EParameterName.DEPARTITIONER.getName()) != null || elem.getElementParameter(EParameterName.PARTITIONER.getName()) != null || elem.getElementParameter(EParameterName.REPARTITIONER.getName()) != null) {
          list.add(EComponentCategory.PARALLELIZATION);
        }
        return list.toArray(new EComponentCategory[0]);
      }
 else       if (propertyValue.equals(EConnectionType.ON_COMPONENT_OK) || propertyValue.equals(EConnectionType.ON_COMPONENT_ERROR) || propertyValue.equals(EConnectionType.RUN_IF)|| propertyValue.equals(EConnectionType.ON_SUBJOB_OK)|| propertyValue.equals(EConnectionType.ON_SUBJOB_ERROR)|| propertyValue.equals(EConnectionType.ROUTE_WHEN)|| propertyValue.equals(EConnectionType.ROUTE_CATCH)|| propertyValue.equals(EConnectionType.STARTS)) {
        int length=categories.length;
        EComponentCategory[] newCategories;
        if (propertyValue.equals(EConnectionType.ON_SUBJOB_OK)) {
          newCategories=new EComponentCategory[length + 1];
          for (int i=0; i < length; i++) {
            newCategories[i]=categories[i];
          }
          EComponentCategory resuming=EComponentCategory.RESUMING;
          newCategories[length]=resuming;
        }
 else {
          newCategories=new EComponentCategory[length];
          for (int i=0; i < length; i++) {
            newCategories[i]=categories[i];
          }
        }
        return newCategories;
      }
    }
    return categories;
  }
 else   if (elem instanceof Node) {
    if (((Node)elem).isELTComponent()) {
      if (!((Node)elem).getComponent().getName().endsWith("String_Node_Str") && !((Node)elem).getComponent().getName().endsWith("String_Node_Str") && !((Node)elem).getComponent().getName().endsWith("String_Node_Str")&& !((Node)elem).getComponent().getName().endsWith("String_Node_Str")&& !((Node)elem).getComponent().getName().endsWith("String_Node_Str")) {
        return EElementType.ELT_NODE.getCategories();
      }
    }
    EComponentCategory[] categories=EElementType.ADVANCED_NODE.getCategories();
    if (((Node)elem).getComponent() != null) {
      String paletteType=((Node)elem).getComponent().getPaletteType();
      if ("String_Node_Str".equals(paletteType)) {
        categories=EElementType.NODE.getCategories();
      }
    }
    if (PluginChecker.isValidationrulesPluginLoaded() && isSupportValidationRuleNode((Node)elem)) {
      EComponentCategory[] newCategories=new EComponentCategory[categories.length + 1];
      System.arraycopy(categories,0,newCategories,0,categories.length);
      newCategories[categories.length]=EComponentCategory.VALIDATION_RULES;
      return newCategories;
    }
    return categories;
  }
 else   if (elem instanceof Note) {
    return EElementType.NOTE.getCategories();
  }
 else   if (elem instanceof SubjobContainer) {
    return EElementType.SUBJOB.getCategories();
  }
  return null;
}

Fixed version (ground truth):
/** 
 * yzhang Comment method "getCategories".
 * @param elem
 * @return
 */
private EComponentCategory[] getCategories(Element elem){
  if (elem instanceof Connection) {
    EComponentCategory[] categories=EElementType.CONNECTION.getCategories();
    if (PluginChecker.isTeamEdition()) {
      Object propertyValue=elem.getPropertyValue(Connection.LINESTYLE_PROP);
      if (propertyValue instanceof EConnectionType && ((EConnectionType)propertyValue).hasConnectionCategory(IConnectionCategory.FLOW)) {
        final List<EComponentCategory> list=new ArrayList<EComponentCategory>(Arrays.asList(categories));
        list.add(EComponentCategory.BREAKPOINT);
        if (elem.getElementParameter(EParameterName.DEPARTITIONER.getName()) != null || elem.getElementParameter(EParameterName.PARTITIONER.getName()) != null || elem.getElementParameter(EParameterName.REPARTITIONER.getName()) != null) {
          list.add(EComponentCategory.PARALLELIZATION);
        }
        return list.toArray(new EComponentCategory[0]);
      }
 else       if (propertyValue.equals(EConnectionType.ON_COMPONENT_OK) || propertyValue.equals(EConnectionType.ON_COMPONENT_ERROR) || propertyValue.equals(EConnectionType.RUN_IF)|| propertyValue.equals(EConnectionType.ON_SUBJOB_OK)|| propertyValue.equals(EConnectionType.ON_SUBJOB_ERROR)|| propertyValue.equals(EConnectionType.ROUTE_WHEN)|| propertyValue.equals(EConnectionType.ROUTE_CATCH)|| propertyValue.equals(EConnectionType.STARTS)) {
        boolean isMREditorActive=false;
        IMRProcessService mrService=(IMRProcessService)GlobalServiceRegister.getDefault().getService(IMRProcessService.class);
        if (mrService != null) {
          IProcess process=((Connection)elem).getSource().getProcess();
          if (process instanceof IProcess2) {
            IEditorPart editor=((IProcess2)process).getEditor();
            isMREditorActive=mrService.isMapReduceEditor(editor);
          }
        }
        int length=categories.length;
        EComponentCategory[] newCategories;
        if (propertyValue.equals(EConnectionType.ON_SUBJOB_OK) && !isMREditorActive) {
          newCategories=new EComponentCategory[length + 1];
          for (int i=0; i < length; i++) {
            newCategories[i]=categories[i];
          }
          EComponentCategory resuming=EComponentCategory.RESUMING;
          newCategories[length]=resuming;
        }
 else {
          newCategories=new EComponentCategory[length];
          for (int i=0; i < length; i++) {
            newCategories[i]=categories[i];
          }
        }
        return newCategories;
      }
    }
    return categories;
  }
 else   if (elem instanceof Node) {
    if (((Node)elem).isELTComponent()) {
      if (!((Node)elem).getComponent().getName().endsWith("String_Node_Str") && !((Node)elem).getComponent().getName().endsWith("String_Node_Str") && !((Node)elem).getComponent().getName().endsWith("String_Node_Str")&& !((Node)elem).getComponent().getName().endsWith("String_Node_Str")&& !((Node)elem).getComponent().getName().endsWith("String_Node_Str")) {
        return EElementType.ELT_NODE.getCategories();
      }
    }
    EComponentCategory[] categories=EElementType.ADVANCED_NODE.getCategories();
    if (((Node)elem).getComponent() != null) {
      String paletteType=((Node)elem).getComponent().getPaletteType();
      if ("String_Node_Str".equals(paletteType)) {
        categories=EElementType.NODE.getCategories();
      }
    }
    if (PluginChecker.isValidationrulesPluginLoaded() && isSupportValidationRuleNode((Node)elem)) {
      EComponentCategory[] newCategories=new EComponentCategory[categories.length + 1];
      System.arraycopy(categories,0,newCategories,0,categories.length);
      newCategories[categories.length]=EComponentCategory.VALIDATION_RULES;
      return newCategories;
    }
    return categories;
  }
 else   if (elem instanceof Note) {
    return EElementType.NOTE.getCategories();
  }
 else   if (elem instanceof SubjobContainer) {
    return EElementType.SUBJOB.getCategories();
  }
  return null;
}