github-advanced-security[bot] commented on code in PR #18142:
URL: https://github.com/apache/druid/pull/18142#discussion_r2150055339


##########
server/src/main/java/org/apache/druid/query/lookup/LookupReferencesManager.java:
##########
@@ -476,38 +469,21 @@
 
   @Nullable
   private Map<String, LookupExtractorFactoryContainer> 
tryGetLookupListFromCoordinator(String tier)
-      throws IOException, InterruptedException
   {
-    final StringFullResponseHolder response = fetchLookupsForTier(tier);
-    if (response.getStatus().equals(HttpResponseStatus.NOT_FOUND)) {
-      LOG.warn("No lookups found for tier [%s], response [%s]", tier, 
response);
-      return null;
-    } else if (!response.getStatus().equals(HttpResponseStatus.OK)) {
-      throw new IOE(
-          "Error while fetching lookup code from Coordinator with status[%s] 
and content[%s]",
-          response.getStatus(),
-          response.getContent()
-      );
+    try {
+      return FutureUtils.getUnchecked(
+          coordinatorClient.fetchLookupsForTier(tier), true);
     }
-
-    // Older version of getSpecificTier returns a list of lookup names.
-    // Lookup loading is performed via snapshot if older version is present.
-    // This check is only for backward compatibility and should be removed in 
a future release
-    if (response.getContent().startsWith("[")) {
-      LOG.info(
-          "Failed to retrieve lookup information from coordinator, " +
-          "because coordinator appears to be running on older Druid version. " 
+
-          "Attempting to load lookups using snapshot instead"
-      );
-      return null;
-    } else {
-      Map<String, Object> lookupNameToGenericConfig =
-          jsonMapper.readValue(response.getContent(), 
LOOKUPS_ALL_GENERIC_REFERENCE);
-      return LookupUtils.tryConvertObjectMapToLookupConfigMap(
-          lookupNameToGenericConfig,
-          jsonMapper
+    catch (Exception e) {
+      HttpResponseException httpEx = (HttpResponseException) e.getCause();
+      LOG.warn(
+          "No lookups found for tier [%s], status [%s], response [%s]",
+          tier,
+          httpEx.getResponse().getStatus(),
+          httpEx.getResponse()

Review Comment:
   ## Use of default toString()
   
   Default toString(): StringFullResponseHolder inherits toString() from 
Object, and so is not suitable for printing.
   
   [Show more 
details](https://github.com/apache/druid/security/code-scanning/9238)



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to