|
50 | 50 | public final class S3CrtResponseHandlerAdapter implements S3MetaRequestResponseHandler { |
51 | 51 | private static final Logger log = Logger.loggerFor(S3CrtResponseHandlerAdapter.class); |
52 | 52 | private static final Duration META_REQUEST_TIMEOUT = Duration.ofSeconds(10); |
53 | | - private static final int CRT_SUCCESSFUL_CANCEL = 14374; |
54 | | - |
55 | 53 | private final CompletableFuture<Void> resultFuture; |
56 | 54 | private final SdkAsyncHttpResponseHandler responseHandler; |
57 | 55 |
|
@@ -154,8 +152,6 @@ public int onResponseBody(ByteBuffer bodyBytesIn, long objectRangeStart, long ob |
154 | 152 | public void onFinished(S3FinishedResponseContext context) { |
155 | 153 | int crtCode = context.getErrorCode(); |
156 | 154 | log.debug(() -> "Request finished with code: " + crtCode); |
157 | | - initiateResponseHandling(initialHeadersResponse.build()); |
158 | | - |
159 | 155 | if (crtCode != CRT.AWS_CRT_SUCCESS) { |
160 | 156 | handleError(context); |
161 | 157 | } else { |
@@ -186,29 +182,11 @@ private void handleError(S3FinishedResponseContext context) { |
186 | 182 |
|
187 | 183 | if (isServiceError(responseStatus) && errorPayload != null) { |
188 | 184 | handleServiceError(responseStatus, headers, errorPayload); |
189 | | - } else if (crtCode == CRT_SUCCESSFUL_CANCEL) { |
190 | | - handleSuccessfulCancel(context, crtCode); |
191 | 185 | } else { |
192 | 186 | handleIoError(context, crtCode); |
193 | 187 | } |
194 | 188 | } |
195 | 189 |
|
196 | | - private void handleSuccessfulCancel(S3FinishedResponseContext context, int crtCode) { |
197 | | - if (!responseHandlingInitiated) { |
198 | | - responseHandlingInitiated = true; |
199 | | - responseHandler.onHeaders(initialHeadersResponse.build()); |
200 | | - } |
201 | | - |
202 | | - Throwable cause = context.getCause(); |
203 | | - |
204 | | - // TODO: Potentially subclass this exception |
205 | | - SdkClientException sdkClientException = |
206 | | - SdkClientException.create("Failed to send the request: " + |
207 | | - CRT.awsErrorString(crtCode), cause); |
208 | | - failResponseHandlerAndFuture(sdkClientException); |
209 | | - notifyResponsePublisherErrorIfNeeded(sdkClientException); |
210 | | - } |
211 | | - |
212 | 190 | private void handleIoError(S3FinishedResponseContext context, int crtCode) { |
213 | 191 | Throwable cause = context.getCause(); |
214 | 192 |
|
|
0 commit comments