From 4ffa3e48c6c657afc6f49e68917e7a215eb54a3f Mon Sep 17 00:00:00 2001 From: Daniel Jelinski Date: Fri, 30 Jan 2026 09:59:10 +0100 Subject: [PATCH] remove duplicate code in current() --- .../test/lib/http3/Http3ServerStreamImpl.java | 27 ++++++------------- 1 file changed, 8 insertions(+), 19 deletions(-) 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 {