Skip to content

Commit 0eddef8

Browse files
committed
Merge branch 'master' into shorea-backpressure-bug
2 parents 63d003b + 8cb9942 commit 0eddef8

File tree

116 files changed

+1247
-872
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+1247
-872
lines changed

.changes/2.0.0-preview-2.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{
66
"category": "AWS SDK for Java v2",
77
"type": "feature",
8-
"description": "Substantial improvments to start up time and cold start latencies"
8+
"description": "Substantial improvements to start up time and cold start latencies"
99
},
1010
{
1111
"category": "AWS SDK for Java v2",

.changes/2.0.0-preview-4.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
{
3636
"category": "AWS SDK for Java v2",
3737
"type": "bugfix",
38-
"description": "Many improvments and fixes to the Netty NIO based transport."
38+
"description": "Many improvements and fixes to the Netty NIO based transport."
3939
},
4040
{
4141
"category": "AWS SDK for Java v2",
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"category": "AWS SDK for Java v2",
3+
"type": "bugfix",
4+
"description": "RetryPolicy bug fix: adding throttlingBackoffStrategy to `RetryPolicy.Builder`. see [#646](https://github.com/aws/aws-sdk-java-v2/issues/646)"
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"category": "AWS SDK for Java v2",
3+
"type": "feature",
4+
"description": "Replacing legacy `HttpResponse` with `SdkHttpFullResponse`."
5+
}

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@
306306

307307
- ### Bugfixes
308308
- Fixed a bug in default credential provider chain where it would erroneously abort at the ProfileCredentialsProvider. See [Issue #135](https://github.com/aws/aws-sdk-java-v2/issues/135)
309-
- Many improvments and fixes to the Netty NIO based transport.
309+
- Many improvements and fixes to the Netty NIO based transport.
310310
- Several fixes around S3's endpoint resolution, particularly with advanced options like path style addressing and accelerate mode. See [Issue #130](https://github.com/aws/aws-sdk-java-v2/issues/130)
311311
- Several fixes around serialization and deserialization of immutable objects. See [Issue #122](https://github.com/aws/aws-sdk-java-v2/issues/122)
312312
- Type parameters are now correctly included for [StreamingResponseHandler](https://github.com/aws/aws-sdk-java-v2/blob/master/core/src/main/java/software/amazon/awssdk/sync/StreamingResponseHandler.java) on the client interface.
@@ -321,7 +321,7 @@
321321
- ### Features
322322
- New pluggable HTTP implementation built on top of Java's HttpUrlConnection. Good choice for simple applications with low throughput requirements. Better cold start latency than the default Apache implementation.
323323
- Simple convenience methods have been added for operations that require no input parameters.
324-
- Substantial improvments to start up time and cold start latencies
324+
- Substantial improvements to start up time and cold start latencies
325325
- The Netty NIO HTTP client now uses a shared event loop group for better resource management. More options for customizing the event loop group are now available.
326326
- Using java.time instead of the legacy java.util.Date in generated model classes.
327327
- Various improvements to the immutability of model POJOs. ByteBuffers are now copied and collections are returned as unmodifiable.

codegen/src/main/java/software/amazon/awssdk/codegen/AddExceptionShapes.java

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,13 @@
1616
package software.amazon.awssdk.codegen;
1717

1818
import java.util.HashMap;
19-
import java.util.List;
2019
import java.util.Map;
2120
import software.amazon.awssdk.codegen.internal.Utils;
2221
import software.amazon.awssdk.codegen.model.intermediate.OperationModel;
2322
import software.amazon.awssdk.codegen.model.intermediate.ShapeModel;
2423
import software.amazon.awssdk.codegen.model.intermediate.ShapeType;
25-
import software.amazon.awssdk.codegen.model.service.ErrorMap;
2624
import software.amazon.awssdk.codegen.model.service.ErrorTrait;
27-
import software.amazon.awssdk.codegen.model.service.Operation;
25+
import software.amazon.awssdk.codegen.model.service.Shape;
2826

2927
/**
3028
* Constructs the exception shapes for the intermediate model. Analyzes the operations in the
@@ -46,28 +44,21 @@ private Map<String, ShapeModel> constructExceptionShapes() {
4644
// Java shape models, to be constructed
4745
final Map<String, ShapeModel> javaShapes = new HashMap<String, ShapeModel>();
4846

49-
for (Map.Entry<String, Operation> entry : getServiceModel().getOperations().entrySet()) {
47+
for (Map.Entry<String, Shape> shape : getServiceModel().getShapes().entrySet()) {
48+
if (shape.getValue().isException()) {
49+
String errorShapeName = shape.getKey();
50+
String javaClassName = getNamingStrategy().getExceptionName(errorShapeName);
5051

51-
Operation operation = entry.getValue();
52-
List<ErrorMap> operationErrors = operation.getErrors();
52+
ShapeModel exceptionShapeModel = generateShapeModel(javaClassName,
53+
errorShapeName);
5354

54-
if (operationErrors != null) {
55-
for (ErrorMap error : operationErrors) {
56-
57-
String errorShapeName = error.getShape();
58-
String javaClassName = getNamingStrategy().getExceptionName(errorShapeName);
59-
60-
ShapeModel exceptionShapeModel = generateShapeModel(javaClassName,
61-
errorShapeName);
62-
63-
exceptionShapeModel.setType(ShapeType.Exception.getValue());
64-
exceptionShapeModel.setErrorCode(getErrorCode(errorShapeName));
65-
if (exceptionShapeModel.getDocumentation() == null) {
66-
exceptionShapeModel.setDocumentation(error.getDocumentation());
67-
}
68-
69-
javaShapes.put(javaClassName, exceptionShapeModel);
55+
exceptionShapeModel.setType(ShapeType.Exception.getValue());
56+
exceptionShapeModel.setErrorCode(getErrorCode(errorShapeName));
57+
if (exceptionShapeModel.getDocumentation() == null) {
58+
exceptionShapeModel.setDocumentation(shape.getValue().getDocumentation());
7059
}
60+
61+
javaShapes.put(javaClassName, exceptionShapeModel);
7162
}
7263
}
7364

codegen/src/main/java/software/amazon/awssdk/codegen/docs/DocumentationBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ public DocumentationBuilder see(String seeLink, Object... formatArgs) {
208208
}
209209

210210
/**
211-
* Builds the Javadoc string with the current configuraton.
211+
* Builds the Javadoc string with the current configuration.
212212
*
213213
* @return Formatted Javadoc string.
214214
*/

codegen/src/main/java/software/amazon/awssdk/codegen/poet/client/specs/JsonProtocolSpec.java

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import java.util.stream.Collectors;
3131
import javax.lang.model.element.Modifier;
3232
import software.amazon.awssdk.awscore.eventstream.EventStreamAsyncResponseTransformer;
33-
import software.amazon.awssdk.awscore.eventstream.EventStreamExceptionJsonUnmarshaller;
3433
import software.amazon.awssdk.awscore.eventstream.EventStreamTaggedUnionJsonUnmarshaller;
3534
import software.amazon.awssdk.awscore.exception.AwsServiceException;
3635
import software.amazon.awssdk.awscore.internal.protocol.json.AwsJsonProtocol;
@@ -158,19 +157,6 @@ public CodeBlock responseHandler(IntermediateModel model, OperationModel opModel
158157
});
159158
builder.add(".defaultUnmarshaller((in) -> $T.UNKNOWN)\n"
160159
+ ".build());\n", eventStreamUtils.eventStreamBaseClass());
161-
162-
builder.add("\n\n$T<$T> exceptionHandler = $L.createResponseHandler(\n" +
163-
" new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),\n" +
164-
" $T.builder()\n" +
165-
" .defaultUnmarshaller(x -> $T.populateDefaultException($T::builder, x))\n" +
166-
" .build());",
167-
HttpResponseHandler.class,
168-
WildcardTypeName.subtypeOf(Throwable.class),
169-
protocolFactory,
170-
EventStreamExceptionJsonUnmarshaller.class,
171-
EventStreamExceptionJsonUnmarshaller.class,
172-
baseExceptionClassName(model));
173-
174160
}
175161
return builder.build();
176162
}
@@ -237,9 +223,10 @@ public CodeBlock asyncExecutionHandler(OperationModel opModel) {
237223
" .eventStreamResponseHandler(asyncResponseHandler)\n"
238224
+ " .eventResponseHandler(eventResponseHandler)\n"
239225
+ " .initialResponseHandler(responseHandler)\n"
240-
+ " .exceptionResponseHandler(exceptionHandler)\n"
226+
+ " .exceptionResponseHandler(errorResponseHandler)\n"
241227
+ " .future(future)\n"
242228
+ " .executor(executor)\n"
229+
+ " .serviceName(serviceName())\n"
243230
+ " .build();",
244231
transformerType,
245232
ClassName.get(EventStreamAsyncResponseTransformer.class),

codegen/src/main/resources/templates/json/ModelJsonUnmarshaller.ftl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public class ${shape.shapeName}Unmarshaller implements Unmarshaller<${shape.shap
4343
<#if shape.hasStatusCodeMember >
4444
<#list shape.members as memberModel>
4545
<#if memberModel.http.isStatusCode() >
46-
${shape.variable.variableName}Builder.${memberModel.fluentSetterMethodName}(context.getHttpResponse().getStatusCode());
46+
${shape.variable.variableName}Builder.${memberModel.fluentSetterMethodName}(context.getHttpResponse().statusCode());
4747
</#if>
4848
</#list>
4949
</#if>
@@ -53,7 +53,7 @@ public class ${shape.shapeName}Unmarshaller implements Unmarshaller<${shape.shap
5353
<#if explicitPayloadMember.http.isStreaming>
5454
<#-- Intentionally left blank, streaming handled by SyncResponseHandler -->
5555
<#elseif explicitPayloadMember.variable.variableType == "software.amazon.awssdk.core.SdkBytes">
56-
java.io.InputStream is = context.getHttpResponse().getContent();
56+
java.io.InputStream is = context.getHttpResponse().content().orElse(null);
5757
if(is != null) {
5858
try {
5959
${shape.variable.variableName}Builder.${explicitPayloadMember.fluentSetterMethodName}(software.amazon.awssdk.core.SdkBytes.fromInputStream(is));

codegen/src/main/resources/templates/query/ModelStaxUnmarshaller.ftl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public class ${shape.shapeName}Unmarshaller implements Unmarshaller<${shape.shap
8585
<#if shape.hasStatusCodeMember >
8686
<#list shape.members as memberModel>
8787
<#if memberModel.http.isStatusCode() >
88-
${shape.variable.variableName}.${memberModel.fluentSetterMethodName}(context.getHttpResponse().getStatusCode());
88+
${shape.variable.variableName}.${memberModel.fluentSetterMethodName}(context.getHttpResponse().statusCode());
8989
</#if>
9090

9191
<#if !memberModel.http.location?? || memberModel.http.location != "headers">

codegen/src/test/resources/software/amazon/awssdk/codegen/poet/client/test-async-client-class.java

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
1313
import software.amazon.awssdk.awscore.client.handler.AwsAsyncClientHandler;
1414
import software.amazon.awssdk.awscore.eventstream.EventStreamAsyncResponseTransformer;
15-
import software.amazon.awssdk.awscore.eventstream.EventStreamExceptionJsonUnmarshaller;
1615
import software.amazon.awssdk.awscore.eventstream.EventStreamTaggedUnionJsonUnmarshaller;
1716
import software.amazon.awssdk.awscore.exception.AwsServiceException;
1817
import software.amazon.awssdk.awscore.internal.protocol.json.AwsJsonProtocol;
@@ -44,7 +43,6 @@
4443
import software.amazon.awssdk.services.json.model.GetWithoutRequiredMembersRequest;
4544
import software.amazon.awssdk.services.json.model.GetWithoutRequiredMembersResponse;
4645
import software.amazon.awssdk.services.json.model.InvalidInputException;
47-
import software.amazon.awssdk.services.json.model.JsonException;
4846
import software.amazon.awssdk.services.json.model.JsonRequest;
4947
import software.amazon.awssdk.services.json.model.PaginatedOperationWithResultKeyRequest;
5048
import software.amazon.awssdk.services.json.model.PaginatedOperationWithResultKeyResponse;
@@ -227,21 +225,13 @@ public CompletableFuture<Void> eventStreamOperation(EventStreamOperationRequest
227225
.addUnmarshaller("EventTwo", EventTwoUnmarshaller.getInstance())
228226
.defaultUnmarshaller((in) -> EventStream.UNKNOWN).build());
229227

230-
HttpResponseHandler<? extends Throwable> exceptionHandler = jsonProtocolFactory
231-
.createResponseHandler(
232-
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
233-
EventStreamExceptionJsonUnmarshaller
234-
.builder()
235-
.defaultUnmarshaller(
236-
x -> EventStreamExceptionJsonUnmarshaller.populateDefaultException(
237-
JsonException::builder, x)).build());
238-
239228
HttpResponseHandler<AwsServiceException> errorResponseHandler = createErrorResponseHandler(jsonProtocolFactory);
240229
CompletableFuture<Void> future = new CompletableFuture<>();
241230
EventStreamAsyncResponseTransformer<EventStreamOperationResponse, EventStream> asyncResponseTransformer = EventStreamAsyncResponseTransformer
242231
.<EventStreamOperationResponse, EventStream> builder().eventStreamResponseHandler(asyncResponseHandler)
243232
.eventResponseHandler(eventResponseHandler).initialResponseHandler(responseHandler)
244-
.exceptionResponseHandler(exceptionHandler).future(future).executor(executor).build();
233+
.exceptionResponseHandler(errorResponseHandler).future(future).executor(executor).serviceName(serviceName())
234+
.build();
245235

246236
clientHandler.execute(
247237
new ClientExecutionParams<EventStreamOperationRequest, SdkResponse>()

core/auth/src/main/java/software/amazon/awssdk/auth/credentials/ContainerCredentialsProvider.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ private URI createGenericContainerUrl() {
134134
if (!ALLOWED_HOSTS.contains(uri.getHost())) {
135135

136136
throw SdkClientException.builder()
137-
.message(String.format("The full URI (%s) contained withing environment " +
137+
.message(String.format("The full URI (%s) contained within environment " +
138138
"variable %s has an invalid host. Host can only be one of [%s].",
139139
uri,
140140
SdkSystemSetting.AWS_CONTAINER_CREDENTIALS_FULL_URI
@@ -178,4 +178,4 @@ public ContainerCredentialsProvider build() {
178178
return new ContainerCredentialsProvider(this);
179179
}
180180
}
181-
}
181+
}

0 commit comments

Comments
 (0)