gerlowskija commented on code in PR #3054:
URL: https://github.com/apache/solr/pull/3054#discussion_r1945281386


##########
solr/core/src/java/org/apache/solr/cli/CLIUtils.java:
##########
@@ -321,16 +320,15 @@ public static boolean safeCheckCoreExists(String solrUrl, 
String coreName, Strin
           final int clamPeriodForStatusPollMs = 1000;
           Thread.sleep(clamPeriodForStatusPollMs);
         }
-        NamedList<Object> existsCheckResult =
-            CoreAdminRequest.getStatus(coreName, solrClient).getResponse();
-        NamedList<Object> status = (NamedList<Object>) 
existsCheckResult.get("status");
-        NamedList<Object> coreStatus = (NamedList<Object>) 
status.get(coreName);
-        Map<String, Object> failureStatus =
-            (Map<String, Object>) existsCheckResult.get("initFailures");
-        String errorMsg = (String) failureStatus.get(coreName);
-        final boolean hasName = coreStatus != null && coreStatus.get(NAME) != 
null;
-        exists = hasName || errorMsg != null;
-        wait = hasName && errorMsg == null && 
"true".equals(coreStatus.get("isLoading"));
+        final var coreStatusReq = new CoresApi.GetCoreStatus(coreName);
+        final var coreStatusRsp = 
coreStatusReq.process(solrClient).getParsed();
+        final var coreStatusByName = coreStatusRsp.status;
+        final var coreStatus = coreStatusByName.get(coreName);
+        final var failureStatus = coreStatusRsp.initFailures;
+        final var initFailureForCore = failureStatus.get(coreName);
+        final boolean hasName = coreStatus != null && coreStatus.name != null;
+        exists = hasName || initFailureForCore != null;
+        wait = hasName && initFailureForCore == null && 
"true".equals(coreStatus.isLoading);

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to