/** * Commits the multi-part upload after all in-progress uploads have * completed. * <p> * This is a blocking call, and throws IllegalStateException if you try to commit an upload * in which the Manifest reports it is not successful ({@link MultipartManifest#isUploadSuccessful}). * @return The commit response. */ public CommitMultipartUploadResponse commit() { validateState(); transferManager.awaitCompletion(); if (!manifest.isUploadSuccessful()) { throw new IllegalStateException( "One or more parts were have not completed upload successfully"); } return service.commitMultipartUpload( CommitMultipartUploadRequest.builder() .namespaceName(namespaceName) .bucketName(bucketName) .objectName(objectName) .uploadId(manifest.getUploadId()) .commitMultipartUploadDetails( CommitMultipartUploadDetails.builder() .partsToCommit(manifest.listCompletedParts()) .partsToExclude( new ArrayList<Integer>(0)) // nothing to exclude .build()) .opcClientRequestId(createClientRequestId("-commit")) .build()); }