-
Notifications
You must be signed in to change notification settings - Fork 620
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
Null returned value with function composition throws an NPE in between functions #1117
Comments
@mborgraeve To handle situations like these, you can rely on the
Frameworks are aware of the |
Thanks for your answer ! BUT. I oversimplified the demo project, we don't actually return Object in the signature, we have a domain object, so are unable to return this type, and some cases where we don't use Kafka but Rabbit, and would like to avoid pulling a Kafka dependency. We can tweak our framework to handle I digged a bit into the Spring Function composition (as in use the |
@mborgraeve In that case, I think this needs to be addressed from Spring Cloud Function as that is the framework that |
@olegz What do you think about this request? I think this is doable and a reasonable one to address. |
I would be glad to execute it if directed a bit. |
I don't see an issue with function returning null and the fix appears to be quite simple. |
Hi,
So, I'm not sure if this is an actual issue or if it is designed that way, feel free to let me know of course !
Describe the issue
We are using Spring Cloud Stream with function composition.
In some cases, we want to continue processing some message, in some cases we don't.
When we don't, we are able to return a
null
value from the last function in the composition, and no message outputs the chain of function.The issue appear when a function returns a
null
but isn't the last one in the chain.To Reproduce
I've got a minimal project demonstrating this in two integration tests at https://github.com/mborgraeve/demo-scs-bean-loop/tree/npe
For example:
Version of the framework
This happens in 2022.0.3, 2022.0.4, 2023.0.0.
Expected behavior
We wouldn't expect a NPE stack trace, and would expect the message to be silently dropped.
Screenshots
Additional context
For reference, the stacktrace is copied below. It looks like it tries to convert the message, but fail because it's null
The text was updated successfully, but these errors were encountered: