Skip to content

Conversation

@dhalperi
Copy link
Contributor

See the test in this PR. The stack trace is below.

Some points of data:

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.)

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)

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)
@dhalperi dhalperi changed the title Recent changes to provides broke ValueNode.asValueListNode Recent changes to providers broke ValueNode.asValueListNode Jul 27, 2017
@dhalperi
Copy link
Contributor Author

dhalperi commented Aug 14, 2017

@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)
@dhalperi dhalperi deleted the asValueListNodeBug branch November 2, 2017 17:05
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

Successfully merging this pull request may close these issues.

1 participant