catnap icon indicating copy to clipboard operation
catnap copied to clipboard

Checking null in CatnapEqualityExpression.isEqual method for the json nodes missing elements.

Open Chinna-SHS opened this issue 8 years ago • 2 comments

https://github.com/gregwhitaker/catnap/blob/b637dd505b97894875f9e459aee6bb81570438d3/catnap-core/src/main/java/com/github/gregwhitaker/catnap/core/query/model/CatnapEqualityExpression.java#L80

hi Greg, In the following response scenario if the filter key is not available in some node then I am getting null pointer exception. Could you please check this below?

  1. Let's say given filter is like below ?fields=items[key=1]

  2. Let's say response from service is like below. "key" element is missing in third node. We are trying to filter with "key=1". In this case , line number 80 is throwing null pointer exception as there is no key and value is null. We should return false in that case. What do you think?

{"items": [ { "key": "1", "value": "v1" }, { "key": "2", "value": "v2" }, {"value": "v3"} ]}

Chinna-SHS avatar Sep 20 '17 08:09 Chinna-SHS

I've got a fix for this that I can push soon.

gregwhitaker avatar Sep 24 '17 22:09 gregwhitaker

Thanks.

Chinna-SHS avatar Sep 26 '17 20:09 Chinna-SHS