Program: 122952
Project: 122952
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);
        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)) {
        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 (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);
        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)) {
        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;
}