Copilot commented on code in PR #2326:
URL: https://github.com/apache/maven-resolver/pull/2326#discussion_r4615479017


##########
maven-resolver-spi/src/main/java/org/eclipse/aether/spi/connector/transport/http/RFC9457/HttpRFC9457Exception.java:
##########
@@ -18,35 +18,21 @@
  */
 package org.eclipse.aether.spi.connector.transport.http.RFC9457;
 
-import java.io.IOException;
-
 import org.eclipse.aether.spi.connector.transport.http.HttpTransporter;
+import 
org.eclipse.aether.spi.connector.transport.http.HttpTransporterException;
 
 /**
- * Exception thrown by {@link HttpTransporter} in case of errors.
+ * Exception thrown by {@link HttpTransporter} in case of non 2xx responses 
carrying a RFC 9457 payload.
  */
-public class HttpRFC9457Exception extends IOException {
-    private final int statusCode;
-
-    private final String reasonPhrase;
+public class HttpRFC9457Exception extends HttpTransporterException {

Review Comment:
   RFC 9457 responses with status 404/410 now receive the correct 
`ERROR_NOT_FOUND` classification, but 
`ArtifactTransportListener.transferFailed()` wraps them without a cause, losing 
the payload and leaving `getDebugMessage()` empty. 
`MetadataTransportListener.transferFailed()` also drops the original exception. 
Preserve the cause in both not-found wrappers while keeping the corrected 
classification, and add a connector-level regression test.



##########
maven-resolver-transport-apache/src/main/java/org/eclipse/aether/transport/apache/ApacheTransporter.java:
##########
@@ -598,12 +593,10 @@ private <T extends HttpUriRequest> void resume(T request, 
GetTask task) throws I
         }
     }
 
-    private void handleStatus(CloseableHttpResponse response) throws Exception 
{
+    private void handleStatus(CloseableHttpResponse response) throws 
HttpTransporterException {
         int status = response.getStatusLine().getStatusCode();
         if (status >= 300) {
-            ApacheRFC9457Reporter.INSTANCE.generateException(response, 
(statusCode, reasonPhrase) -> {
-                throw new HttpResponseException(statusCode, reasonPhrase + " 
(" + statusCode + ")");
-            });
+            ApacheRFC9457Reporter.INSTANCE.generateException(response);

Review Comment:
   `ApacheRFC9457Reporter.getReasonPhrase()` still returns the phrase with the 
status appended (for example, `Not Found (404)`). Forwarding that value to the 
new shared formatter produces `HTTP Status: 404 (Not Found (404))`, and the new 
`getReasonPhrase()` accessor also exposes the decorated value rather than the 
HTTP reason phrase. Please return the raw reason phrase from the Apache 
reporter now that `HttpTransporterException` handles status formatting.



-- 
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]

Reply via email to