Program: 119399
Project: 119399
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)) {
        boolean isMRProcess=false;
        IProcess process=((Connection)elem).getSource().getProcess();
        if (process instanceof IProcess2) {
          IProcess2 process2=(IProcess2)process;
          if (ComponentCategory.CATEGORY_4_MAPREDUCE.getName().equals(process2.getComponentsType())) {
            isMRProcess=true;
          }
        }
        int length=categories.length;
        EComponentCategory[] newCategories;
        boolean needAvoid=needAvoidRecovery(elem);
        if (propertyValue.equals(EConnectionType.ON_SUBJOB_OK) && !isMRProcess && !needAvoid) {
          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 (ComponentCategory.CATEGORY_4_CAMEL.getName().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 isMRProcess=false;
        IProcess process=((Connection)elem).getSource().getProcess();
        if (process instanceof IProcess2) {
          IProcess2 process2=(IProcess2)process;
          if (ComponentCategory.CATEGORY_4_MAPREDUCE.getName().equals(process2.getComponentsType())) {
            isMRProcess=true;
          }
        }
        int length=categories.length;
        EComponentCategory[] newCategories;
        boolean needAvoid=needAvoidRecovery(elem);
        if (propertyValue.equals(EConnectionType.ON_SUBJOB_OK) && !isMRProcess && !needAvoid) {
          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 (ComponentCategory.CATEGORY_4_CAMEL.getName().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();
  }
 else   if (elem instanceof ConnectionLabel) {
    return getCategories(((ConnectionLabel)elem).getConnection());
  }
  return null;
}