-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Recent changes to providers broke ValueNode.asValueListNode #378
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
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
java.lang.ClassCastException: com.fasterxml.jackson.databind.node.ArrayNode cannot be cast to java.util.List at com.jayway.jsonpath.internal.filter.ValueNode.asValueListNode(ValueNode.java:341) at com.jayway.jsonpath.internal.filter.EvaluatorFactory.evaluate(EvaluatorFactory.java:274) at com.jayway.jsonpath.internal.filter.RelationalExpressionNode.apply(RelationalExpressionNode.java:44) at com.jayway.jsonpath.internal.filter.LogicalExpressionNode.apply(LogicalExpressionNode.java:84) at com.jayway.jsonpath.internal.filter.FilterCompiler.apply(FilterCompiler.java:415) at com.jayway.jsonpath.internal.path.PredicatePathToken.accept(PredicatePathToken.java:76) at com.jayway.jsonpath.internal.path.PredicatePathToken.evaluate(PredicatePathToken.java:46) at com.jayway.jsonpath.internal.path.PathToken.handleObjectProperty(PathToken.java:81) at com.jayway.jsonpath.internal.path.WildcardPathToken.evaluate(WildcardPathToken.java:35) at com.jayway.jsonpath.internal.path.PathToken.handleObjectProperty(PathToken.java:81) at com.jayway.jsonpath.internal.path.PropertyPathToken.evaluate(PropertyPathToken.java:79) at com.jayway.jsonpath.internal.path.RootPathToken.evaluate(RootPathToken.java:62) at com.jayway.jsonpath.internal.path.CompiledPath.evaluate(CompiledPath.java:53) at com.jayway.jsonpath.internal.path.CompiledPath.evaluate(CompiledPath.java:61) at com.jayway.jsonpath.JsonPath.read(JsonPath.java:187) at com.jayway.jsonpath.internal.JsonContext.read(JsonContext.java:102) at com.jayway.jsonpath.internal.filter.ValueNodeTest.testOneNtpServer(ValueNodeTest.java:77) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner.run(ParentRunner.java:290) at org.junit.runners.ParentRunner.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access-zsh(ParentRunner.java:58) at org.junit.runners.ParentRunner.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68) at com.intellij.rt.execution.junit.IdeaTestRunner.startRunnerWithArgs(IdeaTestRunner.java:47) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70) java.lang.ClassCastException: com.fasterxml.jackson.databind.node.ArrayNode cannot be cast to java.util.List at com.jayway.jsonpath.internal.filter.ValueNode.asValueListNode(ValueNode.java:341) at com.jayway.jsonpath.internal.filter.EvaluatorFactory.evaluate(EvaluatorFactory.java:274) at com.jayway.jsonpath.internal.filter.RelationalExpressionNode.apply(RelationalExpressionNode.java:44) at com.jayway.jsonpath.internal.filter.LogicalExpressionNode.apply(LogicalExpressionNode.java:84) at com.jayway.jsonpath.internal.filter.FilterCompiler.apply(FilterCompiler.java:415) at com.jayway.jsonpath.internal.path.PredicatePathToken.accept(PredicatePathToken.java:76) at com.jayway.jsonpath.internal.path.PredicatePathToken.evaluate(PredicatePathToken.java:46) at com.jayway.jsonpath.internal.path.PathToken.handleObjectProperty(PathToken.java:81) at com.jayway.jsonpath.internal.path.WildcardPathToken.evaluate(WildcardPathToken.java:35) at com.jayway.jsonpath.internal.path.PathToken.handleObjectProperty(PathToken.java:81) at com.jayway.jsonpath.internal.path.PropertyPathToken.evaluate(PropertyPathToken.java:79) at com.jayway.jsonpath.internal.path.RootPathToken.evaluate(RootPathToken.java:62) at com.jayway.jsonpath.internal.path.CompiledPath.evaluate(CompiledPath.java:53) at com.jayway.jsonpath.internal.path.CompiledPath.evaluate(CompiledPath.java:61) at com.jayway.jsonpath.JsonPath.read(JsonPath.java:187) at com.jayway.jsonpath.internal.JsonContext.read(JsonContext.java:102) at com.jayway.jsonpath.internal.filter.ValueNodeTest.testOneNtpServer(ValueNodeTest.java:77) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner.run(ParentRunner.java:290) at org.junit.runners.ParentRunner.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access-zsh(ParentRunner.java:58) at org.junit.runners.ParentRunner.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68) at com.intellij.rt.execution.junit.IdeaTestRunner.startRunnerWithArgs(IdeaTestRunner.java:47) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Contributor
Author
|
@kallestenflo @jochenberger any ideas about this issue? |
jochenberger
added a commit
to jochenberger/JsonPath
that referenced
this pull request
Aug 15, 2017
kallestenflo
added a commit
that referenced
this pull request
Aug 16, 2017
convert lists and maps for ValueNode (fixes #378)
cmunilla
pushed a commit
to cmunilla/JPath
that referenced
this pull request
Oct 30, 2017
cmunilla
pushed a commit
to cmunilla/JPath
that referenced
this pull request
Oct 30, 2017
convert lists and maps for ValueNode (fixes json-path#378)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See the test in this PR. The stack trace is below.
Some points of data:
The broken code seems to have been introduced in use json-smart to parse the query #314
The issue here seems to be a mismatch when
parsed = true: thenparse(ctx)will use the already-parsed version. However, the only way thatparsed = trueis actually when the pre-parsed object has been passed into this class via constructor; and it will necessarily have gone through the user's provider, not JsonSmart, in this case.Any advice is appreciated -- we have a hack around the issue but I'm not very confident in it.
(We simply revert the code that uses JsonSmart, after configuring the Jackson[Node]JsonProvider to allow single quotes.)