Author: markt
Date: Mon May 17 08:26:43 2010
New Revision: 945016

URL: http://svn.apache.org/viewvc?rev=945016&view=rev
Log:
findChar is inconsistent in that it only supports characters in the range 0-127 
while all the other methods support all single byte characters.
It isn't used within the Tomcat codebase. Make it's behaviour consistent with 
the other character search methods.

Modified:
    tomcat/trunk/java/org/apache/tomcat/util/buf/ByteChunk.java

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=945016&r1=945015&r2=945016&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/buf/ByteChunk.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/buf/ByteChunk.java Mon May 17 
08:26:43 2010
@@ -778,7 +778,7 @@ public final class ByteChunk implements 
      * Returns the first instance of the given character in the given byte 
array
      * between the specified start and end.
      * <br/>
-     * NOTE: This only works for characters in the range 0-127.
+     * NOTE: This only works for single byte characters.
      * 
      * @param bytes The byte array to search
      * @param start The point to start searching from in the byte array
@@ -788,15 +788,7 @@ public final class ByteChunk implements 
      *                  if the character is not found.
      */
     public static int findChar(byte bytes[], int start, int end, char c) {
-        byte b = (byte)c;
-        int offset = start;
-        while (offset < end) {
-            if (bytes[offset] == b) {
-                return offset;
-            }
-            offset++;
-        }
-        return -1;
+        return indexOf(bytes, start, end, c);
     }
 
     /**



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

Reply via email to