Skip to content

Commit 6915d0e

Browse files
committed
comment suggestions
1 parent 4a182ac commit 6915d0e

File tree

3 files changed

+29
-14
lines changed

3 files changed

+29
-14
lines changed

hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AbfsConfiguration.java

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public class AbfsConfiguration{
8888

8989
private final Configuration rawConfig;
9090
private final String accountName;
91-
private final String fsName;
91+
private String fsName;
9292
// Service type identified from URL used to initialize FileSystem.
9393
private final AbfsServiceType fsConfiguredServiceType;
9494
private final boolean isSecure;
@@ -452,20 +452,17 @@ public class AbfsConfiguration{
452452
* Constructor for AbfsConfiguration for specified service type.
453453
* @param rawConfig used to initialize the configuration.
454454
* @param accountName the name of the azure storage account.
455-
* @param fsName the name of the file system (container name).
456455
* @param fsConfiguredServiceType service type configured for the file system.
457456
* @throws IllegalAccessException if the field is not accessible.
458457
* @throws IOException if an I/O error occurs.
459458
*/
460459
public AbfsConfiguration(final Configuration rawConfig,
461460
String accountName,
462-
String fsName,
463461
AbfsServiceType fsConfiguredServiceType)
464462
throws IllegalAccessException, IOException {
465463
this.rawConfig = ProviderUtils.excludeIncompatibleCredentialProviders(
466464
rawConfig, AzureBlobFileSystem.class);
467465
this.accountName = accountName;
468-
this.fsName = fsName;
469466
this.fsConfiguredServiceType = fsConfiguredServiceType;
470467
this.isSecure = getBoolean(FS_AZURE_SECURE_MODE, false);
471468

@@ -488,6 +485,24 @@ public AbfsConfiguration(final Configuration rawConfig,
488485
}
489486
}
490487

488+
/**
489+
* Constructor for AbfsConfiguration for retrieve the FsName.
490+
* @param rawConfig used to initialize the configuration.
491+
* @param accountName the name of the azure storage account.
492+
* @param fsName the name of the file system (container name).
493+
* @param fsConfiguredServiceType service type configured for the file system.
494+
* @throws IllegalAccessException if the field is not accessible.
495+
* @throws IOException if an I/O error occurs.
496+
*/
497+
public AbfsConfiguration(final Configuration rawConfig,
498+
String accountName,
499+
String fsName,
500+
AbfsServiceType fsConfiguredServiceType)
501+
throws IllegalAccessException, IOException {
502+
this(rawConfig, accountName, fsConfiguredServiceType);
503+
this.fsName = fsName;
504+
}
505+
491506
/**
492507
* Constructor for AbfsConfiguration for default service type i.e. DFS.
493508
* @param rawConfig used to initialize the configuration.
@@ -497,7 +512,7 @@ public AbfsConfiguration(final Configuration rawConfig,
497512
*/
498513
public AbfsConfiguration(final Configuration rawConfig, String accountName)
499514
throws IllegalAccessException, IOException {
500-
this(rawConfig, accountName, EMPTY_STRING, AbfsServiceType.DFS);
515+
this(rawConfig, accountName, AbfsServiceType.DFS);
501516
}
502517

503518
/**
@@ -666,13 +681,11 @@ public int getInt(String key, int defaultValue) {
666681
* @throws IOException if parsing fails.
667682
*/
668683
public String getPasswordString(String key) throws IOException {
669-
char[] passchars = rawConfig.getPassword(containerConf(key));
670-
if(passchars == null) {
671-
passchars = rawConfig.getPassword(accountConf(key));
672-
if(passchars == null){
673-
passchars = rawConfig.getPassword(key);
674-
}
675-
}
684+
char[] passchars = rawConfig.getPassword(containerConf(key)) != null ?
685+
rawConfig.getPassword(containerConf(key)) :
686+
rawConfig.getPassword(accountConf(key)) != null ?
687+
rawConfig.getPassword(accountConf(key)) :
688+
rawConfig.getPassword(key);
676689
if (passchars != null) {
677690
return new String(passchars);
678691
}

hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/AbstractAbfsIntegrationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ protected AbstractAbfsIntegrationTest() throws Exception {
117117
final String abfsUrl = this.getFileSystemName() + "@" + this.getAccountName();
118118
URI defaultUri = null;
119119

120-
abfsConfig = new AbfsConfiguration(rawConfig, accountName, getFileSystemName(), identifyAbfsServiceTypeFromUrl(abfsUrl));
120+
abfsConfig = new AbfsConfiguration(rawConfig, accountName, identifyAbfsServiceTypeFromUrl(abfsUrl));
121121

122122
authType = abfsConfig.getEnum(FS_AZURE_ACCOUNT_AUTH_TYPE_PROPERTY_NAME, AuthType.SharedKey);
123123
assumeValidAuthConfigsPresent();

hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemChooseSAS.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,9 @@ public void testBothProviderFixedTokenConfigured() throws Exception {
150150
* Helper method to get the Fixed SAS token value
151151
*/
152152
private String getFixedSASToken(AbfsConfiguration config) throws Exception {
153-
return config.getSASTokenProvider().getSASToken(this.getAccountName(), this.getFileSystemName(), getMethodName(), "read");
153+
String readPermission = "read";
154+
return config.getSASTokenProvider().getSASToken(this.getAccountName(), this.getFileSystemName(), getMethodName(),
155+
readPermission);
154156
}
155157

156158
/**

0 commit comments

Comments
 (0)