Author: markt Date: Sun Jan 8 18:43:32 2012 New Revision: 1228909 URL: http://svn.apache.org/viewvc?rev=1228909&view=rev Log: Removed deprecated and unused code
Modified: tomcat/trunk/java/org/apache/tomcat/util/buf/Ascii.java tomcat/trunk/java/org/apache/tomcat/util/buf/ByteChunk.java tomcat/trunk/java/org/apache/tomcat/util/buf/C2BConverter.java tomcat/trunk/java/org/apache/tomcat/util/buf/CharChunk.java tomcat/trunk/java/org/apache/tomcat/util/buf/HexUtils.java tomcat/trunk/java/org/apache/tomcat/util/buf/MessageBytes.java tomcat/trunk/java/org/apache/tomcat/util/buf/UDecoder.java tomcat/trunk/java/org/apache/tomcat/util/buf/UEncoder.java tomcat/trunk/test/org/apache/tomcat/util/buf/TestByteChunk.java Modified: tomcat/trunk/java/org/apache/tomcat/util/buf/Ascii.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/buf/Ascii.java?rev=1228909&r1=1228908&r2=1228909&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/buf/Ascii.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/buf/Ascii.java Sun Jan 8 18:43:32 2012 @@ -26,18 +26,11 @@ public final class Ascii { /* * Character translation tables. */ - - private static final byte[] toUpper = new byte[256]; private static final byte[] toLower = new byte[256]; /* * Character type tables. */ - - private static final boolean[] isAlpha = new boolean[256]; - private static final boolean[] isUpper = new boolean[256]; - private static final boolean[] isLower = new boolean[256]; - private static final boolean[] isWhite = new boolean[256]; private static final boolean[] isDigit = new boolean[256]; /* @@ -46,43 +39,21 @@ public final class Ascii { static { for (int i = 0; i < 256; i++) { - toUpper[i] = (byte)i; toLower[i] = (byte)i; } for (int lc = 'a'; lc <= 'z'; lc++) { int uc = lc + 'A' - 'a'; - toUpper[lc] = (byte)uc; toLower[uc] = (byte)lc; - isAlpha[lc] = true; - isAlpha[uc] = true; - isLower[lc] = true; - isUpper[uc] = true; } - isWhite[ ' '] = true; - isWhite['\t'] = true; - isWhite['\r'] = true; - isWhite['\n'] = true; - isWhite['\f'] = true; - isWhite['\b'] = true; - for (int d = '0'; d <= '9'; d++) { isDigit[d] = true; } } /** - * Returns the upper case equivalent of the specified ASCII character. - * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards. - */ - @Deprecated - public static int toUpper(int c) { - return toUpper[c & 0xff] & 0xff; - } - - /** * Returns the lower case equivalent of the specified ASCII character. */ @@ -91,42 +62,6 @@ public final class Ascii { } /** - * Returns true if the specified ASCII character is upper or lower case. - * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards. - */ - @Deprecated - public static boolean isAlpha(int c) { - return isAlpha[c & 0xff]; - } - - /** - * Returns true if the specified ASCII character is upper case. - * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards. - */ - @Deprecated - public static boolean isUpper(int c) { - return isUpper[c & 0xff]; - } - - /** - * Returns true if the specified ASCII character is lower case. - * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards. - */ - @Deprecated - public static boolean isLower(int c) { - return isLower[c & 0xff]; - } - - /** - * Returns true if the specified ASCII character is white space. - * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards. - */ - @Deprecated - public static boolean isWhite(int c) { - return isWhite[c & 0xff]; - } - - /** * Returns true if the specified ASCII character is a digit. */ @@ -218,38 +153,4 @@ public final class Ascii { return n; } - - /** - * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards. - */ - @Deprecated - public static long parseLong(char[] b, int off, int len) - throws NumberFormatException - { - int c; - - if (b == null || len <= 0 || !isDigit(c = b[off++])) { - throw new NumberFormatException(); - } - - long n = c - '0'; - long m; - - while (--len > 0) { - if (!isDigit(c = b[off++])) { - throw new NumberFormatException(); - } - m = n * 10 + c - '0'; - - if (m < n) { - // Overflow - throw new NumberFormatException(); - } else { - n = m; - } - } - - return n; - } - } 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=1228909&r1=1228908&r2=1228909&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/buf/ByteChunk.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/buf/ByteChunk.java Sun Jan 8 18:43:32 2012 @@ -128,8 +128,6 @@ public final class ByteChunk implements private ByteInputChannel in = null; private ByteOutputChannel out = null; - private boolean optimizedWrite=true; - /** * Creates a new, uninitialized ByteChunk object. */ @@ -141,18 +139,6 @@ public final class ByteChunk implements allocate( initial, -1 ); } - /** - * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards. - */ - @Deprecated - public ByteChunk getClone() { - try { - return (ByteChunk)this.clone(); - } catch( Exception ex) { - return null; - } - } - public boolean isNull() { return ! isSet; // buff==null; } @@ -198,14 +184,6 @@ public final class ByteChunk implements isSet=true; } - /** - * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards. - */ - @Deprecated - public void setOptimizedWrite(boolean optimizedWrite) { - this.optimizedWrite = optimizedWrite; - } - public void setCharset(Charset charset) { this.charset = charset; } @@ -298,19 +276,6 @@ public final class ByteChunk implements } // -------------------- Adding data to the buffer -------------------- - /** Append a char, by casting it to byte. This IS NOT intended for unicode. - * - * @param c - * @throws IOException - * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards. - */ - @Deprecated - public void append( char c ) - throws IOException - { - append( (byte)c); - } - public void append( byte b ) throws IOException { @@ -349,7 +314,7 @@ public final class ByteChunk implements // If the buffer is empty and the source is going to fill up all the // space in buffer, may as well write it directly to the output, // and avoid an extra copy - if ( optimizedWrite && len == limit && end == start && out != null ) { + if ( len == limit && end == start && out != null ) { out.realWriteBytes( src, off, len ); return; } @@ -408,30 +373,6 @@ public final class ByteChunk implements } - /** - * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards. - */ - @Deprecated - public int substract(ByteChunk src) - throws IOException { - - if ((end - start) == 0) { - if (in == null) { - return -1; - } - int n = in.realReadBytes( buff, 0, buff.length ); - if (n < 0) { - return -1; - } - } - - int len = getLength(); - src.append(buff, start, len); - start = end; - return len; - - } - public int substract( byte src[], int off, int len ) throws IOException { @@ -677,29 +618,6 @@ public final class ByteChunk implements } /** - * Returns true if the message bytes start with the specified byte array. - * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards. - */ - @Deprecated - public boolean startsWith(byte[] b2) { - byte[] b1 = buff; - if (b1 == null && b2 == null) { - return true; - } - - int len = end - start; - if (b1 == null || b2 == null || b2.length > len) { - return false; - } - for (int i = start, j = 0; i < end && j < b2.length;) { - if (b1[i++] != b2[j++]) { - return false; - } - } - return true; - } - - /** * Returns true if the message bytes starts with the specified string. * @param s the string * @param pos The position @@ -749,14 +667,6 @@ public final class ByteChunk implements return hashBytes( buff, start, end-start); } - /** - * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards. - */ - @Deprecated - public int hashIgnoreCase() { - return hashBytesIC( buff, start, end-start ); - } - private static int hashBytes( byte buff[], int start, int bytesLen ) { int max=start+bytesLen; byte bb[]=buff; @@ -767,18 +677,6 @@ public final class ByteChunk implements return code; } - private static int hashBytesIC( byte bytes[], int start, - int bytesLen ) - { - int max=start+bytesLen; - byte bb[]=bytes; - int code=0; - for (int i = start; i < max ; i++) { - code = code * 37 + Ascii.toLower(bb[i]); - } - return code; - } - /** * Returns the first instance of the given character in this ByteChunk * starting at the specified byte. If the character is not found, -1 is @@ -870,42 +768,6 @@ public final class ByteChunk implements } /** - * Returns the first instance of any byte that is not one of the given bytes - * in the byte array between the specified start and end. - * - * @param bytes The byte array to search - * @param start The point to start searching from in the byte array - * @param end The point to stop searching in the byte array - * @param b The list of bytes to search for - * @return The position of the first instance a byte that is not - * in the list of bytes to search for or -1 if no such byte - * is found. - * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards. - */ - @Deprecated - public static int findNotBytes(byte bytes[], int start, int end, byte b[]) { - int blen = b.length; - int offset = start; - boolean found; - - while (offset < end) { - found = true; - for (int i = 0; i < blen; i++) { - if (bytes[offset] == b[i]) { - found=false; - break; - } - } - if (found) { - return offset; - } - offset++; - } - return -1; - } - - - /** * Convert specified String to a byte array. This ONLY WORKS for ascii, UTF * chars will be truncated. * Modified: tomcat/trunk/java/org/apache/tomcat/util/buf/C2BConverter.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/buf/C2BConverter.java?rev=1228909&r1=1228908&r2=1228909&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/buf/C2BConverter.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/buf/C2BConverter.java Sun Jan 8 18:43:32 2012 @@ -30,13 +30,9 @@ import java.nio.charset.Charset; */ public final class C2BConverter { - private static final org.apache.juli.logging.Log log= - org.apache.juli.logging.LogFactory.getLog(C2BConverter.class ); - private final IntermediateOutputStream ios; private final WriteConvertor conv; private ByteChunk bb; - private final String enc; /** Create a converter, with bytes going to a byte buffer */ @@ -44,41 +40,6 @@ public final class C2BConverter { this.bb=output; ios=new IntermediateOutputStream( output ); conv=new WriteConvertor( ios, B2CConverter.getCharset(encoding)); - this.enc=encoding; - } - - /** - * Create a converter - * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards. - */ - @Deprecated - public C2BConverter(String encoding) throws IOException { - this( new ByteChunk(1024), encoding ); - } - - /** - * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards. - */ - @Deprecated - public ByteChunk getByteChunk() { - return bb; - } - - /** - * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards. - */ - @Deprecated - public String getEncoding() { - return enc; - } - - /** - * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards. - */ - @Deprecated - public void setByteChunk(ByteChunk bb) { - this.bb=bb; - ios.setByteChunk( bb ); } /** Reset the internal state, empty the buffers. @@ -113,46 +74,12 @@ public final class C2BConverter { conv.write( c ); } - /** - * Convert a message bytes chars to bytes - * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards. - */ - @Deprecated - public final void convert(MessageBytes mb ) throws IOException { - int type=mb.getType(); - if( type==MessageBytes.T_BYTES ) { - return; - } - ByteChunk orig=bb; - setByteChunk( mb.getByteChunk()); - bb.recycle(); - bb.allocate( 32, -1 ); - - if( type==MessageBytes.T_STR ) { - convert( mb.getString() ); - // System.out.println("XXX Converting " + mb.getString() ); - } else if( type==MessageBytes.T_CHARS ) { - CharChunk charC=mb.getCharChunk(); - convert( charC.getBuffer(), - charC.getOffset(), charC.getLength()); - //System.out.println("XXX Converting " + mb.getCharChunk() ); - } else { - if (log.isDebugEnabled()) { - log.debug("XXX unknowon type " + type ); - } - } - flushBuffer(); - //System.out.println("C2B: XXX " + bb.getBuffer() + bb.getLength()); - setByteChunk(orig); - } - /** Flush any internal buffers into the ByteOutput or the internal * byte[] */ public final void flushBuffer() throws IOException { conv.flush(); } - } // -------------------- Private implementation -------------------- 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=1228909&r1=1228908&r2=1228909&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/buf/CharChunk.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/buf/CharChunk.java Sun Jan 8 18:43:32 2012 @@ -86,18 +86,6 @@ public final class CharChunk implements // -------------------- - /** - * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards. - */ - @Deprecated - public CharChunk getClone() { - try { - return (CharChunk)this.clone(); - } catch( Exception ex) { - return null; - } - } - public boolean isNull() { if( end > 0 ) { return false; @@ -115,14 +103,6 @@ public final class CharChunk implements end=0; } - /** - * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards. - */ - @Deprecated - public void reset() { - buff=null; - } - // -------------------- Setup -------------------- public void allocate( int initial, int limit ) { @@ -314,41 +294,6 @@ public final class CharChunk implements } - /** - * Add data to the buffer. - * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards. - */ - @Deprecated - public void append( StringBuilder sb ) - throws IOException - { - int len=sb.length(); - - // will grow, up to limit - makeSpace( len ); - - // if we don't have limit: makeSpace can grow as it wants - if( limit < 0 ) { - // assert: makeSpace made enough space - sb.getChars(0, len, buff, end ); - end+=len; - return; - } - - int off=0; - int sbOff = off; - int sbEnd = off + len; - while (sbOff < sbEnd) { - int d = min(limit - end, sbEnd - sbOff); - sb.getChars( sbOff, sbOff+d, buff, end); - sbOff += d; - end += d; - if (end >= limit) { - flushBuffer(); - } - } - } - /** Append a string to the buffer */ public void append(String s) throws IOException { @@ -405,30 +350,6 @@ public final class CharChunk implements } - /** - * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards. - */ - @Deprecated - public int substract(CharChunk src) - throws IOException { - - if ((end - start) == 0) { - if (in == null) { - return -1; - } - int n = in.realReadChars( buff, end, buff.length - end); - if (n < 0) { - return -1; - } - } - - int len = getLength(); - src.append(buff, start, len); - start = end; - return len; - - } - public int substract( char src[], int off, int len ) throws IOException { @@ -532,16 +453,6 @@ public final class CharChunk implements return new String(buff, start, end-start); } - /** - * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards. - */ - @Deprecated - public int getInt() - { - return Ascii.parseInt(buff, start, - end-start); - } - // -------------------- equals -------------------- /** @@ -608,30 +519,6 @@ public final class CharChunk implements } /** - * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards. - */ - @Deprecated - public boolean equals(byte b2[], int off2, int len2) { - char b1[]=buff; - if( b2==null && b1==null ) { - return true; - } - - if (b1== null || b2==null || end-start != len2) { - return false; - } - int off1 = start; - int len=end-start; - - while ( len-- > 0) { - if ( b1[off1++] != (char)b2[off2++]) { - return false; - } - } - return true; - } - - /** * Returns true if the message bytes starts with the specified string. * @param s the string */ Modified: tomcat/trunk/java/org/apache/tomcat/util/buf/HexUtils.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/buf/HexUtils.java?rev=1228909&r1=1228908&r2=1228909&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/buf/HexUtils.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/buf/HexUtils.java Sun Jan 8 18:43:32 2012 @@ -70,15 +70,6 @@ public final class HexUtils { // --------------------------------------------------------- Static Methods - /** - * Provide a mechanism for ensuring this class is loaded. - * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards. - */ - @Deprecated - public static void load() { - // Nothing to do - } - public static int getDec(int index){ return DEC[index]; } Modified: tomcat/trunk/java/org/apache/tomcat/util/buf/MessageBytes.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/buf/MessageBytes.java?rev=1228909&r1=1228908&r2=1228909&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/buf/MessageBytes.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/buf/MessageBytes.java Sun Jan 8 18:43:32 2012 @@ -78,18 +78,6 @@ public final class MessageBytes implemen return factory.newInstance(); } - /** - * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards. - */ - @Deprecated - public MessageBytes getClone() { - try { - return (MessageBytes)this.clone(); - } catch( Exception ex) { - return null; - } - } - public boolean isNull() { // should we check also hasStrValue ??? return byteC.isNull() && charC.isNull() && ! hasStrValue; @@ -108,8 +96,7 @@ public final class MessageBytes implemen hasStrValue=false; hasHashCode=false; - hasIntValue=false; - hasLongValue=false; + hasLongValue=false; } @@ -125,25 +112,9 @@ public final class MessageBytes implemen type=T_BYTES; hasStrValue=false; hasHashCode=false; - hasIntValue=false; hasLongValue=false; } - /** Set the encoding. If the object was constructed from bytes[]. any - * previous conversion is reset. - * If no encoding is set, we'll use 8859-1. - * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards. - */ - @Deprecated - public void setCharset(Charset charset) { - if( !byteC.isNull() ) { - // if the encoding changes we need to reset the conversion results - charC.recycle(); - hasStrValue=false; - } - byteC.setCharset(charset); - } - /** * Sets the content to be a char[] * @@ -156,7 +127,6 @@ public final class MessageBytes implemen type=T_CHARS; hasStrValue=false; hasHashCode=false; - hasIntValue=false; hasLongValue=false; } @@ -166,7 +136,6 @@ public final class MessageBytes implemen public void setString( String s ) { strValue=s; hasHashCode=false; - hasIntValue=false; hasLongValue=false; if (s == null) { hasStrValue=false; @@ -371,25 +340,6 @@ public final class MessageBytes implemen /** * Returns true if the message bytes starts with the specified string. * @param s the string - * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards. - */ - @Deprecated - public boolean startsWith(String s) { - switch (type) { - case T_STR: - return strValue.startsWith( s ); - case T_CHARS: - return charC.startsWith( s ); - case T_BYTES: - return byteC.startsWith( s ); - default: - return false; - } - } - - /** - * Returns true if the message bytes starts with the specified string. - * @param s the string * @param pos The start position */ public boolean startsWithIgnoreCase(String s, int pos) { @@ -452,14 +402,6 @@ public final class MessageBytes implemen } } - /** - * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards. - */ - @Deprecated - public int indexOf(char c) { - return indexOf( c, 0); - } - // Inefficient initial implementation. Will be replaced on the next // round of tune-up public int indexOf(String s, int starting) { @@ -525,59 +467,11 @@ public final class MessageBytes implemen } // -------------------- Deprecated code -------------------- - // efficient int, long and date - // XXX used only for headers - shouldn't be - // stored here. - private int intValue; - private boolean hasIntValue=false; + // efficient long + // XXX used only for headers - shouldn't be stored here. private long longValue; private boolean hasLongValue=false; - /** - * Set the buffer to the representation of an int - * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards. - */ - @Deprecated - public void setInt(int i) { - byteC.allocate(16, 32); - int current = i; - byte[] buf = byteC.getBuffer(); - int start = 0; - int end = 0; - if (i == 0) { - buf[end++] = (byte) '0'; - } - if (i < 0) { - current = -i; - buf[end++] = (byte) '-'; - } - while (current > 0) { - int digit = current % 10; - current = current / 10; - buf[end++] = HexUtils.getHex(digit); - } - byteC.setOffset(0); - byteC.setEnd(end); - // Inverting buffer - end--; - if (i < 0) { - start++; - } - while (end > start) { - byte temp = buf[start]; - buf[start] = buf[end]; - buf[end] = temp; - start++; - end--; - } - intValue=i; - hasStrValue=false; - hasHashCode=false; - hasIntValue=true; - hasLongValue=false; - type=T_BYTES; - } - /** Set the buffer to the representation of an long */ public void setLong(long l) { @@ -615,35 +509,11 @@ public final class MessageBytes implemen longValue=l; hasStrValue=false; hasHashCode=false; - hasIntValue=false; hasLongValue=true; type=T_BYTES; } // Used for headers conversion - /** - * Convert the buffer to an int, cache the value - * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards. - */ - @Deprecated - public int getInt() - { - if( hasIntValue ) { - return intValue; - } - - switch (type) { - case T_BYTES: - intValue=byteC.getInt(); - break; - default: - intValue=Integer.parseInt(toString()); - } - hasIntValue=true; - return intValue; - } - - // Used for headers conversion /** Convert the buffer to an long, cache the value */ public long getLong() { @@ -668,14 +538,6 @@ public final class MessageBytes implemen private static MessageBytesFactory factory=new MessageBytesFactory(); - /** - * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards. - */ - @Deprecated - public static void setFactory( MessageBytesFactory mbf ) { - factory=mbf; - } - public static class MessageBytesFactory { protected MessageBytesFactory() { } Modified: tomcat/trunk/java/org/apache/tomcat/util/buf/UDecoder.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/buf/UDecoder.java?rev=1228909&r1=1228908&r2=1228909&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/buf/UDecoder.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/buf/UDecoder.java Sun Jan 8 18:43:32 2012 @@ -60,17 +60,6 @@ public final class UDecoder { { } - /** URLDecode, will modify the source. Includes converting - * '+' to ' '. - * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards. - */ - @Deprecated - public void convert( ByteChunk mb ) - throws IOException - { - convert(mb, true); - } - /** URLDecode, will modify the source. */ public void convert( ByteChunk mb, boolean query ) @@ -130,17 +119,6 @@ public final class UDecoder { // XXX What do we do about charset ???? /** In-buffer processing - the buffer will be modified - * Includes converting '+' to ' '. - * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards. - */ - @Deprecated - public void convert( CharChunk mb ) - throws IOException - { - convert(mb, true); - } - - /** In-buffer processing - the buffer will be modified */ public void convert( CharChunk mb, boolean query ) throws IOException @@ -195,17 +173,6 @@ public final class UDecoder { } /** URLDecode, will modify the source - * Includes converting '+' to ' '. - * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards. - */ - @Deprecated - public void convert(MessageBytes mb) - throws IOException - { - convert(mb, true); - } - - /** URLDecode, will modify the source */ public void convert(MessageBytes mb, boolean query) throws IOException @@ -236,15 +203,6 @@ public final class UDecoder { // XXX Old code, needs to be replaced !!!! // - /** - * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards. - */ - @Deprecated - public final String convert(String str) - { - return convert(str, true); - } - public final String convert(String str, boolean query) { if (str == null) { Modified: tomcat/trunk/java/org/apache/tomcat/util/buf/UEncoder.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/buf/UEncoder.java?rev=1228909&r1=1228908&r2=1228909&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/buf/UEncoder.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/buf/UEncoder.java Sun Jan 8 18:43:32 2012 @@ -21,15 +21,16 @@ import java.io.IOException; import java.io.Writer; import java.util.BitSet; -/** Efficient implementation for encoders. - * This class is not thread safe - you need one encoder per thread. - * The encoder will save and recycle the internal objects, avoiding - * garbage. +/** + * Efficient implementation of an UTF-8 encoder. + * This class is not thread safe - you need one encoder per thread. + * The encoder will save and recycle the internal objects, avoiding + * garbage. * - * You can add extra characters that you want preserved, for example - * while encoding a URL you can add "/". + * You can add extra characters that you want preserved, for example + * while encoding a URL you can add "/". * - * @author Costin Manolache + * @author Costin Manolache */ public final class UEncoder { @@ -42,20 +43,12 @@ public final class UEncoder { private C2BConverter c2b=null; private ByteChunk bb=null; - private String encoding="UTF8"; + private final String ENCODING = "UTF8"; public UEncoder() { initSafeChars(); } - /** - * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards. - */ - @Deprecated - public void setEncoding( String s ) { - encoding=s; - } - public void addSafeCharacter( char c ) { safeChars.set( c ); } @@ -71,7 +64,7 @@ public final class UEncoder { throws IOException { if( c2b==null ) { bb=new ByteChunk(16); // small enough. - c2b=new C2BConverter( bb, encoding ); + c2b=new C2BConverter( bb, ENCODING ); } for (int i = 0; i < s.length(); i++) { Modified: tomcat/trunk/test/org/apache/tomcat/util/buf/TestByteChunk.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/util/buf/TestByteChunk.java?rev=1228909&r1=1228908&r2=1228909&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/tomcat/util/buf/TestByteChunk.java (original) +++ tomcat/trunk/test/org/apache/tomcat/util/buf/TestByteChunk.java Sun Jan 8 18:43:32 2012 @@ -136,16 +136,4 @@ public class TestByteChunk { 'e' })); assertEquals(-1, ByteChunk.findBytes(bytes, 2, 5, new byte[] { 'w' })); } - - @Test - public void testFindNotBytes() throws UnsupportedEncodingException { - byte[] bytes = "Hello\u00a0world".getBytes("ISO-8859-1"); - final int len = bytes.length; - - assertEquals(4, ByteChunk.findNotBytes(bytes, 0, len, new byte[] { 'l', - 'e', 'H' })); - assertEquals(-1, ByteChunk.findNotBytes(bytes, 0, len, bytes)); - assertEquals(-1, ByteChunk.findNotBytes(bytes, 2, 3, new byte[] { 'l', - 'e', 'H' })); - } } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org