-
Notifications
You must be signed in to change notification settings - Fork 121
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
Assignment test + NPE fix #490
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.
LGTM, maybe there is something that @ppatierno will see :)
@@ -357,6 +357,7 @@ private void partitionsAssignmentAndSeek() { | |||
Optional<PartitionInfo> requestedPartitionInfo = | |||
availablePartitions.stream() | |||
.filter(p -> p.getTopic().equals(topicSubscription.getTopic()) && | |||
topicSubscription.getPartition() != null && |
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.
can you explain in which case this can be null
?
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.
If we do subscribe to a topic, it is stored into topicSubscriptions
. Subscription request body might be for example
{
"topics": [
"topic1",
"topic2"
]
}
If we do assign after subscription (what is wrong because of exclusivity), we iterate through all topic subscriptions in topicSubscriptions
and we are trying to get partitions. And because the subscription body does not have any partitions info, it is null. Then just comparing null causes NPE.
src/main/java/io/strimzi/kafka/bridge/http/HttpSinkBridgeEndpoint.java
Outdated
Show resolved
Hide resolved
src/test/java/io/strimzi/kafka/bridge/http/ConsumerSubscriptionTest.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Stanislav Knot <[email protected]>
Signed-off-by: Stanislav Knot <[email protected]>
Signed-off-by: Stanislav Knot <[email protected]>
Signed-off-by: Stanislav Knot <[email protected]>
Signed-off-by: Stanislav Knot <[email protected]>
fb56fc8
to
d0219bc
Compare
Signed-off-by: Stanislav Knot [email protected]
Assigment endpoint does not have any tests.
Trying to access
subscribe
andassign
endpoints ends up with NPE. After fix of NPE, it does not return 409 (Conflict).Fixes #489