afs commented on code in PR #3184:
URL: https://github.com/apache/jena/pull/3184#discussion_r2276615477


##########
jena-arq/src/main/java/org/apache/jena/http/HttpLib.java:
##########
@@ -640,25 +650,53 @@ public static HttpResponse<InputStream> 
executeJDK(HttpClient httpClient, HttpRe
      * @return HttpResponse
      */
     public static <T> HttpResponse<T> executeJDK(HttpClient httpClient, 
HttpRequest httpRequest, BodyHandler<T> bodyHandler) {
-        try {
-            // This is the one place all HTTP requests go through.
-            logRequest(httpRequest);
-            HttpResponse<T> httpResponse = httpClient.send(httpRequest, 
bodyHandler);
-            logResponse(httpResponse);
-            return httpResponse;
-        //} catch (HttpTimeoutException ex) {
-        } catch (IOException | InterruptedException ex) {
-            if ( ex.getMessage() != null ) {
-                // This is silly.
-                // Rather than an HTTP exception, bad authentication becomes 
IOException("too many authentication attempts");
-                // or IOException("No credentials provided") if the 
authenticator decides to return null.
-                if ( ex.getMessage().contains("too many authentication 
attempts") ||
-                     ex.getMessage().contains("No credentials provided") ) {
-                    throw new HttpException(401, HttpSC.getMessage(401));
+        return AsyncHttpRDF.getOrElseThrow(executeJDKAsync(httpClient, 
httpRequest, bodyHandler));
+    }
+
+    /**
+     * Execute request and return a {@code HttpResponse<InputStream>} response.
+     * Status codes have not been handled. The response can be passed to
+     * {@link #handleResponseInputStream(HttpResponse)} which will convert 
non-2xx
+     * status code to {@link HttpException HttpExceptions}.
+     *
+     * @param httpClient
+     * @param httpRequest
+     * @return HttpResponse
+     */
+    public static CompletableFuture<HttpResponse<InputStream>> 
executeJDKAsync(HttpClient httpClient, HttpRequest httpRequest) {

Review Comment:
   I don't think we need this.
   
   `executeJDK*` is a system primitive and having one operation (+ non-async) 
makes that clearer IMO.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to