You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2021/07/12 19:59:28 UTC

[GitHub] [kafka] mumrah opened a new pull request #11029: MINOR: Handle some null cases in BrokerMetadataPublisher

mumrah opened a new pull request #11029:
URL: https://github.com/apache/kafka/pull/11029


   Found a few NPEs when running system tests. Added coverage for a few null cases in BrokerMetadataPublisher as well as a unit test


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kafka] mumrah merged pull request #11029: MINOR: Handle some null cases in BrokerMetadataPublisher

Posted by GitBox <gi...@apache.org>.
mumrah merged pull request #11029:
URL: https://github.com/apache/kafka/pull/11029


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kafka] chia7712 commented on a change in pull request #11029: MINOR: Handle some null cases in BrokerMetadataPublisher

Posted by GitBox <gi...@apache.org>.
chia7712 commented on a change in pull request #11029:
URL: https://github.com/apache/kafka/pull/11029#discussion_r671638916



##########
File path: core/src/main/scala/kafka/server/metadata/BrokerMetadataPublisher.scala
##########
@@ -46,8 +46,10 @@ object BrokerMetadataPublisher {
   def getTopicDelta(topicName: String,
                     newImage: MetadataImage,
                     delta: MetadataDelta): Option[TopicDelta] = {
-    Option(newImage.topics().getTopic(topicName)).map {
-      topicImage => delta.topicsDelta().changedTopic(topicImage.id())
+    Option(newImage.topics().getTopic(topicName)).flatMap {

Review comment:
       Is `newImage.topics()` never null? If so, should we add null check to constructor of `MetadataImage` to make sure input arguments are NOT null.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kafka] mumrah commented on a change in pull request #11029: MINOR: Handle some null cases in BrokerMetadataPublisher

Posted by GitBox <gi...@apache.org>.
mumrah commented on a change in pull request #11029:
URL: https://github.com/apache/kafka/pull/11029#discussion_r673368184



##########
File path: core/src/main/scala/kafka/server/metadata/BrokerMetadataPublisher.scala
##########
@@ -46,8 +46,10 @@ object BrokerMetadataPublisher {
   def getTopicDelta(topicName: String,
                     newImage: MetadataImage,
                     delta: MetadataDelta): Option[TopicDelta] = {
-    Option(newImage.topics().getTopic(topicName)).map {
-      topicImage => delta.topicsDelta().changedTopic(topicImage.id())
+    Option(newImage.topics().getTopic(topicName)).flatMap {

Review comment:
       There's just two usages of this constructor and they cannot provide nulls, so we can probably live without the null check




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kafka] mumrah commented on pull request #11029: MINOR: Handle some null cases in BrokerMetadataPublisher

Posted by GitBox <gi...@apache.org>.
mumrah commented on pull request #11029:
URL: https://github.com/apache/kafka/pull/11029#issuecomment-883610451


   Cherry-picked to 3.0 as 89c9c94f877


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org