Author: markt Date: Wed Aug 12 14:44:15 2015 New Revision: 1695541 URL: http://svn.apache.org/r1695541 Log: Remove unused code and clean-up the surrounding area as it is distracting from trying to fix the root cause of bug 58230.
Modified: tomcat/trunk/java/org/apache/catalina/connector/InputBuffer.java tomcat/trunk/java/org/apache/tomcat/util/buf/ByteChunk.java tomcat/trunk/java/org/apache/tomcat/util/buf/CharChunk.java Modified: tomcat/trunk/java/org/apache/catalina/connector/InputBuffer.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/InputBuffer.java?rev=1695541&r1=1695540&r2=1695541&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/connector/InputBuffer.java (original) +++ tomcat/trunk/java/org/apache/catalina/connector/InputBuffer.java Wed Aug 12 14:44:15 2015 @@ -315,16 +315,10 @@ public class InputBuffer extends Reader /** * Reads new bytes in the byte chunk. * - * @param cbuf Byte buffer to be written to the response - * @param off Offset - * @param len Length - * * @throws IOException An underlying IOException occurred */ @Override - public int realReadBytes(byte cbuf[], int off, int len) - throws IOException { - + public int realReadBytes() throws IOException { if (closed) { return -1; } @@ -339,13 +333,10 @@ public class InputBuffer extends Reader int result = coyoteRequest.doRead(bb); return result; - } - public int readByte() - throws IOException { - + public int readByte() throws IOException { if (closed) { throw new IOException(sm.getString("inputBuffer.streamClosed")); } @@ -354,9 +345,7 @@ public class InputBuffer extends Reader } - public int read(byte[] b, int off, int len) - throws IOException { - + public int read(byte[] b, int off, int len) throws IOException { if (closed) { throw new IOException(sm.getString("inputBuffer.streamClosed")); } @@ -375,8 +364,7 @@ public class InputBuffer extends Reader * mark is lost. */ @Override - public void realWriteChars(char c[], int off, int len) - throws IOException { + public void realWriteChars(char c[], int off, int len) throws IOException { markPos = -1; cb.setOffset(0); cb.setEnd(0); @@ -389,9 +377,7 @@ public class InputBuffer extends Reader @Override - public int realReadChars(char cbuf[], int off, int len) - throws IOException { - + public int realReadChars() throws IOException { if (!gotEnc) { setConverter(); } @@ -399,7 +385,7 @@ public class InputBuffer extends Reader boolean eof = false; if (bb.getLength() <= 0) { - int nRead = realReadBytes(bb.getBytes(), 0, bb.getBytes().length); + int nRead = realReadBytes(); if (nRead < 0) { eof = true; } @@ -467,10 +453,7 @@ public class InputBuffer extends Reader @Override - public long skip(long n) - throws IOException { - - + public long skip(long n) throws IOException { if (closed) { throw new IOException(sm.getString("inputBuffer.streamClosed")); } @@ -487,28 +470,18 @@ public class InputBuffer extends Reader } else { nRead += cb.getLength(); cb.setOffset(cb.getEnd()); - int toRead = 0; - if (cb.getChars().length < (n - nRead)) { - toRead = cb.getChars().length; - } else { - toRead = (int) (n - nRead); - } - int nb = realReadChars(cb.getChars(), 0, toRead); + int nb = realReadChars(); if (nb < 0) { break; } } } - return nRead; - } @Override - public boolean ready() - throws IOException { - + public boolean ready() throws IOException { if (closed) { throw new IOException(sm.getString("inputBuffer.streamClosed")); } Modified: tomcat/trunk/java/org/apache/tomcat/util/buf/ByteChunk.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/buf/ByteChunk.java?rev=1695541&r1=1695540&r2=1695541&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/buf/ByteChunk.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/buf/ByteChunk.java Wed Aug 12 14:44:15 2015 @@ -75,12 +75,13 @@ public final class ByteChunk implements */ public static interface ByteInputChannel { /** - * Read new bytes ( usually the internal conversion buffer ). - * The implementation is allowed to ignore the parameters, - * and mutate the chunk if it wishes to implement its own buffering. + * Read new bytes. + * + * @return The number of bytes read + * + * @throws IOException If an I/O occurs while reading the bytes */ - public int realReadBytes(byte cbuf[], int off, int len) - throws IOException; + public int realReadBytes() throws IOException; } /** Same as java.nio.channel.WrittableByteChannel. @@ -353,59 +354,51 @@ public final class ByteChunk implements // -------------------- Removing data from the buffer -------------------- - public int substract() - throws IOException { - + public int substract() throws IOException { if ((end - start) == 0) { if (in == null) { return -1; } - int n = in.realReadBytes( buff, 0, buff.length ); + int n = in.realReadBytes(); if (n < 0) { return -1; } } - return (buff[start++] & 0xFF); - } - public byte substractB() - throws IOException { + public byte substractB() throws IOException { if ((end - start) == 0) { - if (in == null) + if (in == null) { return -1; - int n = in.realReadBytes( buff, 0, buff.length ); - if (n < 0) + } + int n = in.realReadBytes(); + if (n < 0) { return -1; + } } - - return (buff[start++]); - + return buff[start++]; } - public int substract( byte src[], int off, int len ) - throws IOException { + public int substract(byte dest[], int off, int len ) throws IOException { if ((end - start) == 0) { if (in == null) { return -1; } - int n = in.realReadBytes( buff, 0, buff.length ); + int n = in.realReadBytes(); if (n < 0) { return -1; } } - int n = len; if (len > getLength()) { n = getLength(); } - System.arraycopy(buff, start, src, off, n); + System.arraycopy(buff, start, dest, off, n); start += n; return n; - } Modified: tomcat/trunk/java/org/apache/tomcat/util/buf/CharChunk.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/buf/CharChunk.java?rev=1695541&r1=1695540&r2=1695541&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/buf/CharChunk.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/buf/CharChunk.java Wed Aug 12 14:44:15 2015 @@ -37,12 +37,13 @@ public final class CharChunk implements // Input interface, used when the buffer is emptied. public static interface CharInputChannel { /** - * Read new bytes ( usually the internal conversion buffer ). - * The implementation is allowed to ignore the parameters, - * and mutate the chunk if it wishes to implement its own buffering. + * Read new characters. + * + * @return The number of characters read + * + * @throws IOException If an I/O error occurs reading the characters */ - public int realReadChars(char cbuf[], int off, int len) - throws IOException; + public int realReadChars() throws IOException; } /** * When we need more space we'll either @@ -341,31 +342,25 @@ public final class CharChunk implements // -------------------- Removing data from the buffer -------------------- - public int substract() - throws IOException { - + public int substract() throws IOException { if ((end - start) == 0) { if (in == null) { return -1; } - int n = in.realReadChars(buff, end, buff.length - end); + int n = in.realReadChars(); if (n < 0) { return -1; } } - return (buff[start++]); - } - public int substract( char src[], int off, int len ) - throws IOException { - + public int substract(char dest[], int off, int len) throws IOException { if ((end - start) == 0) { if (in == null) { return -1; } - int n = in.realReadChars( buff, end, buff.length - end); + int n = in.realReadChars(); if (n < 0) { return -1; } @@ -375,16 +370,13 @@ public final class CharChunk implements if (len > getLength()) { n = getLength(); } - System.arraycopy(buff, start, src, off, n); + System.arraycopy(buff, start, dest, off, n); start += n; return n; - } - public void flushBuffer() - throws IOException - { + public void flushBuffer() throws IOException { //assert out!=null if( out==null ) { throw new IOException( "Buffer overflow, no sink " + limit + " " + --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org