SaketaChalamchala commented on code in PR #7130:
URL: https://github.com/apache/ozone/pull/7130#discussion_r1746511560


##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java:
##########
@@ -2595,8 +2595,15 @@ public OzoneFsServerDefaults getServerDefaults() throws 
IOException {
 
   @Override
   public URI getKeyProviderUri() throws IOException {
-    return OzoneKMSUtil.getKeyProviderUri(ugi,
-        null, getServerDefaults().getKeyProviderUri(), conf);
+    if (omVersion.compareTo(OzoneManagerVersion.SERVER_DEFAULTS) >= 0) {
+      try {
+        return OzoneKMSUtil.getKeyProviderUri(ugi,
+            null, getServerDefaults().getKeyProviderUri(), conf);
+      } catch (Exception e) {
+        LOG.warn("Could not get key provider URI from OM.", e);
+      }
+    }

Review Comment:
   Thanks for the review @adoroszlai. We are overriding 
`org.apache.hadoop.fs.FsServerDefaults.getServerDefaults `. The return type is 
`FsServerDefaults`. Unfortunately `Optional<OzoneFsServerDefaults>` is not 
compatible with `FsServerDefaults`.
   Also, `FsServerDefaults.getKeyProviderUri()` is not a static method. So, I'm 
are not able to use a method reference
   But, I did the error handling to getServerDefaults() and returning null when 
there is an error.



-- 
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