Uploaded image for project: 'Airavata'
  1. Airavata
  2. AIRAVATA-3328

Fix Thrift/Dozer incompatibilty in Java 11

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • None
    • Registry API
    • None

    Description

      Thrift required fields can have a default value. This value is present in the generated models, but it is only serialized if the field has actually been set. The semantics on required fields with default values seems a little confusing.

      This causes an issue with Dozer since it has logic to only copy fields when they differ. A field on an entity will only copy to a Thrift data model field when they have the same value. If the field on the entity has the default value of the Thrift field, then it won't copy and that field will not get serialized. This then causes a validation error in Thrift since the required field wasn't set.

      This problem was initially discoverred in AIRAVATA-3268, see this comment and following.

      I think, as noted in this comment, that we can create a Dozer Custom Bean Factory to fix this.

      TODO

      • [x] Test that CustomBeanFactory does "set" required fields that have a default value
      • [x] Test that CustomBeanFactory does "set" optional fields that have a default value
      • [x] Test that ObjectMapperSingleton maps required default fields appropriately and they have a value even if there is no corresponding field on the source object. Basically this tests that the ObjectMapperSingleton is correctly configured to use the CustomBeanFactory

      Attachments

        Issue Links

          Activity

            People

              marcuschristie Marcus Christie
              marcuschristie Marcus Christie
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: