raphaelazzolini commented on code in PR #7396:
URL: https://github.com/apache/hadoop/pull/7396#discussion_r1966895375


##########
hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3AUtils.java:
##########
@@ -1743,4 +1753,26 @@ static void maybeIsolateClassloader(Configuration conf, 
ClassLoader classLoader)
     }
   }
 
+  /**
+   * Get the checksum algorithm to be used for data integrity check of the 
objects in S3.
+   * This operation includes validating if the provided value is a supported 
checksum algorithm.
+   * @param conf configuration to scan
+   * @return the checksum algorithm to be passed on S3 requests
+   * @throws IllegalArgumentException if the checksum algorithm is not known 
or not supported
+   */
+  public static ChecksumAlgorithm getChecksumAlgorithm(Configuration conf) {
+    final String checksumAlgorithmString = conf.get(CHECKSUM_ALGORITHM);
+    if (StringUtils.isBlank(checksumAlgorithmString)) {
+      return null;
+    }
+    final ChecksumAlgorithm checksumAlgorithm =
+        ChecksumAlgorithm.fromValue(checksumAlgorithmString);
+    if (!SUPPORTED_CHECKSUM_ALGORITHMS.contains(checksumAlgorithm)) {

Review Comment:
   I will use Precondition.checkArgument(), isn't it a better option in this 
case?



-- 
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: common-issues-unsubscr...@hadoop.apache.org

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


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

Reply via email to