You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by vi...@apache.org on 2016/10/06 12:18:01 UTC

svn commit: r1763571 - in /tomcat/trunk/java/org/apache/coyote: ./ ajp/ http11/ http11/filters/ http2/

Author: violetagg
Date: Thu Oct  6 12:18:01 2016
New Revision: 1763571

URL: http://svn.apache.org/viewvc?rev=1763571&view=rev
Log:
Remove unused code.

Modified:
    tomcat/trunk/java/org/apache/coyote/InputBuffer.java
    tomcat/trunk/java/org/apache/coyote/Request.java
    tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java
    tomcat/trunk/java/org/apache/coyote/http11/Http11InputBuffer.java
    tomcat/trunk/java/org/apache/coyote/http11/filters/BufferedInputFilter.java
    tomcat/trunk/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java
    tomcat/trunk/java/org/apache/coyote/http11/filters/IdentityInputFilter.java
    tomcat/trunk/java/org/apache/coyote/http11/filters/SavedRequestInputFilter.java
    tomcat/trunk/java/org/apache/coyote/http11/filters/VoidInputFilter.java
    tomcat/trunk/java/org/apache/coyote/http2/Stream.java

Modified: tomcat/trunk/java/org/apache/coyote/InputBuffer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/InputBuffer.java?rev=1763571&r1=1763570&r2=1763571&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/InputBuffer.java (original)
+++ tomcat/trunk/java/org/apache/coyote/InputBuffer.java Thu Oct  6 12:18:01 2016
@@ -18,7 +18,6 @@ package org.apache.coyote;
 
 import java.io.IOException;
 
-import org.apache.tomcat.util.buf.ByteChunk;
 import org.apache.tomcat.util.net.ApplicationBufferHandler;
 
 /**
@@ -28,24 +27,6 @@ import org.apache.tomcat.util.net.Applic
 public interface InputBuffer {
 
     /**
-     * Read from the input stream into the given buffer.
-     * IMPORTANT: the current model assumes that the protocol will 'own' the
-     * buffer and return a pointer to it in ByteChunk (i.e. the param will
-     * have chunk.getBytes()==null before call, and the result after the call).
-     *
-     * @param chunk The buffer to read data into.
-     *
-     * @return The number of bytes that have been added to the buffer or -1 for
-     *         end of stream
-     *
-     * @throws IOException If an I/O error occurs reading from the input stream
-     *
-     * @deprecated Unused. Will be removed in Tomcat 9. Use
-     *             {@link #doRead(ApplicationBufferHandler)}
-     */
-    public int doRead(ByteChunk chunk) throws IOException;
-
-    /**
      * Read from the input stream into the ByteBuffer provided by the
      * ApplicaitonBufferHandler.
      * IMPORTANT: the current model assumes that the protocol will 'own' the

Modified: tomcat/trunk/java/org/apache/coyote/Request.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/Request.java?rev=1763571&r1=1763570&r2=1763571&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/Request.java (original)
+++ tomcat/trunk/java/org/apache/coyote/Request.java Thu Oct  6 12:18:01 2016
@@ -23,7 +23,6 @@ import java.util.concurrent.atomic.Atomi
 
 import javax.servlet.ReadListener;
 
-import org.apache.tomcat.util.buf.ByteChunk;
 import org.apache.tomcat.util.buf.MessageBytes;
 import org.apache.tomcat.util.buf.UDecoder;
 import org.apache.tomcat.util.http.MimeHeaders;
@@ -492,34 +491,6 @@ public final class Request {
     }
 
 
-    /**
-     * Read data from the input buffer and put it into a byte chunk.
-     *
-     * The buffer is owned by the protocol implementation - it will be reused on
-     * the next read. The Adapter must either process the data in place or copy
-     * it to a separate buffer if it needs to hold it. In most cases this is
-     * done during byte->char conversions or via InputStream. Unlike
-     * InputStream, this interface allows the app to process data in place,
-     * without copy.
-     *
-     * @param chunk The destination to which to copy the data
-     *
-     * @return The number of bytes copied
-     *
-     * @throws IOException If an I/O error occurs during the copy
-     *
-     * @deprecated Unused. Will be removed in Tomcat 9. Use
-     *             {@link #doRead(ApplicationBufferHandler)}
-     */
-    public int doRead(ByteChunk chunk) throws IOException {
-        int n = inputBuffer.doRead(chunk);
-        if (n > 0) {
-            bytesRead+=n;
-        }
-        return n;
-    }
-
-
     /**
      * Read data from the input buffer and put it into ApplicationBufferHandler.
      *

Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java?rev=1763571&r1=1763570&r2=1763571&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java Thu Oct  6 12:18:01 2016
@@ -1352,27 +1352,6 @@ public class AjpProcessor extends Abstra
      */
     protected class SocketInputBuffer implements InputBuffer {
 
-        /**
-         * @deprecated Unused. Will be removed in Tomcat 9. Use
-         *             {@link #doRead(ApplicationBufferHandler)}
-         */
-        @Override
-        public int doRead(ByteChunk chunk) throws IOException {
-
-            if (endOfStream) {
-                return -1;
-            }
-            if (empty) {
-                if (!refillReadBuffer(true)) {
-                    return -1;
-                }
-            }
-            ByteChunk bc = bodyBytes.getByteChunk();
-            chunk.setBytes(bc.getBuffer(), bc.getStart(), bc.getLength());
-            empty = true;
-            return chunk.getLength();
-        }
-
         @Override
         public int doRead(ApplicationBufferHandler handler) throws IOException {
 

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11InputBuffer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11InputBuffer.java?rev=1763571&r1=1763570&r2=1763571&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/Http11InputBuffer.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11InputBuffer.java Thu Oct  6 12:18:01 2016
@@ -25,7 +25,6 @@ import org.apache.coyote.InputBuffer;
 import org.apache.coyote.Request;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
-import org.apache.tomcat.util.buf.ByteChunk;
 import org.apache.tomcat.util.buf.MessageBytes;
 import org.apache.tomcat.util.http.MimeHeaders;
 import org.apache.tomcat.util.net.ApplicationBufferHandler;
@@ -282,20 +281,6 @@ public class Http11InputBuffer implement
 
     // ---------------------------------------------------- InputBuffer Methods
 
-    /**
-     * @deprecated Unused. Will be removed in Tomcat 9. Use
-     *             {@link #doRead(ApplicationBufferHandler)}
-     */
-    @Override
-    public int doRead(ByteChunk chunk) throws IOException {
-
-        if (lastActiveFilter == -1)
-            return inputStreamInputBuffer.doRead(chunk);
-        else
-            return activeFilters[lastActiveFilter].doRead(chunk);
-
-    }
-
     @Override
     public int doRead(ApplicationBufferHandler handler) throws IOException {
 
@@ -1071,28 +1056,6 @@ public class Http11InputBuffer implement
      */
     private class SocketInputBuffer implements InputBuffer {
 
-        /**
-         *
-         * @deprecated Unused. Will be removed in Tomcat 9. Use
-         *             {@link #doRead(ApplicationBufferHandler)}
-         */
-        @Override
-        public int doRead(ByteChunk chunk) throws IOException {
-
-            if (byteBuffer.position() >= byteBuffer.limit()) {
-                // The application is reading the HTTP request body which is
-                // always a blocking operation.
-                if (!fill(true))
-                    return -1;
-            }
-
-            int length = byteBuffer.remaining();
-            chunk.setBytes(byteBuffer.array(), byteBuffer.position(), length);
-            byteBuffer.position(byteBuffer.limit());
-
-            return length;
-        }
-
         @Override
         public int doRead(ApplicationBufferHandler handler) throws IOException {
 

Modified: tomcat/trunk/java/org/apache/coyote/http11/filters/BufferedInputFilter.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/filters/BufferedInputFilter.java?rev=1763571&r1=1763570&r2=1763571&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/filters/BufferedInputFilter.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/filters/BufferedInputFilter.java Thu Oct  6 12:18:01 2016
@@ -97,24 +97,6 @@ public class BufferedInputFilter impleme
     }
 
     /**
-     * Fills the given ByteChunk with the buffered request body.
-     *
-     * @deprecated Unused. Will be removed in Tomcat 9. Use
-     *             {@link #doRead(ApplicationBufferHandler)}
-     */
-    @Override
-    public int doRead(ByteChunk chunk) throws IOException {
-        if (isFinished()) {
-            return -1;
-        }
-
-        chunk.setBytes(buffered.array(), buffered.arrayOffset() + buffered.position(),
-                buffered.remaining());
-        hasRead = true;
-        return chunk.getLength();
-    }
-
-    /**
      * Fills the given ByteBuffer with the buffered request body.
      */
     @Override

Modified: tomcat/trunk/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java?rev=1763571&r1=1763570&r2=1763571&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java Thu Oct  6 12:18:01 2016
@@ -148,64 +148,6 @@ public class ChunkedInputFilter implemen
 
     // ---------------------------------------------------- InputBuffer Methods
 
-    /**
-     * @deprecated Unused. Will be removed in Tomcat 9. Use
-     *             {@link #doRead(ApplicationBufferHandler)}
-     */
-    @Override
-    public int doRead(ByteChunk chunk) throws IOException {
-        if (endChunk) {
-            return -1;
-        }
-
-        checkError();
-
-        if(needCRLFParse) {
-            needCRLFParse = false;
-            parseCRLF(false);
-        }
-
-        if (remaining <= 0) {
-            if (!parseChunkHeader()) {
-                throwIOException(sm.getString("chunkedInputFilter.invalidHeader"));
-            }
-            if (endChunk) {
-                parseEndChunk();
-                return -1;
-            }
-        }
-
-        int result = 0;
-
-        if (readChunk == null || readChunk.position() >= readChunk.limit()) {
-            if (readBytes() < 0) {
-                throwIOException(sm.getString("chunkedInputFilter.eos"));
-            }
-        }
-
-        if (remaining > readChunk.remaining()) {
-            result = readChunk.remaining();
-            remaining = remaining - result;
-            chunk.setBytes(readChunk.array(), readChunk.arrayOffset() + readChunk.position(), result);
-            readChunk.position(readChunk.limit());
-        } else {
-            result = remaining;
-            chunk.setBytes(readChunk.array(), readChunk.arrayOffset() + readChunk.position(), remaining);
-            readChunk.position(readChunk.position() + remaining);
-            remaining = 0;
-            //we need a CRLF
-            if ((readChunk.position() + 1) >= readChunk.limit()) {
-                //if we call parseCRLF we overrun the buffer here
-                //so we defer it to the next call BZ 11117
-                needCRLFParse = true;
-            } else {
-                parseCRLF(false); //parse the CRLF immediately
-            }
-        }
-
-        return result;
-    }
-
     @Override
     public int doRead(ApplicationBufferHandler handler) throws IOException {
         if (endChunk) {

Modified: tomcat/trunk/java/org/apache/coyote/http11/filters/IdentityInputFilter.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/filters/IdentityInputFilter.java?rev=1763571&r1=1763570&r2=1763571&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/filters/IdentityInputFilter.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/filters/IdentityInputFilter.java Thu Oct  6 12:18:01 2016
@@ -92,43 +92,6 @@ public class IdentityInputFilter impleme
 
     // ---------------------------------------------------- InputBuffer Methods
 
-    /**
-     * @deprecated Unused. Will be removed in Tomcat 9. Use
-     *             {@link #doRead(ApplicationBufferHandler)}
-     */
-    @Override
-    public int doRead(ByteChunk chunk) throws IOException {
-
-        int result = -1;
-
-        if (contentLength >= 0) {
-            if (remaining > 0) {
-                int nRead = buffer.doRead(chunk);
-                if (nRead > remaining) {
-                    // The chunk is longer than the number of bytes remaining
-                    // in the body; changing the chunk length to the number
-                    // of bytes remaining
-                    chunk.setBytes(chunk.getBytes(), chunk.getStart(),
-                                   (int) remaining);
-                    result = (int) remaining;
-                } else {
-                    result = nRead;
-                }
-                if (nRead > 0) {
-                    remaining = remaining - nRead;
-                }
-            } else {
-                // No more bytes left to be read : return -1 and clear the
-                // buffer
-                chunk.recycle();
-                result = -1;
-            }
-        }
-
-        return result;
-
-    }
-
     @Override
     public int doRead(ApplicationBufferHandler handler) throws IOException {
 

Modified: tomcat/trunk/java/org/apache/coyote/http11/filters/SavedRequestInputFilter.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/filters/SavedRequestInputFilter.java?rev=1763571&r1=1763570&r2=1763571&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/filters/SavedRequestInputFilter.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/filters/SavedRequestInputFilter.java Thu Oct  6 12:18:01 2016
@@ -45,30 +45,6 @@ public class SavedRequestInputFilter imp
         this.input = input;
     }
 
-    /**
-     * @deprecated Unused. Will be removed in Tomcat 9. Use
-     *             {@link #doRead(ApplicationBufferHandler)}
-     */
-    @Override
-    public int doRead(ByteChunk chunk) throws IOException {
-        if(input.getOffset()>= input.getEnd())
-            return -1;
-
-        int writeLength = 0;
-
-        if (chunk.getLimit() > 0 && chunk.getLimit() < input.getLength()) {
-            writeLength = chunk.getLimit();
-        } else {
-            writeLength = input.getLength();
-        }
-
-        input.substract(chunk.getBuffer(), 0, writeLength);
-        chunk.setOffset(0);
-        chunk.setEnd(writeLength);
-
-        return writeLength;
-    }
-
     @Override
     public int doRead(ApplicationBufferHandler handler) throws IOException {
         if(input.getOffset()>= input.getEnd())

Modified: tomcat/trunk/java/org/apache/coyote/http11/filters/VoidInputFilter.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/filters/VoidInputFilter.java?rev=1763571&r1=1763570&r2=1763571&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/filters/VoidInputFilter.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/filters/VoidInputFilter.java Thu Oct  6 12:18:01 2016
@@ -50,15 +50,6 @@ public class VoidInputFilter implements
 
     // ---------------------------------------------------- InputBuffer Methods
 
-    /**
-     * @deprecated Unused. Will be removed in Tomcat 9. Use
-     *             {@link #doRead(ApplicationBufferHandler)}
-     */
-    @Override
-    public int doRead(ByteChunk chunk) throws IOException {
-        return -1;
-    }
-
     @Override
     public int doRead(ApplicationBufferHandler handler) throws IOException {
         return -1;

Modified: tomcat/trunk/java/org/apache/coyote/http2/Stream.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/Stream.java?rev=1763571&r1=1763570&r2=1763571&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http2/Stream.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http2/Stream.java Thu Oct  6 12:18:01 2016
@@ -605,66 +605,6 @@ public class Stream extends AbstractStre
         private volatile boolean readInterest;
         private boolean reset = false;
 
-        /**
-         * @deprecated Unused. Will be removed in Tomcat 9. Use
-         *             {@link #doRead(ApplicationBufferHandler)}
-         */
-        @Override
-        public int doRead(ByteChunk chunk) throws IOException {
-
-            ensureBuffersExist();
-
-            int written = -1;
-
-            // Ensure that only one thread accesses inBuffer at a time
-            synchronized (inBuffer) {
-                while (inBuffer.position() == 0 && !isInputFinished()) {
-                    // Need to block until some data is written
-                    try {
-                        if (log.isDebugEnabled()) {
-                            log.debug(sm.getString("stream.inputBuffer.empty"));
-                        }
-                        inBuffer.wait();
-                        if (reset) {
-                            // TODO: i18n
-                            throw new IOException("HTTP/2 Stream reset");
-                        }
-                    } catch (InterruptedException e) {
-                        // Possible shutdown / rst or similar. Use an
-                        // IOException to signal to the client that further I/O
-                        // isn't possible for this Stream.
-                        throw new IOException(e);
-                    }
-                }
-
-                if (inBuffer.position() > 0) {
-                    // Data is available in the inBuffer. Copy it to the
-                    // outBuffer.
-                    inBuffer.flip();
-                    written = inBuffer.remaining();
-                    if (log.isDebugEnabled()) {
-                        log.debug(sm.getString("stream.inputBuffer.copy",
-                                Integer.toString(written)));
-                    }
-                    inBuffer.get(outBuffer, 0, written);
-                    inBuffer.clear();
-                } else if (isInputFinished()) {
-                    return -1;
-                } else {
-                    // Should never happen
-                    throw new IllegalStateException();
-                }
-            }
-
-            chunk.setBytes(outBuffer, 0,  written);
-
-            // Increment client-side flow control windows by the number of bytes
-            // read
-            handler.writeWindowUpdate(Stream.this, written, true);
-
-            return written;
-        }
-
         @Override
         public int doRead(ApplicationBufferHandler applicationBufferHandler) throws IOException {
 



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