mirror of https://github.com/apache/lucene.git
SOLR-10362 Be more specific when catching this exception.
This commit is contained in:
parent
1ace1740d9
commit
30f7914c3b
|
@ -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;
|
||||
|
|
|
@ -81,8 +81,8 @@ public class MetricUtilsTest extends SolrTestCaseJ4 {
|
|||
am.set("bar", 2);
|
||||
Gauge<String> gauge = () -> "foobar";
|
||||
registry.register("gauge", gauge);
|
||||
Gauge<Long> error = () -> {throw new InternalError("expected error");};
|
||||
registry.register("expected.error", error);
|
||||
Gauge<Long> 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<String, Object>)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<String, Object>)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;
|
||||
|
|
Loading…
Reference in New Issue