You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/02/02 03:36:01 UTC

[jira] [Commented] (KAFKA-6370) MirrorMakerIntegrationTest#testCommaSeparatedRegex may fail due to NullPointerException

    [ https://issues.apache.org/jira/browse/KAFKA-6370?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16349728#comment-16349728 ] 

ASF GitHub Bot commented on KAFKA-6370:
---------------------------------------

huxihx closed pull request #4327: KAFKA-6370: KafkaMetricsGroup.toScope should filter out tags null value
URL: https://github.com/apache/kafka/pull/4327
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/core/src/main/scala/kafka/metrics/KafkaMetricsGroup.scala b/core/src/main/scala/kafka/metrics/KafkaMetricsGroup.scala
index 75eaafd720a..f2c460b2148 100644
--- a/core/src/main/scala/kafka/metrics/KafkaMetricsGroup.scala
+++ b/core/src/main/scala/kafka/metrics/KafkaMetricsGroup.scala
@@ -162,7 +162,7 @@ object KafkaMetricsGroup extends KafkaMetricsGroup with Logging {
   }
 
   private def toScope(tags: collection.Map[String, String]): Option[String] = {
-    val filteredTags = tags.filter { case (_, tagValue) => tagValue != ""}
+    val filteredTags = tags.filter { case (_, tagValue) => tagValue != null && !tagValue.isEmpty}
     if (filteredTags.nonEmpty) {
       // convert dot to _ since reporters like Graphite typically use dot to represent hierarchy
       val tagsString = filteredTags


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> MirrorMakerIntegrationTest#testCommaSeparatedRegex may fail due to NullPointerException
> ---------------------------------------------------------------------------------------
>
>                 Key: KAFKA-6370
>                 URL: https://issues.apache.org/jira/browse/KAFKA-6370
>             Project: Kafka
>          Issue Type: Bug
>            Reporter: Ted Yu
>            Assignee: huxihx
>            Priority: Minor
>              Labels: mirror-maker
>
> From https://builds.apache.org/job/kafka-trunk-jdk8/2277/testReport/junit/kafka.tools/MirrorMakerIntegrationTest/testCommaSeparatedRegex/ :
> {code}
> java.lang.NullPointerException
> 	at scala.collection.immutable.StringLike.$anonfun$format$1(StringLike.scala:351)
> 	at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:234)
> 	at scala.collection.IndexedSeqOptimized.foreach(IndexedSeqOptimized.scala:32)
> 	at scala.collection.IndexedSeqOptimized.foreach$(IndexedSeqOptimized.scala:29)
> 	at scala.collection.mutable.WrappedArray.foreach(WrappedArray.scala:38)
> 	at scala.collection.TraversableLike.map(TraversableLike.scala:234)
> 	at scala.collection.TraversableLike.map$(TraversableLike.scala:227)
> 	at scala.collection.AbstractTraversable.map(Traversable.scala:104)
> 	at scala.collection.immutable.StringLike.format(StringLike.scala:351)
> 	at scala.collection.immutable.StringLike.format$(StringLike.scala:350)
> 	at scala.collection.immutable.StringOps.format(StringOps.scala:29)
> 	at kafka.metrics.KafkaMetricsGroup$.$anonfun$toScope$3(KafkaMetricsGroup.scala:170)
> 	at scala.collection.immutable.List.map(List.scala:283)
> 	at kafka.metrics.KafkaMetricsGroup$.kafka$metrics$KafkaMetricsGroup$$toScope(KafkaMetricsGroup.scala:170)
> 	at kafka.metrics.KafkaMetricsGroup.explicitMetricName(KafkaMetricsGroup.scala:67)
> 	at kafka.metrics.KafkaMetricsGroup.explicitMetricName$(KafkaMetricsGroup.scala:51)
> 	at kafka.network.RequestMetrics.explicitMetricName(RequestChannel.scala:352)
> 	at kafka.metrics.KafkaMetricsGroup.metricName(KafkaMetricsGroup.scala:47)
> 	at kafka.metrics.KafkaMetricsGroup.metricName$(KafkaMetricsGroup.scala:42)
> 	at kafka.network.RequestMetrics.metricName(RequestChannel.scala:352)
> 	at kafka.metrics.KafkaMetricsGroup.newHistogram(KafkaMetricsGroup.scala:81)
> 	at kafka.metrics.KafkaMetricsGroup.newHistogram$(KafkaMetricsGroup.scala:80)
> 	at kafka.network.RequestMetrics.newHistogram(RequestChannel.scala:352)
> 	at kafka.network.RequestMetrics.<init>(RequestChannel.scala:364)
> 	at kafka.network.RequestChannel$Metrics.$anonfun$new$2(RequestChannel.scala:57)
> 	at scala.collection.mutable.ResizableArray.foreach(ResizableArray.scala:59)
> 	at scala.collection.mutable.ResizableArray.foreach$(ResizableArray.scala:52)
> 	at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:48)
> 	at kafka.network.RequestChannel$Metrics.<init>(RequestChannel.scala:56)
> 	at kafka.network.RequestChannel.<init>(RequestChannel.scala:243)
> 	at kafka.network.SocketServer.<init>(SocketServer.scala:71)
> 	at kafka.server.KafkaServer.startup(KafkaServer.scala:238)
> 	at kafka.utils.TestUtils$.createServer(TestUtils.scala:135)
> 	at kafka.integration.KafkaServerTestHarness.$anonfun$setUp$1(KafkaServerTestHarness.scala:93)
> {code}
> Here is the code from KafkaMetricsGroup.scala :
> {code}
>         .map { case (key, value) => "%s.%s".format(key, value.replaceAll("\\.", "_"))}
> {code}
> It seems (some) value was null.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)