You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by GitBox <gi...@apache.org> on 2022/10/26 18:50:48 UTC

[GitHub] [solr] risdenk commented on a diff in pull request #1133: SOLR-16501: Fix JvmMetricsTest NPE

risdenk commented on code in PR #1133:
URL: https://github.com/apache/solr/pull/1133#discussion_r1006071283


##########
solr/core/src/test/org/apache/solr/metrics/JvmMetricsTest.java:
##########
@@ -92,9 +91,10 @@ public void testSystemProperties() {
     }
     SolrMetricManager metricManager = jetty.getCoreContainer().getMetricManager();
     Map<String, Metric> metrics = metricManager.registry("solr.jvm").getMetrics();
-    MetricsMap map =
-        (MetricsMap) ((SolrMetricManager.GaugeWrapper) metrics.get("system.properties")).getGauge();
-    assertNotNull(map);
+    Metric metric = metrics.get("system.properties");
+    assertNotNull(metrics.toString(), metric);
+    MetricsMap map = (MetricsMap) ((SolrMetricManager.GaugeWrapper<?>) metric).getGauge();
+    assertNotNull(metrics.toString(), map);

Review Comment:
   This addresses the NPE by adding an assertion. Doesn't fix the underlying cause - haven't found one yet.



-- 
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: issues-unsubscribe@solr.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org