SOLR-9805 Fix NPE.

This commit is contained in:
Andrzej Bialecki 2016-12-23 23:01:47 +01:00
parent bc8936a567
commit 687f03661d
1 changed files with 1 additions and 1 deletions

View File

@ -44,7 +44,7 @@ public class JvmMetricsTest extends SolrJettyTestBase {
assertTrue(metrics.size() > 0); assertTrue(metrics.size() > 0);
for (String metric : OperatingSystemMetricSet.METRICS) { for (String metric : OperatingSystemMetricSet.METRICS) {
Gauge<?> gauge = (Gauge<?>)metrics.get(metric); Gauge<?> gauge = (Gauge<?>)metrics.get(metric);
if (gauge == null) { // some are optional depending on OS if (gauge == null || gauge.getValue() == null) { // some are optional depending on OS
continue; continue;
} }
double value = ((Number)gauge.getValue()).doubleValue(); double value = ((Number)gauge.getValue()).doubleValue();