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

NullPointerException when property is not present in context json #381

Open
fjtirado opened this issue Nov 26, 2024 · 0 comments · May be fixed by #382
Open

NullPointerException when property is not present in context json #381

fjtirado opened this issue Nov 26, 2024 · 0 comments · May be fixed by #382

Comments

@fjtirado
Copy link
Contributor

fjtirado commented Nov 26, 2024

I think the best way to ilustrate the issue is through a JQplay snapshpt
image

When trying to evalute that using the library, the code throws a null pointer exception

java.lang.NullPointerException: Cannot invoke "com.fasterxml.jackson.databind.JsonNode.isIntegralNumber()" because "lhs" is null
	at net.thisptr.jackson.jq.internal.operators.PlusOperator.apply(PlusOperator.java:19)
	at net.thisptr.jackson.jq.internal.tree.binaryop.assignment.ComplexAssignment.lambda$null$1(ComplexAssignment.java:41)
	at net.thisptr.jackson.jq.path.ObjectFieldPath.mutate(ObjectFieldPath.java:69)
	at net.thisptr.jackson.jq.path.ObjectFieldPath.lambda$mutate$1(ObjectFieldPath.java:52)
	at net.thisptr.jackson.jq.path.RootPath.mutate(RootPath.java:30)
	at net.thisptr.jackson.jq.path.ObjectFieldPath.mutate(ObjectFieldPath.java:51)
	at net.thisptr.jackson.jq.path.Path.mutate(Path.java:20)
	at net.thisptr.jackson.jq.internal.tree.binaryop.assignment.ComplexAssignment.lambda$apply$2(ComplexAssignment.java:41)
	at net.thisptr.jackson.jq.Output.emit(Output.java:14)
	at net.thisptr.jackson.jq.internal.tree.ArrayConstruction.apply(ArrayConstruction.java:28)
	at net.thisptr.jackson.jq.Expression.apply(Expression.java:11)
	at net.thisptr.jackson.jq.internal.tree.binaryop.assignment.ComplexAssignment.apply(ComplexAssignment.java:29)
	at net.thisptr.jackson.jq.Expression.apply(Expression.java:11)
	at io.serverlessworkflow.impl.expressions.JQExpression.eval(JQExpression.java:184)
	at io.serverlessworkflow.impl.executors.AbstractTaskExecutor.lambda$2(AbstractTaskExecutor.java:94)
	at java.base/java.util.Optional.ifPresent(Optional.java:178)
	at io.serverlessworkflow.impl.executors.AbstractTaskExecutor.apply(AbstractTaskExecutor.java:93)
	at io.serverlessworkflow.impl.WorkflowUtils.processTaskList(WorkflowUtils.java:155)
	at io.serverlessworkflow.impl.executors.ForExecutor.internalExecute(ForExecutor.java:55)
	at io.serverlessworkflow.impl.executors.AbstractTaskExecutor.apply(AbstractTaskExecutor.java:92)
	at io.serverlessworkflow.impl.WorkflowUtils.processTaskList(WorkflowUtils.java:155)
	at io.serverlessworkflow.impl.WorkflowInstance.<init>(WorkflowInstance.java:36)
	at io.serverlessworkflow.impl.WorkflowDefinition.execute(WorkflowDefinition.java:100)
	at io.serverlessworkflow.impl.WorkflowDefinitionTest.testWorkflowExecution(WorkflowDefinitionTest.java:44)
	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:992)
	at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
	at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:276)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:992)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
	at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:276)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
	at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:276)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
	at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:276)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)


fjtirado added a commit to fjtirado/jackson-jq that referenced this issue Nov 26, 2024
@fjtirado fjtirado linked a pull request Nov 26, 2024 that will close this issue
fjtirado added a commit to fjtirado/jackson-jq that referenced this issue Nov 26, 2024
fjtirado added a commit to fjtirado/jackson-jq that referenced this issue Nov 26, 2024
fjtirado added a commit to fjtirado/jackson-jq that referenced this issue Nov 26, 2024
fjtirado added a commit to fjtirado/jackson-jq that referenced this issue Nov 27, 2024
@fjtirado fjtirado changed the title NullPointerException when propery is not present in context json NullPointerException when property is not present in context json Dec 3, 2024
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 a pull request may close this issue.

1 participant