diff --git a/solr/core/src/java/org/apache/solr/util/stats/MetricUtils.java b/solr/core/src/java/org/apache/solr/util/stats/MetricUtils.java index 9809070de6a..491932d1a8d 100644 --- a/solr/core/src/java/org/apache/solr/util/stats/MetricUtils.java +++ b/solr/core/src/java/org/apache/solr/util/stats/MetricUtils.java @@ -215,8 +215,12 @@ public class MetricUtils { try { consumer.accept(n, convertGauge(gauge, compact)); } catch (InternalError ie) { - LOG.warn("Error converting gauge '" + n + "', possible JDK bug: SOLR-10362", ie); - consumer.accept(n, null); + if (n.startsWith("memory.") && ie.getMessage().contains("Memory Pool not found")) { + LOG.warn("Error converting gauge '" + n + "', possible JDK bug: SOLR-10362", ie); + consumer.accept(n, null); + } else { + throw ie; + } } } else if (metric instanceof Meter) { Meter meter = (Meter) metric; diff --git a/solr/core/src/test/org/apache/solr/util/stats/MetricUtilsTest.java b/solr/core/src/test/org/apache/solr/util/stats/MetricUtilsTest.java index fe9815711df..aa02de5cdf1 100644 --- a/solr/core/src/test/org/apache/solr/util/stats/MetricUtilsTest.java +++ b/solr/core/src/test/org/apache/solr/util/stats/MetricUtilsTest.java @@ -81,8 +81,8 @@ public class MetricUtilsTest extends SolrTestCaseJ4 { am.set("bar", 2); Gauge gauge = () -> "foobar"; registry.register("gauge", gauge); - Gauge error = () -> {throw new InternalError("expected error");}; - registry.register("expected.error", error); + Gauge error = () -> {throw new InternalError("Memory Pool not found error");}; + registry.register("memory.expected.error", error); MetricUtils.toMaps(registry, Collections.singletonList(MetricFilter.ALL), MetricFilter.ALL, false, false, false, (k, o) -> { Map v = (Map)o; @@ -108,7 +108,7 @@ public class MetricUtilsTest extends SolrTestCaseJ4 { update = (Map)values.get("bar"); assertEquals(2, update.get("value")); assertEquals(2, update.get("updateCount")); - } else if (k.startsWith("expected.error")) { + } else if (k.startsWith("memory.expected.error")) { assertNull(v); } }); @@ -147,7 +147,7 @@ public class MetricUtilsTest extends SolrTestCaseJ4 { update = (Map)values.get("bar"); assertEquals(2, update.get("value")); assertEquals(2, update.get("updateCount")); - } else if (k.startsWith("expected.error")) { + } else if (k.startsWith("memory.expected.error")) { assertNull(o); } else { Map v = (Map)o;