diff --git a/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http3/Http3ServerStreamImpl.java b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http3/Http3ServerStreamImpl.java index e86b6f23dba..ebe92fa3bac 100644 --- a/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http3/Http3ServerStreamImpl.java +++ b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http3/Http3ServerStreamImpl.java @@ -301,27 +301,16 @@ final class Http3ServerStreamImpl { ByteBuffer current; ByteBuffer current() throws IOException { - Object reason = closeReason.get(); - if (reason != null) { - if (reason == Boolean.TRUE) { - throw new IOException("Stream is closed"); - } else { - throw new IOException((IOException)reason); - } - } while (true) { - if (current != null && current.hasRemaining()) { - return current; - } - if (current == QuicStreamReader.EOF) { - reason = closeReason.get(); - if (reason != null) { - if (reason == Boolean.TRUE) { - throw new IOException("Stream is closed"); - } else { - throw new IOException((IOException)reason); - } + Object reason = closeReason.get(); + if (reason != null) { + if (reason == Boolean.TRUE) { + throw new IOException("Stream is closed"); + } else { + throw new IOException((IOException)reason); } + } + if (current != null && (current.hasRemaining() || current == QuicStreamReader.EOF)) { return current; } try {