@@ -88,7 +88,7 @@ public class AbfsConfiguration{
88
88
89
89
private final Configuration rawConfig ;
90
90
private final String accountName ;
91
- private final String fsName ;
91
+ private String fsName ;
92
92
// Service type identified from URL used to initialize FileSystem.
93
93
private final AbfsServiceType fsConfiguredServiceType ;
94
94
private final boolean isSecure ;
@@ -452,20 +452,17 @@ public class AbfsConfiguration{
452
452
* Constructor for AbfsConfiguration for specified service type.
453
453
* @param rawConfig used to initialize the configuration.
454
454
* @param accountName the name of the azure storage account.
455
- * @param fsName the name of the file system (container name).
456
455
* @param fsConfiguredServiceType service type configured for the file system.
457
456
* @throws IllegalAccessException if the field is not accessible.
458
457
* @throws IOException if an I/O error occurs.
459
458
*/
460
459
public AbfsConfiguration (final Configuration rawConfig ,
461
460
String accountName ,
462
- String fsName ,
463
461
AbfsServiceType fsConfiguredServiceType )
464
462
throws IllegalAccessException , IOException {
465
463
this .rawConfig = ProviderUtils .excludeIncompatibleCredentialProviders (
466
464
rawConfig , AzureBlobFileSystem .class );
467
465
this .accountName = accountName ;
468
- this .fsName = fsName ;
469
466
this .fsConfiguredServiceType = fsConfiguredServiceType ;
470
467
this .isSecure = getBoolean (FS_AZURE_SECURE_MODE , false );
471
468
@@ -488,6 +485,24 @@ public AbfsConfiguration(final Configuration rawConfig,
488
485
}
489
486
}
490
487
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
+
491
506
/**
492
507
* Constructor for AbfsConfiguration for default service type i.e. DFS.
493
508
* @param rawConfig used to initialize the configuration.
@@ -497,7 +512,7 @@ public AbfsConfiguration(final Configuration rawConfig,
497
512
*/
498
513
public AbfsConfiguration (final Configuration rawConfig , String accountName )
499
514
throws IllegalAccessException , IOException {
500
- this (rawConfig , accountName , EMPTY_STRING , AbfsServiceType .DFS );
515
+ this (rawConfig , accountName , AbfsServiceType .DFS );
501
516
}
502
517
503
518
/**
@@ -666,13 +681,11 @@ public int getInt(String key, int defaultValue) {
666
681
* @throws IOException if parsing fails.
667
682
*/
668
683
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 );
676
689
if (passchars != null ) {
677
690
return new String (passchars );
678
691
}
0 commit comments