@@ -328,70 +328,6 @@ private void killAll(String name) {
328328 }
329329 }
330330
331- /**
332- * Recursively parses the NamedList structure to arrive at a specific element. As you descend the
333- * NamedList tree, the last element can be any type, including NamedList, but the previous
334- * elements MUST be NamedList objects themselves. A null value is returned if the indicated
335- * hierarchy doesn't exist, but NamedList allows null values so that could be the actual value at
336- * the end of the path.
337- *
338- * <p>This method is particularly useful for parsing the response from Solr's /admin/mbeans
339- * handler, but it also works for any complex structure.
340- *
341- * <p>Explicitly casting the return value is recommended. An even safer option is to accept the
342- * return value as an object and then check its type.
343- *
344- * <p>Usage examples:
345- *
346- * <p>String coreName = (String) response.findRecursive ("solr-mbeans", "CORE", "core", "stats",
347- * "coreName"); long numDoc = (long) response.findRecursive ("solr-mbeans", "CORE", "searcher",
348- * "stats", "numDocs");
349- *
350- * @param args One or more strings specifying the tree to navigate.
351- * @return the last entry in the given path hierarchy, null if not found.
352- * @deprecated use {@link org.apache.solr.common.NavigableObject} methods instead
353- */
354- @ Deprecated
355- public Object findRecursive (String ... args ) {
356- NamedList <?> currentList = null ;
357- Object value = null ;
358- for (int i = 0 ; i < args .length ; i ++) {
359- String key = args [i ];
360- /*
361- * The first time through the loop, the current list is null, so we assign
362- * it to this list. Then we retrieve the first key from this list and
363- * assign it to value.
364- *
365- * On the next loop, we check whether the retrieved value is a NamedList.
366- * If it is, then we drop to that NamedList, grab the value of the
367- * next key, and start the loop over. If it is not a NamedList, then we
368- * assign the value to null and break out of the loop.
369- *
370- * Assigning the value to null and then breaking out of the loop seems
371- * like the wrong thing to do, but there's a very simple reason that it
372- * works: If we have reached the last key, then the loop ends naturally
373- * after we retrieve the value, and that code is never executed.
374- */
375- if (currentList == null ) {
376- currentList = this ;
377- } else {
378- if (value instanceof NamedList ) {
379- currentList = (NamedList <?>) value ;
380- } else {
381- value = null ;
382- break ;
383- }
384- }
385- /*
386- * We do not need to do a null check on currentList for the following
387- * assignment. The instanceof check above will fail if the current list is
388- * null, and if that happens, the loop will end before this point.
389- */
390- value = currentList .get (key , 0 );
391- }
392- return value ;
393- }
394-
395331 @ Override
396332 public String toString () {
397333 StringBuilder sb = new StringBuilder ();
0 commit comments