Return-Path: Delivered-To: apmail-tomcat-dev-archive@www.apache.org Received: (qmail 21392 invoked from network); 17 May 2010 17:15:14 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 17 May 2010 17:15:14 -0000 Received: (qmail 48144 invoked by uid 500); 17 May 2010 17:15:14 -0000 Delivered-To: apmail-tomcat-dev-archive@tomcat.apache.org Received: (qmail 48034 invoked by uid 500); 17 May 2010 17:15:14 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 48025 invoked by uid 99); 17 May 2010 17:15:14 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 May 2010 17:15:13 +0000 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=AWL,RCVD_IN_DNSWL_NONE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [193.252.22.159] (HELO smtp5.freeserve.com) (193.252.22.159) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 May 2010 17:15:06 +0000 Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf3428.me.freeserve.com (SMTP Server) with ESMTP id 0835C1C00913 for ; Mon, 17 May 2010 19:14:45 +0200 (CEST) Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf3428.me.freeserve.com (SMTP Server) with ESMTP id E83851C008F1 for ; Mon, 17 May 2010 19:14:44 +0200 (CEST) Received: from mail.homeinbox.net (unknown [91.109.180.115]) by mwinf3428.me.freeserve.com (SMTP Server) with ESMTP id B317D1C00913 for ; Mon, 17 May 2010 19:14:44 +0200 (CEST) X-ME-UUID: 20100517171444733.B317D1C00913@mwinf3428.me.freeserve.com Received: from localhost (localhost [127.0.0.1]) by mail.homeinbox.net (Postfix) with ESMTP id 10AEA32ACE for ; Mon, 17 May 2010 18:15:34 +0100 (BST) X-Virus-Scanned: Debian amavisd-new at homeinbox.net Received: from mail.homeinbox.net ([127.0.0.1]) by localhost (mail.homeinbox.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id X+7qHzUlMCxZ for ; Mon, 17 May 2010 18:15:30 +0100 (BST) Received: from [192.168.0.9] (router.dev.local [192.168.0.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.homeinbox.net (Postfix) with ESMTPSA id 7770B32AB8 for ; Mon, 17 May 2010 18:15:30 +0100 (BST) Message-ID: <4BF17981.9020207@apache.org> Date: Mon, 17 May 2010 18:14:41 +0100 From: Mark Thomas User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-GB; rv:1.9.1.9) Gecko/20100317 Thunderbird/3.0.4 MIME-Version: 1.0 To: Tomcat Developers List Subject: Re: svn commit: r945231 - /tomcat/trunk/java/org/apache/tomcat/util/buf/ByteChunk.java References: <20100517162845.1CEFC238890D@eris.apache.org> <4BF1712D.4030205@apache.org> <4BF17811.7070901@apache.org> In-Reply-To: <4BF17811.7070901@apache.org> X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On 17/05/2010 18:08, Mark Thomas wrote: > On 17/05/2010 17:50, Konstantin Kolinko wrote: >> I am a bit shivering looking at ([a++] != [b++]), >> but I did minimal changes to fix the issue. > > Understood. If I get a chance, I'll look to see if I can find an equally > good alternative. How about (diff to original file) Index: java/org/apache/tomcat/util/buf/ByteChunk.java =================================================================== --- java/org/apache/tomcat/util/buf/ByteChunk.java (revision 945095) +++ java/org/apache/tomcat/util/buf/ByteChunk.java (working copy) @@ -688,6 +688,9 @@ for( int i=myOff+start; i <= (end - srcLen); i++ ) { if( buff[i] != first ) continue; // found first char, now look for a match + if (src.length() == 1) { + return i-start; + } int myPos=i+1; for( int srcPos=srcOff + 1; srcPos< srcEnd; ) { if( buff[myPos++] != src.charAt( srcPos++ )) Your test: assertEquals(0, bc.indexOf("wo", 0, 1, 0)); fails but given "wo".length != 1 then I'm not sure that is an issue. Mark --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org For additional commands, e-mail: dev-help@tomcat.apache.org