This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new adede5b  Add empty ApplicationBufferHandler for completeness
adede5b is described below

commit adede5b4e21a6466c4c0f3daaf01a34ba4127c5b
Author: remm <r...@apache.org>
AuthorDate: Mon Dec 7 21:30:01 2020 +0100

    Add empty ApplicationBufferHandler for completeness
---
 .../apache/tomcat/util/net/ApplicationBufferHandler.java  | 15 +++++++++++++++
 java/org/apache/tomcat/util/net/Nio2Channel.java          |  4 ++++
 java/org/apache/tomcat/util/net/NioChannel.java           |  9 +++++----
 3 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/ApplicationBufferHandler.java 
b/java/org/apache/tomcat/util/net/ApplicationBufferHandler.java
index d9a22ed..8362416 100644
--- a/java/org/apache/tomcat/util/net/ApplicationBufferHandler.java
+++ b/java/org/apache/tomcat/util/net/ApplicationBufferHandler.java
@@ -24,6 +24,21 @@ import java.nio.ByteBuffer;
  */
 public interface ApplicationBufferHandler {
 
+    static final ByteBuffer EMPTY_BUFFER = ByteBuffer.allocate(0);
+
+    static ApplicationBufferHandler EMPTY = new ApplicationBufferHandler() {
+        @Override
+        public void expand(int newSize) {
+        }
+        @Override
+        public void setByteBuffer(ByteBuffer buffer) {
+        }
+        @Override
+        public ByteBuffer getByteBuffer() {
+            return EMPTY_BUFFER;
+        }
+    };
+
     public void setByteBuffer(ByteBuffer buffer);
 
     public ByteBuffer getByteBuffer();
diff --git a/java/org/apache/tomcat/util/net/Nio2Channel.java 
b/java/org/apache/tomcat/util/net/Nio2Channel.java
index 9c57f02..a2612fd 100644
--- a/java/org/apache/tomcat/util/net/Nio2Channel.java
+++ b/java/org/apache/tomcat/util/net/Nio2Channel.java
@@ -263,6 +263,10 @@ public class Nio2Channel implements 
AsynchronousByteChannel {
         public void free() {
         }
         @Override
+        protected ApplicationBufferHandler getAppReadBufHandler() {
+            return ApplicationBufferHandler.EMPTY;
+        }
+        @Override
         public void setAppReadBufHandler(ApplicationBufferHandler handler) {
         }
         @Override
diff --git a/java/org/apache/tomcat/util/net/NioChannel.java 
b/java/org/apache/tomcat/util/net/NioChannel.java
index c1d4576..ac46d76 100644
--- a/java/org/apache/tomcat/util/net/NioChannel.java
+++ b/java/org/apache/tomcat/util/net/NioChannel.java
@@ -31,8 +31,6 @@ import org.apache.tomcat.util.res.StringManager;
  * Base class for a SocketChannel wrapper used by the endpoint.
  * This way, logic for an SSL socket channel remains the same as for
  * a non SSL, making sure we don't need to code for any exception cases.
- *
- * @version 1.0
  */
 public class NioChannel implements ByteChannel, ScatteringByteChannel, 
GatheringByteChannel {
 
@@ -106,7 +104,6 @@ public class NioChannel implements ByteChannel, 
ScatteringByteChannel, Gathering
      * Close the connection.
      *
      * @param force Should the underlying socket be forcibly closed?
-     *
      * @throws IOException If closing the secure channel fails.
      */
     public void close(boolean force) throws IOException {
@@ -216,7 +213,6 @@ public class NioChannel implements ByteChannel, 
ScatteringByteChannel, Gathering
      * Return true if the buffer wrote data. NO-OP for non-secure channel.
      *
      * @return Always returns {@code false} for non-secure channel
-     *
      * @throws IOException Never for non-secure channel
      */
     public boolean flushOutbound() throws IOException {
@@ -232,6 +228,7 @@ public class NioChannel implements ByteChannel, 
ScatteringByteChannel, Gathering
      * socket is removed from the poller without the socket being selected. 
This
      * results in a connection limit leak for NIO as the endpoint expects the
      * socket to be selected even in error conditions.
+     *
      * @throws IOException If the current thread was interrupted
      */
     protected void checkInterruptStatus() throws IOException {
@@ -263,6 +260,10 @@ public class NioChannel implements ByteChannel, 
ScatteringByteChannel, Gathering
         public void free() {
         }
         @Override
+        protected ApplicationBufferHandler getAppReadBufHandler() {
+            return ApplicationBufferHandler.EMPTY;
+        }
+        @Override
         public void setAppReadBufHandler(ApplicationBufferHandler handler) {
         }
         @Override


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to