You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ab...@apache.org on 2017/03/29 13:26:40 UTC

lucene-solr:master: SOLR-10362 Be more specific when catching this exception.

Repository: lucene-solr
Updated Branches:
  refs/heads/master 1ace1740d -> 30f7914c3


SOLR-10362 Be more specific when catching this exception.


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/30f7914c
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/30f7914c
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/30f7914c

Branch: refs/heads/master
Commit: 30f7914c3b8ed990fcc0812f10de21722e96469f
Parents: 1ace174
Author: Andrzej Bialecki <ab...@apache.org>
Authored: Wed Mar 29 14:42:20 2017 +0200
Committer: Andrzej Bialecki <ab...@apache.org>
Committed: Wed Mar 29 15:26:33 2017 +0200

----------------------------------------------------------------------
 .../src/java/org/apache/solr/util/stats/MetricUtils.java     | 8 ++++++--
 .../src/test/org/apache/solr/util/stats/MetricUtilsTest.java | 8 ++++----
 2 files changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/30f7914c/solr/core/src/java/org/apache/solr/util/stats/MetricUtils.java
----------------------------------------------------------------------
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 9809070..491932d 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;

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/30f7914c/solr/core/src/test/org/apache/solr/util/stats/MetricUtilsTest.java
----------------------------------------------------------------------
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 fe98157..aa02de5 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<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;