Skip to content

Commit 5a38816

Browse files
committed
Issue jetty#11803 - remove unused Cancelled exception
1 parent 508cb5b commit 5a38816

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/content/ContentSourcePublisher.java

+4-11
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ public void request(long n)
243243
@Override
244244
public void cancel()
245245
{
246-
cancel(new Cancelled());
246+
cancel(new Suppressed("Subscription was cancelled manually"));
247247
}
248248

249249
public void cancel(Throwable cause)
@@ -270,7 +270,8 @@ public void cancel(Throwable cause)
270270
// Publisher succeeded -> cancel(COMPLETED)
271271
// 1.5 If a Publisher terminates successfully (finite stream) it MUST signal an onComplete.
272272

273-
// Subscriber
273+
// Subscriber notes
274+
//
274275
// 2.13 In the case that this rule is violated, any associated Subscription to the Subscriber
275276
// MUST be considered as cancelled, and the caller MUST raise this error condition in a
276277
// fashion that is adequate for the runtime environment.
@@ -279,7 +280,7 @@ public void cancel(Throwable cause)
279280

280281
// Subscription notes
281282
//
282-
// Subscription.cancel -> cancel(new Cancelled())
283+
// Subscription.cancel -> cancel(new Suppressed("Subscription was cancelled manually"))
283284
// It's not clearly specified in the specification, but according to:
284285
// - the issue: https://github.com/reactive-streams/reactive-streams-jvm/issues/458
285286
// - TCK test 'untested_spec108_possiblyCanceledSubscriptionShouldNotReceiveOnErrorOrOnCompleteSignals'
@@ -302,12 +303,4 @@ private static class Suppressed extends Throwable
302303
super(cause.getMessage(), cause);
303304
}
304305
}
305-
306-
private static class Cancelled extends Suppressed
307-
{
308-
Cancelled()
309-
{
310-
super("Subscription was cancelled");
311-
}
312-
}
313306
}

0 commit comments

Comments
 (0)