Skip to content

Commit 5d2772a

Browse files
committed
8297424: java/net/httpclient/AsyncExecutorShutdown.java fails in AssertionError due to misplaced assert
Reviewed-by: jpai
1 parent 361b50e commit 5d2772a

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -549,13 +549,13 @@ public void onSubscribe(Flow.Subscription s) {
549549
closed = this.closed;
550550
if (!closed) {
551551
this.subscription = s;
552+
assert buffers.remainingCapacity() > 1; // should contain at least 2
552553
}
553554
}
554555
if (closed) {
555556
s.cancel();
556557
return;
557558
}
558-
assert buffers.remainingCapacity() > 1; // should contain at least 2
559559
if (debug.on())
560560
debug.log("onSubscribe: requesting "
561561
+ Math.max(1, buffers.remainingCapacity() - 1));

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

+5-6
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,9 @@ private void schedule() {
175175
if (subscriber == null) {
176176
// can't process anything yet
177177
return;
178-
} else {
179-
if (debug.on()) debug.log("subscribing user subscriber");
180-
subscriber.onSubscribe(userSubscription);
181178
}
179+
if (debug.on()) debug.log("subscribing user subscriber");
180+
subscriber.onSubscribe(userSubscription);
182181
}
183182
while (!inputQ.isEmpty()) {
184183
Http2Frame frame = inputQ.peek();
@@ -417,7 +416,7 @@ CompletableFuture<T> receiveData(BodySubscriber<T> bodySubscriber, Executor exec
417416
responseBodyCF.completeExceptionally(t);
418417
}
419418

420-
// ensure that the body subscriber will be subsribed and onError() is
419+
// ensure that the body subscriber will be subscribed and onError() is
421420
// invoked
422421
pendingResponseSubscriber = bodySubscriber;
423422
sched.runOrSchedule(); // in case data waiting already to be processed, or error
@@ -534,9 +533,9 @@ void incoming_reset(ResetFrame frame) {
534533
Flow.Subscriber<?> subscriber =
535534
responseSubscriber == null ? pendingResponseSubscriber : responseSubscriber;
536535
if (response == null && subscriber == null) {
537-
// we haven't receive the headers yet, and won't receive any!
536+
// we haven't received the headers yet, and won't receive any!
538537
// handle reset now.
539-
handleReset(frame, subscriber);
538+
handleReset(frame, null);
540539
} else {
541540
// put it in the input queue in order to read all
542541
// pending data frames first. Indeed, a server may send

0 commit comments

Comments
 (0)