File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/auth Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change 2020
2121import java .io .IOException ;
2222import java .security .PrivilegedExceptionAction ;
23- import java .util .Arrays ;
2423import java .util .HashMap ;
2524import java .util .Map ;
2625import java .util .Objects ;
@@ -228,10 +227,13 @@ private String parseBucketFromHost(String host) {
228227 if (service .contains ("s3-accesspoint" ) || service .contains ("s3-outposts" )
229228 || service .contains ("s3-object-lambda" )) {
230229 // If AccessPoint then bucketName is of format `accessPoint-accountId`;
231- String [] accessPointBits = hostBits [0 ].split ("-" );
232- int lastElem = accessPointBits .length - 1 ;
233- String accountId = accessPointBits [lastElem ];
234- String accessPointName = String .join ("" , Arrays .copyOf (accessPointBits , lastElem ));
230+ String [] accessPointBits = bucketName .split ("-" );
231+ String accountId = accessPointBits [accessPointBits .length - 1 ];
232+ // Extract the access point name from bucket name. eg: if bucket name is
233+ // test-custom-signer-<accountId>, get the access point name test-custom-signer by removing
234+ // -<accountId> from the bucket name.
235+ String accessPointName =
236+ bucketName .substring (0 , bucketName .length () - (accountId .length () + 1 ));
235237 Arn arn = Arn .builder ()
236238 .withAccountId (accountId )
237239 .withPartition ("aws" )
You can’t perform that action at this time.
0 commit comments