You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2020/07/10 22:16:43 UTC

[lucene-solr] 01/02: #57 Fix possible internal exception.

This is an automated email from the ASF dual-hosted git repository.

markrmiller pushed a commit to branch reference_impl
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit 90dee7b07d9dac1d8f6d4c8698346615567c2da8
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Fri Jul 10 17:13:52 2020 -0500

    #57 Fix possible internal exception.
---
 .../apache/solr/handler/admin/MetricsHandler.java  |  1 +
 .../org/apache/solr/util/ResourceLoaderAware.java  | 34 ++++++++++++++++++++++
 2 files changed, 35 insertions(+)

diff --git a/solr/core/src/java/org/apache/solr/handler/admin/MetricsHandler.java b/solr/core/src/java/org/apache/solr/handler/admin/MetricsHandler.java
index ce6983a..fab3998 100644
--- a/solr/core/src/java/org/apache/solr/handler/admin/MetricsHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/admin/MetricsHandler.java
@@ -360,6 +360,7 @@ public class MetricsHandler extends RequestHandlerBase implements PermissionName
       return new MetricFilter() {
         @Override
         public boolean matches(String name, Metric metric) {
+          if (metric == null && klass != null) return false;
           return klass == null || klass.isInstance(metric);
         }
       };
diff --git a/solr/core/src/java/org/apache/solr/util/ResourceLoaderAware.java b/solr/core/src/java/org/apache/solr/util/ResourceLoaderAware.java
new file mode 100644
index 0000000..a61ee46
--- /dev/null
+++ b/solr/core/src/java/org/apache/solr/util/ResourceLoaderAware.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.common.util;
+
+import java.io.IOException;
+
+/**
+ * Interface for a component that needs to be initialized by
+ * an implementation of {@link ResourceLoader}.
+ * 
+ * @see ResourceLoader
+ */
+public interface ResourceLoaderAware {
+
+  /**
+   * Initializes this component with the provided ResourceLoader
+   * (used for loading classes, files, etc).
+   */
+  void inform(ResourceLoader loader) throws IOException;
+}