Program: 19917
Project: 19917
Buggy source:
public FieldData getFieldData(PrestoTopic topic,PrestoFieldUsage field){
  PrestoType type=field.getType();
  PrestoView view=field.getView();
  PrestoContext context=PrestoContext.create(topic,type,view);
  PrestoContextRules rules=getPrestoContextRules(context);
  FieldData result=getFieldData(rules,field);
  return processor.postProcessFieldData(result,rules,field,null);
}

Fixed version (ground truth):
public FieldData getFieldData(PrestoContextRules rules,PrestoFieldUsage field,int offset,int limit,boolean includeValues){
  PrestoContext context=rules.getContext();
  PrestoTopic topic=context.getTopic();
  PrestoType type=context.getType();
  PrestoView view=context.getView();
  boolean isNewTopic=context.isNewTopic();
  String topicId;
  if (isNewTopic) {
    topicId="String_Node_Str" + type.getId();
  }
 else {
    topicId=topic.getId();
  }
  FieldData fieldData=new FieldData();
  fieldData.setId(field.getId());
  fieldData.setName(field.getName());
  int minCard=field.getMinCardinality();
  if (minCard > 0) {
    fieldData.setMinCardinality(minCard);
  }
  int maxCard=field.getMaxCardinality();
  if (maxCard > 0) {
    fieldData.setMaxCardinality(maxCard);
  }
  String validationType=field.getValidationType();
  if (validationType != null) {
    setParam(fieldData,"String_Node_Str",validationType);
  }
  String interfaceControl=field.getInterfaceControl();
  if (interfaceControl != null) {
    fieldData.setInterfaceControl(interfaceControl);
  }
  if (field.isEmbedded()) {
    fieldData.setEmbeddable(true);
  }
  boolean isReadOnly=rules.isReadOnlyField(field);
  if (isReadOnly) {
    fieldData.setReadOnly(Boolean.TRUE);
  }
  PrestoContext parentContext=context.getParentContext();
  PrestoFieldUsage parentField=context.getParentField();
  boolean allowCreate=rules.isCreatableField(field);
  boolean allowAdd=rules.isAddableField(field);
  Collection<Link> fieldLinks=new LinkedHashSet<Link>();
  if (field.isReferenceField()) {
    fieldData.setDatatype("String_Node_Str");
  }
 else {
    String dataType=field.getDataType();
    if (dataType != null) {
      fieldData.setDatatype(dataType);
    }
  }
  if (!isReadOnly) {
    boolean isSorted=rules.isSortedField(field);
    boolean allowRemove=rules.isRemovableField(field);
    boolean allowMove=!isSorted;
    if (allowAdd || allowCreate) {
      if (!isNewTopic) {
        fieldLinks.add(lx.fieldAddValuesLink(parentContext,parentField,topicId,type,view,field));
        if (!isSorted) {
          fieldLinks.add(lx.fieldAddValuesAtIndexLink(parentContext,parentField,topicId,type,view,field));
        }
      }
    }
    if (allowRemove && !isNewTopic) {
      fieldLinks.add(lx.fieldRemoveValuesLink(parentContext,parentField,topicId,type,view,field));
    }
    if (allowMove && !isNewTopic) {
      fieldLinks.add(lx.fieldMoveValuesToIndexLink(parentContext,parentField,topicId,type,view,field));
    }
  }
  if (!isReadOnly && allowAdd) {
    if (!field.isReferenceField() || !getAvailableFieldValueTypes(context,field).isEmpty()) {
      boolean query=isCustomAvailableValuesQuery(context,field);
      fieldLinks.add(lx.fieldAvailableValuesLink(parentContext,parentField,topicId,type,view,field,query));
    }
  }
  if (!isReadOnly && allowCreate) {
    fieldLinks.addAll(getTopicTemplateFieldLinks(context,field));
  }
  if (rules.isPageableField(field)) {
    fieldLinks.add(lx.fieldPagingLink(parentContext,parentField,topicId,type,view,field));
  }
  if (!fieldLinks.isEmpty()) {
    fieldData.setLinks(fieldLinks);
  }
  if (includeValues) {
    setFieldDataValues(offset,limit,rules,field,fieldData);
  }
  return fieldData;
}