diff --git a/jetty-core/jetty-client/src/test/java/org/eclipse/jetty/client/ssl/SslConnectionTest.java b/jetty-core/jetty-client/src/test/java/org/eclipse/jetty/client/ssl/SslConnectionTest.java index df8c0f870884..dae684b80d91 100644 --- a/jetty-core/jetty-client/src/test/java/org/eclipse/jetty/client/ssl/SslConnectionTest.java +++ b/jetty-core/jetty-client/src/test/java/org/eclipse/jetty/client/ssl/SslConnectionTest.java @@ -62,7 +62,7 @@ public void onFillable() // There are no bytes in the endPoint, so we fill zero. // However, this will trigger state changes in SSLEngine // that will later cause it to throw ISE("Internal error"). - sslEndPoint.fill(BufferUtil.EMPTY_WRITABLE_BUFFER); + sslEndPoint.fill(BufferUtil.EMPTY_BUFFER); // Close the connection before filling. sslEndPoint.shutdownOutput(); @@ -76,6 +76,6 @@ public void onFillable() // We want SSLHandshakeException to be thrown instead, because it is // handled better (it is an IOException) by the Connection code that // reads from the EndPoint. - assertThrows(SSLHandshakeException.class, () -> sslEndPoint.fill(BufferUtil.EMPTY_WRITABLE_BUFFER)); + assertThrows(SSLHandshakeException.class, () -> sslEndPoint.fill(BufferUtil.EMPTY_BUFFER)); } } diff --git a/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/NegotiatingClientConnection.java b/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/NegotiatingClientConnection.java index 36cf67c75382..9691c1ddc3d6 100644 --- a/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/NegotiatingClientConnection.java +++ b/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/NegotiatingClientConnection.java @@ -99,7 +99,7 @@ private int fill() { try { - return getEndPoint().fill(BufferUtil.EMPTY_WRITABLE_BUFFER); + return getEndPoint().fill(BufferUtil.EMPTY_BUFFER); } catch (IOException x) { diff --git a/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/ssl/SslConnection.java b/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/ssl/SslConnection.java index 60cad8e9dbfd..39f74d7dde11 100644 --- a/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/ssl/SslConnection.java +++ b/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/ssl/SslConnection.java @@ -580,7 +580,7 @@ protected void onFillable() waitingForFill = _flushState == FlushState.WAIT_FOR_FILL; } if (waitingForFill) - fill(BufferUtil.EMPTY_WRITABLE_BUFFER); + fill(BufferUtil.EMPTY_BUFFER); } } catch (Throwable e) @@ -1080,7 +1080,7 @@ public boolean flush(ByteBuffer... appOuts) throws IOException break; if (_fillState == FillState.IDLE) { - int filled = fill(BufferUtil.EMPTY_WRITABLE_BUFFER); + int filled = fill(BufferUtil.EMPTY_BUFFER); if (_sslEngine.getHandshakeStatus() != status) continue; if (filled < 0) @@ -1270,7 +1270,7 @@ protected void onIncompleteFlush() // Try filling ourselves try { - int filled = fill(BufferUtil.EMPTY_WRITABLE_BUFFER); + int filled = fill(BufferUtil.EMPTY_BUFFER); // If this changed the status, let's try again if (_sslEngine.getHandshakeStatus() != status) continue; diff --git a/jetty-core/jetty-quic/jetty-quic-common/src/main/java/org/eclipse/jetty/quic/common/QuicStreamEndPoint.java b/jetty-core/jetty-quic/jetty-quic-common/src/main/java/org/eclipse/jetty/quic/common/QuicStreamEndPoint.java index 7986d4b2a6b1..a86d7cd011cc 100644 --- a/jetty-core/jetty-quic/jetty-quic-common/src/main/java/org/eclipse/jetty/quic/common/QuicStreamEndPoint.java +++ b/jetty-core/jetty-quic/jetty-quic-common/src/main/java/org/eclipse/jetty/quic/common/QuicStreamEndPoint.java @@ -271,7 +271,7 @@ public boolean onReadable() // Check if the stream was finished normally. try { - fill(BufferUtil.EMPTY_WRITABLE_BUFFER); + fill(BufferUtil.EMPTY_BUFFER); } catch (EOFException x) { diff --git a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/NegotiatingServerConnection.java b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/NegotiatingServerConnection.java index 3292ce948f37..59b1f6eb981d 100644 --- a/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/NegotiatingServerConnection.java +++ b/jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/NegotiatingServerConnection.java @@ -144,7 +144,7 @@ private int fill() { try { - return getEndPoint().fill(BufferUtil.EMPTY_WRITABLE_BUFFER); + return getEndPoint().fill(BufferUtil.EMPTY_BUFFER); } catch (IOException x) { diff --git a/jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/BufferUtil.java b/jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/BufferUtil.java index 96f61e524826..39d22fb451eb 100644 --- a/jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/BufferUtil.java +++ b/jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/BufferUtil.java @@ -107,8 +107,7 @@ public class BufferUtil }; public static final byte[] EMPTY_BYTES = new byte[0]; - public static final ByteBuffer EMPTY_WRITABLE_BUFFER = ByteBuffer.wrap(EMPTY_BYTES); - public static final ByteBuffer EMPTY_BUFFER = EMPTY_WRITABLE_BUFFER.asReadOnlyBuffer(); + public static final ByteBuffer EMPTY_BUFFER = ByteBuffer.wrap(EMPTY_BYTES); /** * Allocate ByteBuffer in flush mode.