atos1990 / orika

Automatically exported from code.google.com/p/orika
0 stars 0 forks source link

when creating a new object while mapping, null is not mapped when new object defines a default value #63

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Have a destination class that sets default value for a field
2. map from a source class that has the field set to null
3. map from source to destination creating a new object (i.e. 
mapper.map(sourceObject, DestinationObject.class)

What is the expected output? What do you see instead?

The field in the returned destination object should be null

What version of the product are you using? On what operating system?

orika-core 1.2.2 

Please provide any additional information below.

I have not tested this with an instance to instance mapping

Original issue reported on code.google.com by shriram....@gmail.com on 30 Oct 2012 at 12:36

GoogleCodeExporter commented 9 years ago
In the current master (1.3.6-SNAPSHOT) the decision of whether or not to map 
nulls has been made configurable (using 
DefaultMapperFactory.Builder#mapNulls(true|false) ). The default behavior still 
remains that nulls are mapped for back-compatibility. If you have opportunity, 
could you test the problem with the most current snapshot?

Original comment by matt.deb...@gmail.com on 5 Nov 2012 at 3:51

GoogleCodeExporter commented 9 years ago
Hi,

I have tried this again and it did not work. I pulled my testcase out into a 
standalone project and have attached it.

It may be a configuration / code error on my side but I do not have enough 
experience with Orika to be sure.

Happy to assist further if necessary.

Thanks,

Shri

Original comment by shriram....@gmail.com on 6 Nov 2012 at 4:59

Attachments:

GoogleCodeExporter commented 9 years ago
I erroneously left the mapNulls to false in the attached testcase. Please note 
that it still fails when set to true.

Original comment by shriram....@gmail.com on 6 Nov 2012 at 5:02

GoogleCodeExporter commented 9 years ago
I just committed a fix, please can verify, and let me know.
Thanks.

Original comment by elaat...@gmail.com on 7 Nov 2012 at 11:01

GoogleCodeExporter commented 9 years ago
Hello,

I can confirm FIXED.

Thank you,

Shri

Original comment by shriram....@gmail.com on 7 Nov 2012 at 11:30