Program: 59415
Project: 59415
Buggy source:
private void excludeFieldsInToStringAnnotation(final String fieldName){
  final AnnotationMetadata toStringAnnotation=governorTypeDetails.getAnnotation(ROO_TO_STRING);
  if (toStringAnnotation == null) {
    return;
  }
  final List<AnnotationAttributeValue<?>> attributes=new ArrayList<AnnotationAttributeValue<?>>();
  final List<StringAttributeValue> ignoreFields=new ArrayList<StringAttributeValue>();
  boolean alreadyAdded=false;
  final AnnotationAttributeValue<?> value=toStringAnnotation.getAttribute(new JavaSymbolName("String_Node_Str"));
  if (value == null) {
    return;
  }
  final String errMsg="String_Node_Str";
  Validate.isInstanceOf(ArrayAttributeValue.class,value,errMsg);
  final ArrayAttributeValue<?> arrayVal=(ArrayAttributeValue<?>)value;
  for (  final Object obj : arrayVal.getValue()) {
    Validate.isInstanceOf(StringAttributeValue.class,obj,errMsg);
    final StringAttributeValue sv=(StringAttributeValue)obj;
    if (sv.getValue().equals(fieldName)) {
      alreadyAdded=true;
    }
    ignoreFields.add(sv);
  }
  if (!alreadyAdded) {
    ignoreFields.add(new StringAttributeValue(new JavaSymbolName("String_Node_Str"),fieldName));
  }
  attributes.add(new ArrayAttributeValue<StringAttributeValue>(new JavaSymbolName("String_Node_Str"),ignoreFields));
  final AnnotationMetadataBuilder toStringAnnotationBuilder=new AnnotationMetadataBuilder(ROO_TO_STRING,attributes);
  updatedGovernorBuilder=new ClassOrInterfaceTypeDetailsBuilder(governorTypeDetails);
  updatedGovernorBuilder.updateTypeAnnotation(toStringAnnotationBuilder.build(),new HashSet<JavaSymbolName>());
}

Fixed version (ground truth):
private void excludeFieldsInToStringAnnotation(final String fieldName){
  final AnnotationMetadata toStringAnnotation=governorTypeDetails.getAnnotation(ROO_TO_STRING);
  if (toStringAnnotation == null) {
    return;
  }
  final List<AnnotationAttributeValue<?>> attributes=new ArrayList<AnnotationAttributeValue<?>>();
  final List<StringAttributeValue> ignoreFields=new ArrayList<StringAttributeValue>();
  boolean alreadyAdded=false;
  AnnotationAttributeValue<?> value=toStringAnnotation.getAttribute(new JavaSymbolName("String_Node_Str"));
  if (value == null) {
    value=new ArrayAttributeValue<StringAttributeValue>(new JavaSymbolName("String_Node_Str"),new ArrayList<StringAttributeValue>());
  }
  final String errMsg="String_Node_Str";
  Validate.isInstanceOf(ArrayAttributeValue.class,value,errMsg);
  final ArrayAttributeValue<?> arrayVal=(ArrayAttributeValue<?>)value;
  for (  final Object obj : arrayVal.getValue()) {
    Validate.isInstanceOf(StringAttributeValue.class,obj,errMsg);
    final StringAttributeValue sv=(StringAttributeValue)obj;
    if (sv.getValue().equals(fieldName)) {
      alreadyAdded=true;
    }
    ignoreFields.add(sv);
  }
  if (!alreadyAdded) {
    ignoreFields.add(new StringAttributeValue(new JavaSymbolName("String_Node_Str"),fieldName));
  }
  attributes.add(new ArrayAttributeValue<StringAttributeValue>(new JavaSymbolName("String_Node_Str"),ignoreFields));
  final AnnotationMetadataBuilder toStringAnnotationBuilder=new AnnotationMetadataBuilder(ROO_TO_STRING,attributes);
  updatedGovernorBuilder=new ClassOrInterfaceTypeDetailsBuilder(governorTypeDetails);
  updatedGovernorBuilder.updateTypeAnnotation(toStringAnnotationBuilder.build(),new HashSet<JavaSymbolName>());
}