-
Notifications
You must be signed in to change notification settings - Fork 47
class property setters with null
checks makes Typed JsonPatchDocument tests fail.
#32
Comments
null
checks like the following makes 15 tests fail.null
checks makes Typed JsonPatchDocument tests fail.
@wannado out of curiosity, was the PATCH trying to clear out the value? That is, if the PATCH "document" was indicating that the property needed to be cleared, then I would expect this to happen because the property is indicating that it can't be cleared. Or is the PATCH document just trying to set a new value (e.g. change property from "foo" to "bar")? |
@Eilon Thanks for looking in to it!!! Yes patch document had "op" as "replace", as you said, just trying to set a new value (e.g. change property from "foo" to "bar". |
@wannado ah ok then that indeed sounds like a bug. We'll take a look! |
We are hitting this as well when we are trying to convert a string to an enum in a setter, e.g.
|
@jbagga can you take a look? |
I cannot repro this. @ryanwalls what kind of operation are you trying to do when you hit this issue? for example, if you were trying to do a 'move' operation, the value of source property is copied onto the destination property and the source property would be set to its default value (in case of 'string' since its a reference type, it would be set to null). |
Update: I was able to repro it on 1.0...In this version during a Replace operation, a Remove operation is run first and then an Add and in case of Remove operation the default value for a type is set because of which we are seeing this exception. |
@ryanwalls @wannado Are you able to reproduce this? As @kichalla noted, there have been changes to the |
I'm doing a "replace" operation with version 1.1.0. |
@ryanwalls I have tried to reproduce this issue with @Eilon Also, adding tests to |
@jbagga No worries. If you've ensured null checks work in 2.0.0, I'll just wait to update. We've worked around the problem for now. |
Closing this as it cannot be reproduced for 1.1.0. Added tests to ensure property setters with null checks do not throw for Please feel free to reopen this issue if you have a repro sample app for 1.1.0. We can investigate this further then! |
class property setters with
null
checks like the following makes tests fail.Eg. I added a backing field for SimpleDTO.StringProperty with a null check like the following.
These tests appear in NestedObjectsTests and ObjectAdapterTests class.
The text was updated successfully, but these errors were encountered: