Skip to content

Commit 64f7d33

Browse files
committed
Updated snap shot after merge from master
1 parent b97c9da commit 64f7d33

File tree

4 files changed

+3
-55
lines changed

4 files changed

+3
-55
lines changed

http-clients/apache5-client/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<parent>
2222
<artifactId>http-clients</artifactId>
2323
<groupId>software.amazon.awssdk</groupId>
24-
<version>2.31.51-SNAPSHOT</version>
24+
<version>2.31.53-SNAPSHOT</version>
2525
</parent>
2626

2727
<artifactId>apache5-client</artifactId>

http-clients/apache5-client/src/main/java/software/amazon/awssdk/http/apache5/internal/impl/Apache5HttpRequestFactory.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,6 @@ private void addRequestConfig(HttpUriRequestBase base,
100100
.setResponseTimeout(saturatedCast(requestConfig.socketTimeout().toMillis()), TimeUnit.MILLISECONDS);
101101
// TODO as part of removed API : .setLocalAddress(requestConfig.localAddress());
102102

103-
Apache5Utils.disableNormalizeUri(requestConfigBuilder);
104-
105103
/*
106104
* Enable 100-continue support for PUT operations, since this is
107105
* where we're potentially uploading large amounts of data and want

http-clients/apache5-client/src/main/java/software/amazon/awssdk/http/apache5/internal/utils/Apache5Utils.java

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -30,28 +30,10 @@
3030
import software.amazon.awssdk.annotations.SdkInternalApi;
3131
import software.amazon.awssdk.http.apache5.ProxyConfiguration;
3232
import software.amazon.awssdk.utils.Logger;
33-
import software.amazon.awssdk.utils.ReflectionMethodInvoker;
3433

3534
@SdkInternalApi
3635
public final class Apache5Utils {
3736
private static final Logger logger = Logger.loggerFor(Apache5Utils.class);
38-
private static final ReflectionMethodInvoker<RequestConfig.Builder, RequestConfig.Builder> NORMALIZE_URI_INVOKER;
39-
40-
static {
41-
// Attempt to initialize the invoker once on class-load. If it fails, it will not be attempted again, but we'll
42-
// use that opportunity to log a warning.
43-
NORMALIZE_URI_INVOKER =
44-
new ReflectionMethodInvoker<>(RequestConfig.Builder.class,
45-
RequestConfig.Builder.class,
46-
"setNormalizeUri",
47-
boolean.class);
48-
49-
try {
50-
NORMALIZE_URI_INVOKER.initialize();
51-
} catch (NoSuchMethodException ignored) {
52-
noSuchMethodThrownByNormalizeUriInvoker();
53-
}
54-
}
5537

5638
private Apache5Utils() {
5739
}
@@ -79,36 +61,11 @@ public static HttpClientContext newClientContext(ProxyConfiguration proxyConfigu
7961
addPreemptiveAuthenticationProxy(clientContext, proxyConfiguration);
8062

8163
RequestConfig.Builder builder = RequestConfig.custom();
82-
disableNormalizeUri(builder);
83-
8464
clientContext.setRequestConfig(builder.build());
8565
return clientContext;
8666

8767
}
8868

89-
/**
90-
* From Apache v4.5.8, normalization should be disabled or AWS requests with special characters in URI path will fail
91-
* with Signature Errors.
92-
* <p>
93-
* setNormalizeUri is added only in 4.5.8, so customers using the latest version of SDK with old versions (4.5.6 or less)
94-
* of Apache httpclient will see NoSuchMethodError. Hence this method will suppress the error.
95-
*
96-
* Do not use Apache version 4.5.7 as it breaks URI paths with special characters and there is no option
97-
* to disable normalization.
98-
* </p>
99-
*
100-
* For more information, See https://github.com/aws/aws-sdk-java/issues/1919
101-
*/
102-
public static void disableNormalizeUri(RequestConfig.Builder requestConfigBuilder) {
103-
// For efficiency, do not attempt to call the invoker again if it failed to initialize on class-load
104-
if (NORMALIZE_URI_INVOKER.isInitialized()) {
105-
try {
106-
NORMALIZE_URI_INVOKER.invoke(requestConfigBuilder, false);
107-
} catch (NoSuchMethodException ignored) {
108-
noSuchMethodThrownByNormalizeUriInvoker();
109-
}
110-
}
111-
}
11269

11370
/**
11471
* Returns a new Credentials Provider for use with proxy authentication.
@@ -154,13 +111,4 @@ private static void addPreemptiveAuthenticationProxy(HttpClientContext clientCon
154111
}
155112
}
156113

157-
// Just log and then swallow the exception
158-
private static void noSuchMethodThrownByNormalizeUriInvoker() {
159-
// setNormalizeUri method was added in httpclient 4.5.8
160-
logger.warn(() -> "NoSuchMethodException was thrown when disabling normalizeUri. This indicates you are using "
161-
+ "an old version (< 4.5.8) of Apache http client. It is recommended to use http client "
162-
+ "version >= 4.5.9 to avoid the breaking change introduced in apache client 4.5.7 and "
163-
+ "the latency in exception handling. See https://github.com/aws/aws-sdk-java/issues/1919"
164-
+ " for more information");
165-
}
166114
}

test/architecture-tests/archunit_store/4195d6e3-8849-4e5a-848d-04f810577cd3

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Method <software.amazon.awssdk.http.SystemPropertyTlsKeyManagersProvider.keyMana
1313
Method <software.amazon.awssdk.http.apache.ApacheHttpClient$ApacheConnectionManagerFactory.getSslContext(software.amazon.awssdk.utils.AttributeMap)> calls method <software.amazon.awssdk.utils.Logger.warn(java.util.function.Supplier)> in (ApacheHttpClient.java:699)
1414
Method <software.amazon.awssdk.http.apache.internal.RepeatableInputStreamRequestEntity.parseContentLength(java.lang.String)> calls method <software.amazon.awssdk.utils.Logger.warn(java.util.function.Supplier)> in (RepeatableInputStreamRequestEntity.java:113)
1515
Method <software.amazon.awssdk.http.apache.internal.utils.ApacheUtils.noSuchMethodThrownByNormalizeUriInvoker()> calls method <software.amazon.awssdk.utils.Logger.warn(java.util.function.Supplier)> in (ApacheUtils.java:162)
16+
Method <software.amazon.awssdk.http.apache5.internal.RepeatableInputStreamRequestEntity.parseContentLength(java.lang.String)> calls method <software.amazon.awssdk.utils.Logger.warn(java.util.function.Supplier)> in (RepeatableInputStreamRequestEntity.java:131)
17+
Method <software.amazon.awssdk.http.apache5.internal.RepeatableInputStreamRequestEntity.parseContentType(java.lang.String)> calls method <software.amazon.awssdk.utils.Logger.warn(java.util.function.Supplier)> in (RepeatableInputStreamRequestEntity.java:143)
1618
Method <software.amazon.awssdk.http.nio.netty.internal.utils.NettyUtils.warnIfNotInEventLoop(io.netty.channel.EventLoop)> calls method <software.amazon.awssdk.utils.Logger.warn(java.util.function.Supplier, java.lang.Throwable)> in (NettyUtils.java:289)
1719
Method <software.amazon.awssdk.http.urlconnection.UrlConnectionHttpClient.getSslContext(software.amazon.awssdk.utils.AttributeMap)> calls method <software.amazon.awssdk.utils.Logger.warn(java.util.function.Supplier)> in (UrlConnectionHttpClient.java:263)
1820
Method <software.amazon.awssdk.metrics.publishers.cloudwatch.CloudWatchMetricPublisher.publish(software.amazon.awssdk.metrics.MetricCollection)> calls method <software.amazon.awssdk.utils.Logger.warn(java.util.function.Supplier, java.lang.Throwable)> in (CloudWatchMetricPublisher.java:293)

0 commit comments

Comments
 (0)