From 45db74eee0196a61a8209d4dc54e7d63cce6c6f4 Mon Sep 17 00:00:00 2001 From: Ludovic Orban Date: Wed, 1 Mar 2023 17:25:32 +0100 Subject: [PATCH] #9410 Improved toString() and javadoc Signed-off-by: Ludovic Orban --- .../jetty/io/AbstractRetainableByteBuffer.java | 2 +- .../src/main/java/org/eclipse/jetty/io/Content.java | 1 + .../eclipse/jetty/io/internal/ByteBufferChunk.java | 12 ++++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/AbstractRetainableByteBuffer.java b/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/AbstractRetainableByteBuffer.java index b539434a89c..de69a916bbf 100644 --- a/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/AbstractRetainableByteBuffer.java +++ b/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/AbstractRetainableByteBuffer.java @@ -73,6 +73,6 @@ public abstract class AbstractRetainableByteBuffer implements RetainableByteBuff @Override public String toString() { - return "%s@%x[r=%d,%s]".formatted(getClass().getSimpleName(), hashCode(), refCount.get(), BufferUtil.toDetailString(byteBuffer)); + return "%s@%x[rc=%d,%s]".formatted(getClass().getSimpleName(), hashCode(), refCount.get(), BufferUtil.toDetailString(byteBuffer)); } } diff --git a/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/Content.java b/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/Content.java index 61ac77854af..64546043c49 100644 --- a/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/Content.java +++ b/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/Content.java @@ -333,6 +333,7 @@ public class Content * the content reader reads a content chunk, via an {@link Chunk.Error} instance.

*

If {@link #read()} has returned a last chunk, this is a no operation.

*

Typical failure: the content being aborted by user code, or idle timeouts.

+ *

If this method has already been called, then it is a no operation.

* * @param failure the cause of the failure */ diff --git a/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/internal/ByteBufferChunk.java b/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/internal/ByteBufferChunk.java index 0d165d8329e..ad011ac93c6 100644 --- a/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/internal/ByteBufferChunk.java +++ b/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/internal/ByteBufferChunk.java @@ -82,6 +82,12 @@ public abstract class ByteBufferChunk implements Content.Chunk { return references.release(); } + + @Override + public String toString() + { + return "%s[rc=%d]".formatted(super.toString(), references.get()); + } } public static class ReleasedByRunnable extends ByteBufferChunk.WithReferenceCount @@ -159,5 +165,11 @@ public abstract class ByteBufferChunk implements Content.Chunk { return retainable.release(); } + + @Override + public String toString() + { + return "%s[%s]".formatted(super.toString(), retainable); + } } }