gravity9-tech / json-patch-path

An RFC 6902 (JSON Patch) and reverse, plus RFC 7386 (JSON Merge Patch), implementation in Java using Jackson (2.x)
Other
11 stars 1 forks source link

class java.util.LinkedHashMap cannot be cast to class java.util.Collection #55

Closed piotr-bugara-gravity9 closed 1 year ago

piotr-bugara-gravity9 commented 1 year ago

Issue copied from: https://github.com/json-path/JsonPath/issues/843

Unit tests: https://github.com/pbugara/JsonPath/commit/9111d376247c57a799f1936e7d672352507869ab

I found bug in ValueNodes interface in method isEmpty: https://github.com/json-path/JsonPath/blob/master/json-path/src/main/java/com/jayway/jsonpath/internal/filter/ValueNodes.java#L173

When result of parse(ctx) is type of map, it's failing with following error: class java.util.LinkedHashMap cannot be cast to class java.util.Collection (java.util.LinkedHashMap and java.util.Collection are in module java.base of loader 'bootstrap')

It's showing because Map doesn't implement Collection interface.

piotr-bugara-gravity9 commented 1 year ago

Cannot resolve it in our lib. Bug is in JsonPath library