anmolanmol1234 commented on code in PR #5148: URL: https://github.com/apache/hadoop/pull/5148#discussion_r1044138742
########## hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/utils/SASGenerator.java: ########## @@ -85,17 +87,34 @@ private void initializeMac() { } } + protected String getCanonicalAccountName(String accountName) throws InvalidConfigurationValueException { + // returns the account name without the endpoint + int dotIndex = accountName.indexOf(AbfsHttpConstants.DOT); + if (dotIndex == 0) { + // case when accountname starts with a ".": endpoint is present, accountName is null + throw new InvalidConfigurationValueException("Account Name is not fully qualified"); + } + if (dotIndex > 0) { + // case when endpoint is present with accountName + return accountName.substring(0, dotIndex); + } else { + // case when accountName is already canonicalized + return accountName; + } + } + protected String computeHmac256(final String stringToSign) { byte[] utf8Bytes; try { utf8Bytes = stringToSign.getBytes(StandardCharsets.UTF_8.toString()); + // utf8Bytes = stringToSign.getBytes("UTF-8"); } catch (final UnsupportedEncodingException e) { throw new IllegalArgumentException(e); } byte[] hmac; synchronized (this) { hmac = hmacSha256.doFinal(utf8Bytes); } - return Base64.encode(hmac); + return org.apache.hadoop.fs.azurebfs.utils.Base64.encode(hmac); Review Comment: Remove the full import -- 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