MCPcopy Create free account
hub / github.com/GDATASoftwareAG/vaas / sendFileWithRetry

Method sendFileWithRetry

java/src/main/java/de/gdata/vaas/Vaas.java:137–151  ·  view source on GitHub ↗
(HttpClient httpClient, URI uri, String vaasRequestId)

Source from the content-addressed store, hash-verified

135 }
136
137 private CompletableFuture<VaasVerdict> sendFileWithRetry(HttpClient httpClient, URI uri, String vaasRequestId) {
138 return createHttpRequestBuilderWithHeaders(uri, vaasRequestId).thenCompose(request ->
139 httpClient.sendAsync(request.build(), HttpResponse.BodyHandlers.ofString())
140 .thenCompose(handleException(response -> switch (response.statusCode()) {
141 case 200 -> {
142 var fileReport = FileReport.fromJson(response.body());
143 yield CompletableFuture.completedFuture(VaasVerdict.From(fileReport));
144 }
145 case 201, 202 -> sendFileWithRetry(httpClient, uri, vaasRequestId);
146 default -> {
147 throwParsedVaasError(response);
148 throw new Exception("Unreachable");
149 }
150 })));
151 }
152
153 private CompletableFuture<HttpRequest.Builder> createHttpRequestBuilderWithHeaders(URI uri, String requestId) {
154 return this.authenticator.getToken().thenApply(token -> {

Callers 1

forSha256AsyncMethod · 0.95

Calls 6

fromJsonMethod · 0.95
FromMethod · 0.95
throwParsedVaasErrorMethod · 0.95
handleExceptionMethod · 0.80
buildMethod · 0.45

Tested by

no test coverage detected