Skip to content

Commit 81d345b

Browse files
committed
addendum - use var for endpoint
1 parent cefb30b commit 81d345b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/DefaultS3ClientFactory.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,8 @@ protected ClientOverrideConfiguration.Builder createClientOverrideConfiguration(
267267
*/
268268
private <BuilderT extends S3BaseClientBuilder<BuilderT, ClientT>, ClientT> void configureEndpointAndRegion(
269269
BuilderT builder, S3ClientCreationParameters parameters, Configuration conf) {
270-
URI endpoint = getS3Endpoint(parameters.getEndpoint(), conf);
270+
final String endpointStr = parameters.getEndpoint();
271+
URI endpoint = getS3Endpoint(endpointStr, conf);
271272

272273
String configuredRegion = parameters.getRegion();
273274
Region region = null;
@@ -294,7 +295,7 @@ private <BuilderT extends S3BaseClientBuilder<BuilderT, ClientT>, ClientT> void
294295
builder.endpointOverride(endpoint);
295296
// No region was configured, try to determine it from the endpoint.
296297
if (region == null) {
297-
region = getS3RegionFromEndpoint(parameters.getEndpoint());
298+
region = getS3RegionFromEndpoint(endpointStr);
298299
if (region != null) {
299300
origin = "endpoint";
300301
}
@@ -320,9 +321,9 @@ private <BuilderT extends S3BaseClientBuilder<BuilderT, ClientT>, ClientT> void
320321
origin = "SDK region chain";
321322
}
322323

323-
if (parameters.getEndpoint() != null && parameters.getEndpoint().endsWith(CENTRAL_ENDPOINT)) {
324+
if (endpointStr != null && endpointStr.endsWith(CENTRAL_ENDPOINT)) {
324325
builder.crossRegionAccessEnabled(true);
325-
LOG.debug("Enabling cross region access for endpoint {}", parameters.getEndpoint());
326+
LOG.debug("Enabling cross region access for endpoint {}", endpointStr);
326327
}
327328

328329
LOG.debug("Setting region to {} from {}", region, origin);

0 commit comments

Comments
 (0)