Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting "filter ... can not be applied to primitives" with 2.7.0 despite Option.SUPPRESS_EXCEPTIONS #840

Open
jkuipers opened this issue May 31, 2022 · 1 comment

Comments

@jkuipers
Copy link

jsonpath-issue.zip

This project shows how using json-path with Jackson in version 2.6.0 to apply a path expression to a file without matches works as expected, but throws an InvalidPathException with 2.7.0 while the Option.SUPPRESS_EXCEPTIONS has been enabled.

@Bonnev
Copy link

Bonnev commented Jul 31, 2023

For reference:

Path: $.Services[?(@.Name == 'CreditManagement3')].Parameters[?(@.Name == 'InvoiceKey')].Value

JSON:

{
    ...
    "Services": null,
    ...
}

So basically the issue occurs when, somewhere along the path, there are no longer any results while the path continues. Here it reaches Services and needs to further step into the json, but there is nowhere to go.

I wrote another issue (#951) but now that i analyze, it looks like it is very similar to this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants