Skip to content

Commit 0756108

Browse files
committed
8297424: java/net/httpclient/AsyncExecutorShutdown.java fails in AssertionError due to misplaced assert
Backport-of: 5d2772a43ef6409bf556cefb4eb4242594451674
1 parent f40b56e commit 0756108

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/java.net.http/share/classes/jdk/internal/net/http/ResponseSubscribers.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,13 +552,13 @@ public void onSubscribe(Flow.Subscription s) {
552552
closed = this.closed;
553553
if (!closed) {
554554
this.subscription = s;
555+
assert buffers.remainingCapacity() > 1; // should contain at least 2
555556
}
556557
}
557558
if (closed) {
558559
s.cancel();
559560
return;
560561
}
561-
assert buffers.remainingCapacity() > 1; // should contain at least 2
562562
if (debug.on())
563563
debug.log("onSubscribe: requesting "
564564
+ Math.max(1, buffers.remainingCapacity() - 1));

src/java.net.http/share/classes/jdk/internal/net/http/Stream.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,9 @@ private void schedule() {
184184
if (subscriber == null) {
185185
// can't process anything yet
186186
return;
187-
} else {
188-
if (debug.on()) debug.log("subscribing user subscriber");
189-
subscriber.onSubscribe(userSubscription);
190187
}
188+
if (debug.on()) debug.log("subscribing user subscriber");
189+
subscriber.onSubscribe(userSubscription);
191190
}
192191
while (!inputQ.isEmpty()) {
193192
Http2Frame frame = inputQ.peek();
@@ -420,7 +419,7 @@ CompletableFuture<T> receiveData(BodySubscriber<T> bodySubscriber, Executor exec
420419
responseBodyCF.completeExceptionally(t);
421420
}
422421

423-
// ensure that the body subscriber will be subsribed and onError() is
422+
// ensure that the body subscriber will be subscribed and onError() is
424423
// invoked
425424
pendingResponseSubscriber = bodySubscriber;
426425
sched.runOrSchedule(); // in case data waiting already to be processed, or error
@@ -600,9 +599,9 @@ void incoming_reset(ResetFrame frame) {
600599
Flow.Subscriber<?> subscriber =
601600
responseSubscriber == null ? pendingResponseSubscriber : responseSubscriber;
602601
if (response == null && subscriber == null) {
603-
// we haven't receive the headers yet, and won't receive any!
602+
// we haven't received the headers yet, and won't receive any!
604603
// handle reset now.
605-
handleReset(frame, subscriber);
604+
handleReset(frame, null);
606605
} else {
607606
// put it in the input queue in order to read all
608607
// pending data frames first. Indeed, a server may send

0 commit comments

Comments
 (0)