You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by cs...@apache.org on 2026/10/21 17:17:00 UTC
(maven-resolver) branch master updated: Fix testPut_StartCancelled regression introduced by #2206 (#2219)
This is an automated email from the ASF dual-hosted git repository.
cstamas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-resolver.git
The following commit(s) were added to refs/heads/master by this push:
new b4634ebc8 Fix testPut_StartCancelled regression introduced by #2206 (#2219)
b4634ebc8 is described below
commit b4634ebc81c5d6bc951264d8bfbe82f3cd0353b0
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Wed Oct 21 19:16:55 2026 +0200
Fix testPut_StartCancelled regression introduced by #2206 (#2219)
## Summary
Fixes a regression introduced by #2206: `testPut_StartCancelled` fails on macOS CI with "Expected error" because `TransferCancelledException` from the retroactive `transportStarted()` call is silently swallowed.
## Root Cause
#2206 added a retroactive progress-event block that fires `transportStarted`/`transportProgressed` after a successful response, for macOS/Jetty configurations that skip `onRequestContent` callbacks. The block caught `TransferCancelledException` from `transportStarted()` and fell through silently:
```java
} catch (TransferCancelledException e) {
// upload already sent — retroactive notification cannot be cancelled;
// fall through to transportPropertiesAvailable and status check
}
```
When a test listener has `cancelStart()` set, `transportStarted()` is supposed to throw and the caller (`transporter.put()`) must surface that exception. The catch-and-ignore broke this contract, causing the PUT to complete without error instead of throwing `TransferCancelledException`.
## Fix
Remove the try/catch around the retroactive `transportStarted()` call. The exception propagates naturally — the fact that bytes were already sent does not authorise silencing a `cancelStart` cancellation.
The `catch (TransferCancelledException e) { break; }` inside the retroactive `transportProgressed` loop is kept as-is: it exits the loop (correct) and the status check still runs after.
## Testing
- `testPut_StartCancelled` now passes (was failing)
- `testPut_ProgressCancelled`, `testPut_ProxyAuthenticated`, `testPut_SSL` continue to pass
- Full `JettyTransporterTest` suite: 90 tests pass, 10 skipped (HTTP/3 infra), 0 failures
_Hermes Agent (Claude Sonnet 4.6) on behalf of Guillaume Nodet_
---
.../eclipse/aether/transport/jetty/JettyTransporter.java | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/maven-resolver-transport-jetty/src/main/java/org/eclipse/aether/transport/jetty/JettyTransporter.java b/maven-resolver-transport-jetty/src/main/java/org/eclipse/aether/transport/jetty/JettyTransporter.java
index 98e081c3e..4b026e941 100644
--- a/maven-resolver-transport-jetty/src/main/java/org/eclipse/aether/transport/jetty/JettyTransporter.java
+++ b/maven-resolver-transport-jetty/src/main/java/org/eclipse/aether/transport/jetty/JettyTransporter.java
@@ -411,15 +411,13 @@ final class JettyTransporter extends AbstractTransporter implements HttpTranspor
// Jetty may complete a small PUT without firing onRequestContent callbacks, leaving
// the progress listener uninformed even though the upload was sent.
// Fire the missing events regardless of response status so the listener contract
- // is honoured on both success and error paths.
+ // is honoured on both success and error paths. TransferCancelledException from
+ // transportStarted is propagated to the caller (cancelStart must be observable).
if (task.getDataLength() > 0 && !progressed.get()) {
if (started.compareAndSet(false, true)) {
- try {
- task.getListener().transportStarted(0, task.getDataLength());
- } catch (TransferCancelledException e) {
- // upload already sent — retroactive notification cannot be cancelled;
- // fall through to transportPropertiesAvailable and status check
- }
+ // propagate cancellation: even though the bytes are already sent,
+ // the TransportListener contract requires callers to observe cancelStart
+ task.getListener().transportStarted(0, task.getDataLength());
}
try (InputStream is = task.newInputStream()) {
byte[] buf = new byte[1024 * 32];
@@ -428,7 +426,7 @@ final class JettyTransporter extends AbstractTransporter implements HttpTranspor
try {
task.getListener().transportProgressed(ByteBuffer.wrap(buf, 0, n));
} catch (TransferCancelledException e) {
- break; // upload already sent — retroactive notification cannot be cancelled
+ break; // exit loop; fall through to transportPropertiesAvailable
}
}
}