Program: 146037
Project: 146037
Buggy source:
@Override public void validate(ValidationHandler handler){
  int errorCount=handler.getErrorCount();
  fieldType.validate(handler);
  if (handler.getErrorCount() > errorCount) {
    return;
  }
  TypeMetadata currentType=fieldType;
  if (!XMLConstants.W3C_XML_SCHEMA_NS_URI.equals(currentType.getNamespace())) {
    while (!currentType.getSuperTypes().isEmpty()) {
      TypeMetadata superType=currentType.getSuperTypes().iterator().next();
      if (XMLConstants.W3C_XML_SCHEMA_NS_URI.equals(superType.getNamespace()) && ("String_Node_Str".equals(superType.getName()) || "String_Node_Str".equals(superType.getName()))) {
        break;
      }
      currentType=superType;
      errorCount=handler.getErrorCount();
      currentType.validate(handler);
      if (handler.getErrorCount() > errorCount) {
        return;
      }
    }
  }
  if (!"String_Node_Str".equals(currentType.getName())) {
    handler.error(this,"String_Node_Str" + getName() + "String_Node_Str",this.<Integer>getData(MetadataRepository.XSD_LINE_NUMBER),this.<Integer>getData(MetadataRepository.XSD_COLUMN_NUMBER),ValidationError.FOREIGN_KEY_NOT_STRING_TYPED);
  }
  referencedField.validate(handler);
  if (foreignKeyInfo != null) {
    errorCount=handler.getErrorCount();
    foreignKeyInfo.validate(handler);
    if (handler.getErrorCount() > errorCount) {
      return;
    }
    if (!isPrimitiveTypeField(foreignKeyInfo)) {
      handler.warning(foreignKeyInfo,"String_Node_Str",foreignKeyInfo.<Integer>getData(MetadataRepository.XSD_LINE_NUMBER),foreignKeyInfo.<Integer>getData(MetadataRepository.XSD_COLUMN_NUMBER),ValidationError.FOREIGN_KEY_INFO_NOT_STRING_TYPED);
    }
    if (foreignKeyInfo.isMany()) {
      handler.warning(foreignKeyInfo,"String_Node_Str",foreignKeyInfo.<Integer>getData(MetadataRepository.XSD_LINE_NUMBER),foreignKeyInfo.<Integer>getData(MetadataRepository.XSD_COLUMN_NUMBER),ValidationError.FOREIGN_KEY_INFO_REPEATABLE);
    }
  }
}

Fixed version (ground truth):
@Override public void validate(ValidationHandler handler){
  int errorCount=handler.getErrorCount();
  fieldType.validate(handler);
  if (handler.getErrorCount() > errorCount) {
    return;
  }
  TypeMetadata currentType=fieldType;
  if (!XMLConstants.W3C_XML_SCHEMA_NS_URI.equals(currentType.getNamespace())) {
    while (!currentType.getSuperTypes().isEmpty()) {
      TypeMetadata superType=currentType.getSuperTypes().iterator().next();
      if (XMLConstants.W3C_XML_SCHEMA_NS_URI.equals(superType.getNamespace()) && ("String_Node_Str".equals(superType.getName()) || "String_Node_Str".equals(superType.getName()))) {
        break;
      }
      currentType=superType;
      errorCount=handler.getErrorCount();
      currentType.validate(handler);
      if (handler.getErrorCount() > errorCount) {
        return;
      }
    }
  }
  if (!"String_Node_Str".equals(currentType.getName())) {
    handler.error(this,"String_Node_Str" + getName() + "String_Node_Str",this.<Element>getData(MetadataRepository.XSD_DOM_ELEMENT),this.<Integer>getData(MetadataRepository.XSD_LINE_NUMBER),this.<Integer>getData(MetadataRepository.XSD_COLUMN_NUMBER),ValidationError.FOREIGN_KEY_NOT_STRING_TYPED);
  }
  referencedField.validate(handler);
  if (foreignKeyInfo != null) {
    errorCount=handler.getErrorCount();
    foreignKeyInfo.validate(handler);
    if (handler.getErrorCount() > errorCount) {
      return;
    }
    if (!isPrimitiveTypeField(foreignKeyInfo)) {
      handler.warning(foreignKeyInfo,"String_Node_Str",foreignKeyInfo.<Element>getData(MetadataRepository.XSD_DOM_ELEMENT),foreignKeyInfo.<Integer>getData(MetadataRepository.XSD_LINE_NUMBER),foreignKeyInfo.<Integer>getData(MetadataRepository.XSD_COLUMN_NUMBER),ValidationError.FOREIGN_KEY_INFO_NOT_STRING_TYPED);
    }
    if (foreignKeyInfo.isMany()) {
      handler.warning(foreignKeyInfo,"String_Node_Str",foreignKeyInfo.<Element>getData(MetadataRepository.XSD_DOM_ELEMENT),foreignKeyInfo.<Integer>getData(MetadataRepository.XSD_LINE_NUMBER),foreignKeyInfo.<Integer>getData(MetadataRepository.XSD_COLUMN_NUMBER),ValidationError.FOREIGN_KEY_INFO_REPEATABLE);
    }
  }
}