Apache Lucene open-source search software
SOLR-7101: JmxMonitoredMap can throw an exception in clear when queryNames fails.
Mark Robert Millerd0ca43081f07
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex ab676072507..f6b17e85b07 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -125,6 +125,9 @@ Bug Fixes* SOLR-5890: Delete silently fails if not sent to shard where document wasadded (Ishan Chattopadhyaya, Noble Paul)+* SOLR-7101: JmxMonitoredMap can throw an exception in clear when queryNames fails.+ (Mark Miller, Wolfgang Hoschek)+Optimizations----------------------* SOLR-7049: Move work done by the LIST Collections API call to the Collectionsdiff --git a/solr/core/src/java/org/apache/solr/core/JmxMonitoredMap.java b/solr/core/src/java/org/apache/solr/core/JmxMonitoredMap.javaindex e10bf3be6eb..0328a685fa1 100644--- a/solr/core/src/java/org/apache/solr/core/JmxMonitoredMap.java+++ b/solr/core/src/java/org/apache/solr/core/JmxMonitoredMap.java@@ -117,13 +117,20 @@ public class JmxMonitoredMap<K, V> extendspublic void clear() {if (server != null) {QueryExp exp = Query.eq(Query.attr("coreHashCode"), Query.value(coreHashCode));- Set<ObjectName> objectNames = server.queryNames(null, exp);++ Set<ObjectName> objectNames = null;+ try {+ objectNames = server.queryNames(null, exp);+ } catch (Exception e) {+ LOG.warn("Exception querying for mbeans", e);+ }+if (objectNames != null) {for (ObjectName name : objectNames) {try {server.unregisterMBean(name);} catch (Exception e) {- LOG.error("Exception un-registering mbean {}", name, e);+ LOG.warn("Exception un-registering mbean {}", name, e);}}}