On Mon, 19 Oct 2026 17:49:26 GMT, Daniel Jeliński <[email protected]> wrote:
>> ok, what's the point of the errorref check then? Is it just to avoid the >> costly getBody call? > > Suggestion: > > if (bodyCf == null || bodyCf.isCompletedExceptionally()) > break; > > isCancelled implies isCompletedExceptionally, no need to check both. > ok, what's the point of the errorref check then? Is it just to avoid the > costly getBody call? The problem is when using ofInputStream; In that case the bodyCF is completed before the data is pulled. But if the bodyCf was completed exceptionally, the caller will never get access to the InputStream and never be able to pull the data. So if an error was recorded, and the bodyCf is already completed exceptionally, we need to break the loop here and cancel the stream even if we have unprocessed data in the queue, as nothing will be pulling that data. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/33385#discussion_r4324546476
