[
https://issues.apache.org/jira/browse/AIRAVATA-3328?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17140007#comment-17140007
]
Marcus Christie edited comment on AIRAVATA-3328 at 6/18/20, 9:55 PM:
---------------------------------------------------------------------
deleted
was (Author: marcuschristie):
The problem is that there isn't a great test to figure out if a field has a
default value or not. What I did in CustomBeanFactory is see if the field has a
value. However, if the field is primitive (for example, {{long}}), then it will
have a default value as a Java primitive.
I'm rethinking my decision [in this comment
above|https://issues.apache.org/jira/browse/AIRAVATA-3328?focusedCommentId=17113199&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-17113199]
to call setters for all fields with a default value. I think now I'll revert
that to only do this for *required* fields.
> Fix Thrift/Dozer incompatibilty in Java 11
> ------------------------------------------
>
> Key: AIRAVATA-3328
> URL: https://issues.apache.org/jira/browse/AIRAVATA-3328
> Project: Airavata
> Issue Type: New Feature
> Components: Registry API
> Reporter: Marcus Christie
> Assignee: Marcus Christie
> Priority: Major
>
> 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|https://issues.apache.org/jira/browse/AIRAVATA-3268?focusedCommentId=16978768&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-16978768]
> and following.
> I think, as noted in [this
> comment|https://issues.apache.org/jira/browse/AIRAVATA-3268?focusedCommentId=16979609&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-16979609],
> that we can create a [Dozer Custom Bean
> Factory|https://dozermapper.github.io/gitbook/documentation/custombeanfactories.html]
> 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
--
This message was sent by Atlassian Jira
(v8.3.4#803005)