From 3f1aec648aa87c64ce4118ede50d1808b823d6e5 Mon Sep 17 00:00:00 2001 From: markt Date: Mon, 17 May 2010 08:26:43 +0000 Subject: [PATCH] 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. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@945016 13f79535-47bb-0310-9956-ffa450edef68 --- java/org/apache/tomcat/util/buf/ByteChunk.java | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/java/org/apache/tomcat/util/buf/ByteChunk.java b/java/org/apache/tomcat/util/buf/ByteChunk.java index 912685d64..5a1d48202 100644 --- a/java/org/apache/tomcat/util/buf/ByteChunk.java +++ b/java/org/apache/tomcat/util/buf/ByteChunk.java @@ -778,7 +778,7 @@ public final class ByteChunk implements Cloneable, Serializable { * Returns the first instance of the given character in the given byte array * between the specified start and end. *
- * 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 Cloneable, Serializable { * 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); } /** -- 2.11.0