Skip to content

Commit ec866e0

Browse files
committed
HADOOP-19282. STSClientFactory: do not use URIBuilder
URIBuilder was used from the AWS SDK for Java v2, to be precise from the shaded Apache HTTP Client. It is a problem if a user would like not to use the AWS SDK bundle, since more or less only 3 modules are needed (s3, s3-transfer & sts), but that may cause problems on unshaded dependency versions. Since a URI constructor can achieve the same here I switched it as a preferred option.
1 parent 68651ec commit ec866e0

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

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

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
import java.net.URI;
2424
import java.net.URISyntaxException;
2525
import java.util.concurrent.TimeUnit;
26-
26+
import org.slf4j.Logger;
27+
import org.slf4j.LoggerFactory;
2728
import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider;
2829
import software.amazon.awssdk.core.client.config.ClientOverrideConfiguration;
2930
import software.amazon.awssdk.core.retry.RetryPolicy;
@@ -35,19 +36,14 @@
3536
import software.amazon.awssdk.services.sts.model.AssumeRoleRequest;
3637
import software.amazon.awssdk.services.sts.model.Credentials;
3738
import software.amazon.awssdk.services.sts.model.GetSessionTokenRequest;
38-
import software.amazon.awssdk.thirdparty.org.apache.http.client.utils.URIBuilder;
39-
import org.apache.hadoop.fs.s3a.impl.AWSClientConfig;
40-
import org.apache.hadoop.util.Preconditions;
41-
42-
import org.slf4j.Logger;
43-
import org.slf4j.LoggerFactory;
44-
4539

4640
import org.apache.hadoop.classification.InterfaceAudience;
4741
import org.apache.hadoop.classification.InterfaceStability;
4842
import org.apache.hadoop.conf.Configuration;
4943
import org.apache.hadoop.fs.s3a.Invoker;
5044
import org.apache.hadoop.fs.s3a.Retries;
45+
import org.apache.hadoop.fs.s3a.impl.AWSClientConfig;
46+
import org.apache.hadoop.util.Preconditions;
5147

5248
import static org.apache.commons.lang3.StringUtils.isEmpty;
5349
import static org.apache.commons.lang3.StringUtils.isNotEmpty;
@@ -167,7 +163,7 @@ public static StsClientBuilder builder(final AwsCredentialsProvider credentials,
167163
*/
168164
private static URI getSTSEndpoint(String endpoint) {
169165
try {
170-
return new URIBuilder().setScheme("https").setHost(endpoint).build();
166+
return new URI("https", endpoint, null, null);
171167
} catch (URISyntaxException e) {
172168
throw new IllegalArgumentException(e);
173169
}

0 commit comments

Comments
 (0)