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

dsmiley pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/main by this push:
     new eebb3815309 SOLR-17625: Remove NamedList.findRecursive
eebb3815309 is described below

commit eebb3815309bf43a5c88079ff3ba1a111b995588
Author: David Smiley <[email protected]>
AuthorDate: Mon Jun 2 00:53:05 2025 -0400

    SOLR-17625: Remove NamedList.findRecursive
    
    In 10x only -- was deprecated and unused.
---
 .../org/apache/solr/common/util/NamedList.java     | 64 ----------------------
 1 file changed, 64 deletions(-)

diff --git a/solr/solrj/src/java/org/apache/solr/common/util/NamedList.java 
b/solr/solrj/src/java/org/apache/solr/common/util/NamedList.java
index b59d8c779a5..a56a2784cd0 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/NamedList.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/NamedList.java
@@ -328,70 +328,6 @@ public class NamedList<T>
     }
   }
 
-  /**
-   * Recursively parses the NamedList structure to arrive at a specific 
element. As you descend the
-   * NamedList tree, the last element can be any type, including NamedList, 
but the previous
-   * elements MUST be NamedList objects themselves. A null value is returned 
if the indicated
-   * hierarchy doesn't exist, but NamedList allows null values so that could 
be the actual value at
-   * the end of the path.
-   *
-   * <p>This method is particularly useful for parsing the response from 
Solr's /admin/mbeans
-   * handler, but it also works for any complex structure.
-   *
-   * <p>Explicitly casting the return value is recommended. An even safer 
option is to accept the
-   * return value as an object and then check its type.
-   *
-   * <p>Usage examples:
-   *
-   * <p>String coreName = (String) response.findRecursive ("solr-mbeans", 
"CORE", "core", "stats",
-   * "coreName"); long numDoc = (long) response.findRecursive ("solr-mbeans", 
"CORE", "searcher",
-   * "stats", "numDocs");
-   *
-   * @param args One or more strings specifying the tree to navigate.
-   * @return the last entry in the given path hierarchy, null if not found.
-   * @deprecated use {@link org.apache.solr.common.NavigableObject} methods 
instead
-   */
-  @Deprecated
-  public Object findRecursive(String... args) {
-    NamedList<?> currentList = null;
-    Object value = null;
-    for (int i = 0; i < args.length; i++) {
-      String key = args[i];
-      /*
-       * The first time through the loop, the current list is null, so we 
assign
-       * it to this list. Then we retrieve the first key from this list and
-       * assign it to value.
-       *
-       * On the next loop, we check whether the retrieved value is a NamedList.
-       * If it is, then we drop to that NamedList, grab the value of the
-       * next key, and start the loop over. If it is not a NamedList, then we
-       * assign the value to null and break out of the loop.
-       *
-       * Assigning the value to null and then breaking out of the loop seems
-       * like the wrong thing to do, but there's a very simple reason that it
-       * works: If we have reached the last key, then the loop ends naturally
-       * after we retrieve the value, and that code is never executed.
-       */
-      if (currentList == null) {
-        currentList = this;
-      } else {
-        if (value instanceof NamedList) {
-          currentList = (NamedList<?>) value;
-        } else {
-          value = null;
-          break;
-        }
-      }
-      /*
-       * We do not need to do a null check on currentList for the following
-       * assignment. The instanceof check above will fail if the current list 
is
-       * null, and if that happens, the loop will end before this point.
-       */
-      value = currentList.get(key, 0);
-    }
-    return value;
-  }
-
   @Override
   public String toString() {
     StringBuilder sb = new StringBuilder();

Reply via email to