diff --git a/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AbfsConfiguration.java b/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AbfsConfiguration.java index b25044f6254a2..79302785eb84c 100644 --- a/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AbfsConfiguration.java +++ b/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AbfsConfiguration.java @@ -892,10 +892,13 @@ public AccessTokenProvider getTokenProvider() throws TokenAccessProviderExceptio * depending on which one is available. In case a user SASTokenProvider implementation is not present, and a fixed token is configured, * it simply returns null, to set the sasTokenProvider object for current configuration instance to null. * The fixed token is read and used later. This is done to: - * 1. check for cases where both are not set, while initializing AbfsConfiguration, to not proceed further than thi stage itself when none of the options are available. - * 2. avoid using similar tokenProvider implementation to just read the configured fixed token, as this could create confusion. The configuration is introduced + * 1. check for cases where both are not set, while initializing AbfsConfiguration, + * to not proceed further than thi stage itself when none of the options are available. + * 2. avoid using similar tokenProvider implementation to just read the configured fixed token, + * as this could create confusion. The configuration is introduced * primarily to avoid using any tokenProvider class/interface. Also,implementing the SASTokenProvider requires relying on the raw configurations. - * It is more stable to depend on the AbfsConfiguration with which a filesystem is initialized, and eliminate chances of dynamic modifications and spurious situations. + * It is more stable to depend on the AbfsConfiguration with which a filesystem is initialized, + * and eliminate chances of dynamic modifications and spurious situations. */ public SASTokenProvider getSASTokenProvider() throws AzureBlobFileSystemException { @@ -911,7 +914,7 @@ public SASTokenProvider getSASTokenProvider() throws AzureBlobFileSystemExceptio String configuredFixedToken = this.rawConfig.get(FS_AZURE_SAS_FIXED_TOKEN, null); Preconditions.checkArgument(sasTokenProviderImplementation != null || configuredFixedToken != null, - String.format("The configuration value for both \"%s\" and \"%s\" cannot be invalid.", FS_AZURE_SAS_TOKEN_PROVIDER_TYPE, FS_AZURE_SAS_FIXED_TOKEN)); + String.format("The value for both \"%s\" and \"%s\" cannot be invalid.", FS_AZURE_SAS_TOKEN_PROVIDER_TYPE, FS_AZURE_SAS_FIXED_TOKEN)); if (sasTokenProviderImplementation != null) { LOG.trace("Using SASTokenProvider class instead of config although both are available for use"); diff --git a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemChooseSAS.java b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemChooseSAS.java index c6aa185c08e17..24466c206891a 100644 --- a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemChooseSAS.java +++ b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemChooseSAS.java @@ -69,7 +69,8 @@ public void testBothProviderFixedTokenConfigured() throws Exception { AbfsConfiguration testAbfsConfig = getConfiguration(); // configuring a SASTokenProvider class: this provides a user delegation SAS - // user delegation SAS Provider is set to easily distinguish between results of filesystem level and blob level operations to ensure correct SAS is chosen, + // user delegation SAS Provider is set + // This easily distinguishes between results of filesystem level and blob level operations to ensure correct SAS is chosen, // when both a provider class and fixed token is configured. testAbfsConfig.set(FS_AZURE_SAS_TOKEN_PROVIDER_TYPE, "org.apache.hadoop.fs.azurebfs.extensions.MockDelegationSASTokenProvider"); diff --git a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/utils/AccountSASGenerator.java b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/utils/AccountSASGenerator.java index 9863b1d54b2c3..5e7902adf118a 100644 --- a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/utils/AccountSASGenerator.java +++ b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/utils/AccountSASGenerator.java @@ -33,7 +33,9 @@ public class AccountSASGenerator extends SASGenerator { * https://learn.microsoft.com/en-us/rest/api/storageservices/create-account-sas * @param accountKey: the storage account key */ - public AccountSASGenerator(byte[] accountKey) { super(accountKey); } + public AccountSASGenerator(byte[] accountKey) { + super(accountKey); + } public String getAccountSAS(String accountName) throws AzureBlobFileSystemException { // retaining only the account name diff --git a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/utils/SASGenerator.java b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/utils/SASGenerator.java index 292037671ec76..86fb5a17cca4f 100644 --- a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/utils/SASGenerator.java +++ b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/utils/SASGenerator.java @@ -23,15 +23,12 @@ import java.time.Duration; import java.time.format.DateTimeFormatter; import java.time.ZoneId; -import java.util.Base64; import java.util.Locale; import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; import org.apache.hadoop.fs.azurebfs.constants.AbfsHttpConstants; import org.apache.hadoop.fs.azurebfs.contracts.exceptions.InvalidConfigurationValueException; -import org.apache.hadoop.fs.azurebfs.contracts.exceptions.InvalidUriException; -import org.apache.hadoop.fs.azurebfs.services.SharedKeyCredentials; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /**