-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Small TCK fix in cancelled sink #24749
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, we even had a comment there explaining the need to throw that NPE but seems we didn't; thanks
The test looks fine
@@ -186,6 +186,9 @@ import scala.util.control.NonFatal | |||
case Inert ⇒ // nothing to be done | |||
case _ ⇒ ErrorPublisher(ex, "failed-VirtualProcessor").subscribe(s) | |||
} | |||
case _ if t == null ⇒ | |||
// cancelled before onError(null), must throw NPE, rule 2:13 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2.13
please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had 2:13
because I copied the comment from a previous line, but I've updated both now.
@@ -186,6 +186,9 @@ import scala.util.control.NonFatal | |||
case Inert ⇒ // nothing to be done | |||
case _ ⇒ ErrorPublisher(ex, "failed-VirtualProcessor").subscribe(s) | |||
} | |||
case _ if t == null ⇒ | |||
// cancelled before onError(null), must throw NPE, rule 2:13 | |||
throw ex |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, might be good to throw ReactiveStreamsCompliance.exceptionMustNotBeNullException
instead so it's more explanatory than a raw NPE?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nevermind, just noticed the line below which github had folded, it's all good
Thanks, LGTM :) weird that we had the : style there... Thanks for fixing |
To be merged once validation passed |
There's still actually one case that does't throw the NPE, not sure if you want me to fix it as well or not - it's the case where |
Test PASSed. |
Test PASSed. |
Hmm, yeah that's a weird case. I guess we should throw then as well, if someone does such incorrect invocation; let's have a look at it in a separate PR though? I'll merge this one as it's clear cut and a nice improvement -- thanks! |
This fix was regressed in #24722. |
…nvoked This fix is similar to akka#24749, fixing a spec violation bug that was introduced in akka#24722.
…nvoked This fix is similar to akka#24749, fixing a spec violation bug that was introduced in akka#24722.
…nvoked This fix is similar to akka#24749, fixing a spec violation bug that was introduced in akka#24722.
…nvoked This fix is similar to akka#24749, fixing a spec violation bug that was introduced in akka#24722.
When the sink is cancelled immediately (as
Sink.cancelled
does), ifonError(null)
is called, Akka still has to throw an NPE, which it wasn't doing.Not sure if the TCK test added is ok - the cancelled sink never signals demand so I skipped the three specs that require that. That leaves 8 rules that this test still validates.